Vixen
02b45cc4
csharp
public sealed class VideoRenderTarget

A video's picture as one ordinary colour texture, converted once a frame.

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

Remarks

What makes a video usable by everything that wants a texture and not three. VideoRenderer draws planes straight into whatever pass it is recorded in, which is the cheapest thing for a cutscene that covers the screen and no use at all to a consumer that can only bind one view: a user interface's image command, a material slot, a thumbnail. This runs the same conversion into a target of its own and hands over the view.

⚠ It costs a texture and a pass per video per frame, and that is the whole trade. Drawing straight into the destination avoids both — so a full-screen cutscene should not use this, and anything that has to name the video by a texture handle has no alternative that is not a CPU conversion, which touches four times the bytes to do on a core what the sampler does for nothing.

⚠ Not sRGB. A decoded video's RGB is already gamma-encoded — that is what the BT.709 transfer function is — so an sRGB target encodes it a second time and shows as mid-tones far too bright. The consumer samples these bytes as they are.

Fields and properties (5)

  • public const PixelFormat Format

    What the target is, and what a renderer drawn into it must be built for.

  • public TextureHandle Texture

    The texture, or an invalid handle before the first draw.

  • public TextureViewHandle View

    The view a consumer binds, or an invalid handle before the first draw.

  • public Int2 Size

    How big it currently is.

  • public int Revision

    Bumped whenever View becomes a different view.

Methods (5)

  • public VideoRenderTarget(IGraphicsDevice device, VideoShaders shaders, string name = "video target")

    Builds a target with a renderer of its own.

  • public VideoRenderTarget(IGraphicsDevice device, VideoRenderer renderer, string name = "video target")

    Builds a target over a renderer somebody else owns.

  • public bool Draw(ICommandList commands, VideoTexture planes, VideoPlayer player)

    Converts a player's current picture into the target.

  • public bool Draw(ICommandList commands, VideoTexture planes, Int2 size)

    Converts uploaded planes into the target, at a size of the caller's choosing.

  • public void Dispose()

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

Used by (1)

  • VideoInUiTestsVixen.Video.Rendering.Tests