Vixen
02b45cc4
csharp
public sealed class VirtualGeometryRenderFeature

Draws virtualized geometry: the scene half of GpuClusterVisibility.

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

Remarks

MeshRenderFeature's counterpart, and the same division of labour. That one owns a draw per object and lets TransformRenderFeature say where the object is and MaterialRenderFeature say what it is drawn with. This one owns which DAG an object draws and hands the traversal an instance record per frame; what the traversal decides is a list of clusters, and what draws them is phase 4's raster.

It draws nothing itself, and that is not a gap. A root feature's Draw turns a work list into commands, and there is no per-object command here to issue: the whole point of the arrangement is that one indirect draw covers every cluster of every instance, and the host never learns how many there are. So this feature extracts, prepares, and stops — see ClusterCullingRenderer for where the dispatch goes and docs/plan/22-virtualized-geometry.md phase 4 for what consumes it.

Registration is a load-time act and instancing is a frame-time one. Register is called once per mesh — it flattens the DAG, offsets its page indices into the pool's global numbering and pins its root page — and Prepare then only writes an instance record per object, incrementally, so a scene of a hundred thousand virtualized objects of which one moved uploads one record.

Fields and properties (12)

  • public const float DefaultErrorThreshold

    How many pixels of deviation a cut tolerates by default.

  • public const float DefaultSoftwareThreshold

    What a view's software-raster threshold is unless a host measures otherwise.

  • public override string Name

    The feature's name, for logging and profiling.

  • public RenderDataKey<VirtualGeometryDraw> Draws

    One draw per object.

  • public GpuClusterVisibility? Visibility

    The traversal this feature feeds. Null does nothing at all.

  • public MeshletPagePool? Pages

    Where page bytes are read from and put. Null draws whatever is already resident.

  • public float ErrorThreshold

    How many pixels of deviation a cut tolerates.

  • public float SoftwareThreshold

    How wide a cluster may be on screen, in pixels, before it goes to the hardware raster.

  • public int ScreenHeight

    How many pixels tall the output is, which is what turns a pixel budget into a distance.

  • public int LoadsPerFrame

    How many page loads may be started per frame.

  • public int RequestedPages

    How many pages the last frame's traversal wanted and did not have.

  • public int RegisteredMeshes

    How many meshes have been registered.

Methods (5)

  • public int Register(MeshletMesh mesh, MeshletPageSet pages, int source)

    Registers a mesh so objects can draw it, and makes its geometry reachable.

  • public void BeginBones()

    Starts a frame's bone palettes. Call before the first SetBones.

  • public void SetBones(RenderSystem system, RenderObjectId id, ReadOnlySpan<Matrix4x4> palette)

    Gives an object its pose for this frame.

  • protected internal override void Initialize(RenderSystem system)

    Registers this feature's own per-object data. Called once, when it is added.

  • protected internal override void Prepare(RenderSystem system)

Used by (11)

  • VirtualGeometryGameVirtualGeometry
  • ClusterRoutingTestsVixen.Rendering.Tests
  • MeshExtractionSystemVixen.Rendering
  • SkinnedClusterTestsVixen.Rendering.Tests
  • VirtualGeometryContentVixen.Rendering
  • VirtualGeometryContentTestsVixen.Rendering.Tests
  • VirtualGeometryDeviceTestsVixen.Graphics.Golden.Tests
  • VirtualGeometryExtractionTestsVixen.Rendering.Tests
  • VirtualGeometryFrameTestsVixen.Rendering.Tests
  • VirtualGeometryGoldenTestsVixen.Graphics.Golden.Tests
  • VirtualGeometrySystemVixen.Rendering