Vixen
02b45cc4
csharp
public sealed class VideoRenderer

Draws a video's planes. The device half.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

One pipeline, no vertex buffer, one descriptor set per texture. A video is one quad and the quad is built from gl_VertexIndex, so there is nothing to allocate per frame and nothing to upload: everything that varies between two videos on one screen is in sixty-four bytes of push constant and a descriptor set that was written once.

⚠ Kept separate from VideoRenderFeature for the reason UiRenderer is kept separate from UiRenderFeature: this is the part that touches a device, so a golden image or a sample can drive it without a RenderSystem, a camera or a compositor — which is the only way to find out whether the shader agrees with the six coefficients the module computed.

⚠ The picture is written premultiplied and the target must not be sRGB. A decoded video's RGB is already gamma-encoded — that is what the BT.709 transfer function is — so an sRGB colour target encodes it a second time and shows as mid-tones that are far too bright. A renderer lighting a video as a texture in a scene wants the opposite; a player showing it wants the bytes to arrive as they are.

Fields and properties (2)

  • public int Draws

    How many draws the last run of Record submitted.

  • public int DescriptorWrites

    How many descriptor sets have been written, which is once per texture and once per resize.

Methods (5)

  • public VideoRenderer(IGraphicsDevice device, VideoShaders shaders, RenderOutput output, string name = "video")

    Builds the pipeline a video pass needs.

  • public bool Forget(VideoTexture texture)

    Forgets a texture's descriptor set, for a video that has gone away.

  • public void Begin()

    Starts a run of draws. Called inside a render pass, before the first Record.

  • public bool Record(ICommandList commands, in VideoDraw draw, Int2 surface)

    Records one video. Called inside a render pass.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (4)

  • VideoGameVideoPlayback
  • VideoRenderFeatureVixen.Video.Rendering
  • VideoRenderTargetVixen.Video.Rendering
  • VideoRendererTestsVixen.Video.Rendering.Tests