Vixen
dd8b0a81
csharp
public readonly record struct TextureExternal

A texture supplied for one of a plan's external images, and what it was created with.

Read the guide page for this →

Remarks

⚠ The usage is here because nothing else can answer for it. A TextureHandle is an opaque number and IGraphicsDevice has no way to describe one back, so an evaluator handed a bare handle cannot know whether copying out of it is legal — #722. Declaring it beside the handle turns "the caller forgot" from undefined behaviour into a refusal with a message.

⚠ Size is here for exactly the same reason, and #1000 is what it costs to be without it. An external image is the one place an absolute size enters a plan, so SizeOf cannot answer for one — it reads a level off an image nothing allocates. A dispatch never needed the number, because every kernel clamps its taps to the source's own GetDimensions; a Cpu op does, because it is a vkCmdCopyImageToBuffer and a copy has to name an extent. Sized from the plan's nominal level, that copy asked a 16×16 upload for 64×64 and handed the operation 48 rows of a buffer nothing had written.

⚠ What it is not: proof. A declaration that does not match the description the texture was created with is a lie this type cannot detect, and the behaviour is then exactly what it was before — undefined, and green on a unified adapter. Write the two in one place: create the texture and build the TextureExternal from the same TextureUsage expression, the way TextureKernelHarness.Upload does.

Fields and properties (6)

  • public TextureHandle Texture

    The caller's texture.

  • public TextureUsage Usage

    The TextureUsage it was created with — the same expression that was passed to CreateTexture, and not a wish.

  • public Int2 Size

    How big the picture actually is, in texels, or the default for a caller that did not say.

  • public bool HasSize

    Whether the caller said how big the picture is.

  • public const TextureUsage Sampled

    What every external image needs, because a dispatch samples it.

  • public const TextureUsage ReadBack

    What an external image a Cpu op reads needs on top of that.

Methods (1)

  • public TextureExternal(TextureHandle Texture, TextureUsage Usage, Int2 Size = default(Int2))

    A texture supplied for one of a plan's external images, and what it was created with.

Used by (8)

  • TextureExternalUsageTestsVixen.Editor.TextureGraph.Tests
  • TextureKernelHarnessVixen.Editor.TextureGraph.Tests
  • TextureKernelSabotageTestsVixen.Editor.TextureGraph.Tests
  • TexturePlanEvaluatorVixen.Editor.TextureGraph
  • TextureProjectionDeviceTestsVixen.Editor.TextureGraph.Tests
  • TextureUploadDeviceTestsVixen.Editor.TextureGraph.Tests
  • TextureUploadTestsVixen.Editor.TextureGraph.Tests
  • TextureUploadsVixen.Editor.TextureGraph