public sealed class VideoTextureThe planes of a video, on the GPU, kept up to date from a player.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Three textures, not one, and no conversion on the way. A 4:2:0 frame is a full-size luma plane and two quarter-size chroma planes — three R8 textures, uploaded exactly as the decoder produced them. Converting to RGBA first would mean touching four times as many bytes on the CPU, uploading four times as many, and doing on a core what the sampler does for nothing. Coefficients is what a material multiplies by.
A staging buffer per frame in flight. The RHI defers destruction for the caller but explicitly does not defer overwriting: a staging buffer the GPU is still copying out of must not be written again, and "still" lasts FramesInFlight frames. So there is one buffer per slot and Upload rotates through them, which is the same answer DescriptorAllocator arrives at for the same reason.
Planes are aligned within the buffer rather than packed. A copy's source offset has alignment rules on every API — four bytes at minimum, more on some hardware — and a luma plane's size is width × height, which is not reliably a multiple of anything. Two hundred and fifty-six bytes of padding per plane costs three quarters of a kilobyte and removes a class of driver-specific failure that only appears at odd resolutions.
Fields and properties (5)
public VideoFormat FormatWhat the textures currently hold.
public int PlaneCountHow many planes there are.
public VideoColourCoefficients CoefficientsWhat a shader multiplies the samples by to get RGB.
public SamplerHandle SamplerA sampler for the planes: linear, clamped.
public uint UploadedVersionThe FrameVersion that was last uploaded.
Methods (6)
public VideoTexture(IGraphicsDevice device, string name = "video")Creates an empty video texture.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public TextureHandle Plane(int plane)A plane's texture.
public TextureViewHandle PlaneView(int plane)A plane's view, which is what a descriptor set binds.
public bool Upload(ICommandList commands, VideoPlayer player)Copies a player's current frame into the textures, if it is a new one.
public void Upload(ICommandList commands, VideoFrame frame)Copies a frame into the textures.
Used by (10)
- VideoGameVideoPlayback
- VideoConstantsVixen.Video.Rendering
- VideoConstantsTestsVixen.Video.Rendering.Tests
- VideoDrawVixen.Video.Rendering
- VideoInUiTestsVixen.Video.Rendering.Tests
- VideoRenderTargetVixen.Video.Rendering
- VideoRendererVixen.Video.Rendering
- VideoRendererTestsVixen.Video.Rendering.Tests
- VideoSurfaceUploaderVixen.Video.Rendering
- VideoTextureTestsVixen.Video.Tests