Vixen
02b45cc4
csharp
public sealed class ScreenProbeTexture

A screen probe atlas, mirrored into a device texture.

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

Remarks

One 2D texture, radiance in the colour and validity in the alpha. A probe's map is an 8×8 patch at AtlasOrigin, exactly the arrangement the CPU atlas uses, because the two are one convention — ScreenProbeAtlas.rvn holds the shader's half and the convention tests hold the pair together. Alpha one is a gathered texel; alpha zero is a probe nothing gathered, which is what lets a readback tell "nothing ran" from "gathered nothing but darkness".

The mirror uploads the CPU atlas, unless the atlas is the dispatch's. The same arrangement, for the same doc 19 reasons, as PoolIsWritten: a target with compute traces the atlas on the device and the CPU copy stops being what the shader reads; a readback is then the only way the closed forms have anything to test.

⚠ The texture is not a graph resource — it is named into descriptor sets — so nothing else in a frame will transition it. Whoever dispatches into it brackets with TransitionAtlas, the way every fill over the irradiance pool already does.

Fields and properties (8)

  • public ScreenProbeAtlas Probes

    The atlas this mirrors.

  • public bool IsCreated

    Whether the device objects exist yet.

  • public int Uploads

    How many times the atlas has been uploaded.

  • public bool AtlasIsWritten

    Whether a compute dispatch owns the texels, so the upload must not.

  • public TextureHandle Atlas

    The atlas texture.

  • public TextureViewHandle AtlasView

    Its view, for descriptor writes.

  • public const ResourceState AtlasIsBeingWritten

    What the atlas is in while a dispatch owns it — writable, and readable by the next one.

  • public TextureDescription ProbePlaneDescription

    What one plane is, for the same import.

Methods (13)

  • public ScreenProbeTexture(ScreenProbeAtlas probes)

    Builds a mirror of one atlas. Nothing exists on the device until the first upload.

  • public TextureViewHandle ProbeView(int plane)

    One plane of the resolved probes — grid-sized, in the irradiance pool's packing.

  • public void TransitionProbes(ICommandList commands, ResourceState before, ResourceState after)

    Moves the four resolved-probe planes from one state to another, in one barrier.

  • public void EnsureCreated(IGraphicsDevice graphics)

    Creates the device objects without recording anything.

  • public void Upload(IGraphicsDevice graphics, ICommandList commands)

    Creates the texture if it does not exist, and uploads the CPU atlas unless a dispatch owns it.

  • public void TransitionAtlas(ICommandList commands, ResourceState before, ResourceState after)

    Moves the atlas from one state to another.

  • public void OrderAtlas(ICommandList commands)

    Orders everything written to the atlas so far against whatever reads it next.

  • public bool RecordReadback(ICommandList commands)

    Records a copy of the whole atlas back into host memory.

  • public bool RecordProbeReadback(ICommandList commands)

    Records a copy of the four resolved-probe planes back into host memory.

  • public bool TryReadProbes(Span<SphericalHarmonicsL1> resolved, Span<float> validities)

    Decodes what the last RecordProbeReadback copied.

  • public bool TryRead(Span<Vector4> texels)

    Decodes what the last RecordReadback copied.

  • public TextureHandle ProbePlane(int plane)

    One plane's texture, for importing into a compositor's graph.

  • public void Dispose()

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

Used by (12)

  • AccelerationStructureDeviceTestsVixen.Graphics.Golden.Tests
  • ScreenProbeAccumulateDeviceTestsVixen.Graphics.Golden.Tests
  • ScreenProbeAccumulateFillVixen.Rendering
  • ScreenProbeBilateralImageTestsVixen.Graphics.Golden.Tests
  • ScreenProbeGatherImageTestsVixen.Graphics.Golden.Tests
  • ScreenProbeGatherRendererVixen.Rendering.PostFx
  • ScreenProbeResolveVixen.Rendering
  • ScreenProbeResolveDeviceTestsVixen.Graphics.Golden.Tests
  • ScreenProbeTraceDeviceTestsVixen.Graphics.Golden.Tests
  • ScreenProbeTraceFillVixen.Rendering
  • ScreenProbeUpsampleImageTestsVixen.Graphics.Golden.Tests
  • ScreenProbeUpsampleRendererVixen.Rendering.PostFx