Vixen
02b45cc4
csharp
public sealed class GpuClusterResolve

Shading the visibility buffer: one indirect dispatch per material, over the tiles that material is actually in.

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

Remarks

The second half of phase 5 of docs/plan/22-virtualized-geometry.md, and the reason improvement 2 is worth the bookkeeping. GpuVisibilityTiles bins the screen and this dispatches over one material's bin, so a material covering one per cent of the screen shades one per cent of the pixels — against a full-screen material-depth pass, which is what resolving into a GBuffer costs.

A variant per material, and the composition is the material's own. The key is VisibilityResolve with the material's Composition filling the same two slots ForwardPlus composes — so a material is one surface feature chain and one shading model whichever pass reaches it, which is what "a second entry contract, not a second material system" has to mean. What differs is one permutation: UseAnalyticGradients, because a compute stage has no quad to take derivatives from.

Every binding is filled by name, through the effect's own plan. The resolve's resources and the material's parameters go into one collection and EffectSetWriter writes the set from the variant's reflection — the same route MaterialRenderFeature takes, and for the same reason: what a composed shader's set contains is whatever the material's features brought, so a host that numbered the bindings would be numbering a layout it cannot see.

The dispatch is indirect and the host never learns the tile count. The binning pass wrote it into the argument triple this reads, so a material covering the whole screen and one covering none are the same command.

Fields and properties (17)

  • public EffectSystem? Effects

    Where the resolve variants are compiled. Null resolves nothing.

  • public ComputePipelineCache? Pipelines

    Where the compute pipelines come from. Null resolves nothing.

  • public GpuClusterVisibility? Visibility

    The traversal whose clusters are being shaded. Null resolves nothing.

  • public GpuVisibilityTiles? Tiles

    The binning whose lists are being dispatched over. Null resolves nothing.

  • public MeshletPagePool? Pages

    The page pool the geometry is read out of. Null resolves nothing.

  • public IReadOnlyList<ResolveMaterial> Materials

    Which material each bin holds. Set by whoever registered the meshes.

  • public SceneConstants? Scene

    The lights, the shadow atlas, the environment and the irradiance field: set 0.

  • public ViewConstants? ViewConstants

    The camera's constants: set 1.

  • public DescriptorSetHandle DrawSet

    The per-draw set: set 3, which holds the unclustered light list and the probe scalars.

  • public DescriptorSetHandle TextureTable

    The table every material's textures live in.

  • public bool ImageBasedLighting

    Whether the variants compile the environment ambient term in.

  • public bool IrradianceField

    Whether they read indirect diffuse from a field.

  • public bool SplitOutputs

    Whether the resolve splits its answer across three planes — the ambient split.

  • public int ResolvedMaterials

    How many materials the last Prepare resolved a variant for.

  • public int Unresolved

    How many were asked for and could not be.

  • public int Dispatches

    How many dispatches the last Record issued.

  • public const string AnalyticGradientsKey

    The permutation that swaps implicit derivatives for supplied ones.

Methods (5)

Used by (8)

  • BinVixen.Rendering
  • ClusterResolveTestsVixen.Rendering.Tests
  • CompositorAssetTestsVixen.Rendering.Tests
  • CompositorBuilderVixen.Rendering
  • SceneRenderHostTestsVixen.Engine.Renderer.Tests
  • VirtualGeometryContentTestsVixen.Rendering.Tests
  • VirtualGeometrySystemVixen.Rendering
  • VisibilityBufferRendererVixen.Rendering