public sealed class GpuClusterVisibilityThe device side of the cluster traversal: the DAG in buffers, the dispatch, and the page requests coming back.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
GpuVisibilityGroup's sibling, and the same three-part arrangement. That one owns the object cull's buffers and dispatch, MeshRenderFeature extracts what it culls, and GpuCullingRenderer puts the dispatch in the frame. This one owns the traversal's buffers and dispatch, VirtualGeometryRenderFeature extracts what it traverses, and ClusterCullingRenderer puts it in the frame. Deliberately the same shape, because it is the same decision at a different depth of the same hierarchy — which is improvement 3 of docs/plan/22-virtualized-geometry.md, and is why the shader is one shader.
Two kinds of buffer, and the difference is what changes. The cluster records, the child runs and the roots are the meshes — they change when a mesh is registered or forgotten, which is a load, not a frame. The instances are the scene — they change when something moves. So the first three are uploaded on a dirty flag and the last through a PersistentUploadBuffer`1, which is phase 0's answer to the same question about objects.
The answer never comes back to the host, and that is the point. What the dispatch writes is a visible-cluster list an indirect draw reads and a request list the residency service reads. Only the second is read back, it is small, and it is read a frame late on purpose — see ServiceRequests.
Fields and properties (40)
public const int VisiblePerInstanceHow many bytes of visible-cluster list are allocated per instance per view.
public const int VisibleBaseHow many counter words the visible list carries before its first entry.
public const uint PageAbsentWhat the slot table holds for a page whose bytes are not in the pool.
public const int RequestCapacityHow many page requests one frame's dispatch may record.
public EffectSystem? EffectsWhere the traversal variant is resolved from. Null does nothing.
public ComputePipelineCache? PipelinesWhere the compute pipeline comes from. Null does nothing.
public HiZPyramid? OccludersLast frame's depth, min-reduced, or null to test the frustum and the cone alone.
public PageResidency? ResidencyWhich pages are in the pool. Null traverses as though none are.
public int MeshCountHow many meshes are registered.
public int ClusterCountHow many clusters they have between them.
public int PageCountHow many pages, which is what the slot table has to cover.
public int PageSizeHow many bytes one page occupies in the pool.
public int MaximumTrianglesThe most triangles any registered cluster holds.
public int InstanceCountHow many instances the last Prepare uploaded.
public long InstanceBytesUploadedHow many bytes of instance records it handed to the device.
public int InstanceUploadRegionsHow many separate writes those bytes took.
public bool TraversedOnDeviceWhether the last frame's traversal ran on the device.
public int VisibleClustersHow many clusters the last serviced frame's traversal wanted to draw.
public int SoftwareClustersHow many of them the software raster was asked to draw.
public bool VisibleOverflowedWhether that count exceeded what the list can hold.
public int RequestedPagesHow many page requests came back from it.
public BufferHandle VisibleThe buffer the accepted clusters are appended to: element zero is the count.
public BufferHandle RequestsThe pages the traversal wanted and did not have. Element zero is the count.
public BufferHandle GeometryWhere each cluster's bytes are, for the raster.
public BufferHandle GridsOne quantization grid per registered mesh.
public BufferHandle MaterialsWhich material each cluster uses, for the resolve's binning.
public int MaterialCountThe highest material index any registered cluster names, plus one.
public BufferHandle SlotsWhere each page sits in the pool, or PageAbsent.
public long SlotsOffsetWhere this frame's slot table starts in that buffer.
public int SlotBaseWhere it starts in entries rather than bytes.
public BufferHandle InstancesWhere this frame's instance records start.
public long InstancesOffsetpublic int InstanceBaseWhere this frame's instance records start, in records rather than bytes.
public BufferHandle BonesEvery skinned instance's matrices, for the raster and the resolve to read.
public int BoneBaseWhere this frame's palettes start, in matrices rather than bytes.
public int BoneCountHow many matrices this frame's palettes hold, including the leading identity.
public ReadOnlySpan<CullCluster> RecordsThe merged cluster records, as the device will read them.
public ReadOnlySpan<RasterCluster> GeometryRecordsThe merged geometry records, as the raster will read them.
public ReadOnlySpan<RasterMesh> MeshRecordsOne grid per registered mesh, as the raster and the resolve read them.
public ReadOnlySpan<CullInstance> InstanceRecordsThis frame's instance records, before they reach the device.
Methods (12)
public GpuClusterVisibility(IGraphicsDevice device)Creates a traversal that runs on a device.
public ClusterMesh Register(MeshletMesh mesh, MeshletPageSet pages, int source)Registers a mesh's DAG, and pins its root page.
public ClusterMesh MeshAt(int index)What a registered mesh's records are, by registration order.
public void Begin(int count)Begins a frame's instance records, keeping what did not change.
public void BeginBones()Begins a frame's bone palettes, discarding the last frame's.
public int AddBones(ReadOnlySpan<Matrix4x4> palette)Adds one instance's palette to this frame's.
public void Set(int index, in CullInstance instance)Sets one instance's record, uploading it only if it differs.
public void UploadInstances()Hands whatever changed to the device.
public bool Prepare(IReadOnlyList<RenderView> frameViews, ReadOnlySpan<float> errorScale, ReadOnlySpan<float> errorThreshold, ReadOnlySpan<float> softwareThreshold = default(ReadOnlySpan<float>))Resolves the variant, uploads what changed, and leaves a dispatch for the frame to record.
public bool Record(ICommandList list)Records the traversal into the frame's own list.
public int ServiceRequests(int maxLoads = 8)Feeds the previous frame's requests to the residency service and lets it work.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (23)
- VirtualGeometryGameVirtualGeometry
- AssetVirtualGeometrySourceVixen.Engine.Renderer
- BinVixen.Rendering
- ClusterCullingRendererVixen.Rendering
- ClusterRasterTestsVixen.Rendering.Tests
- ClusterResolveTestsVixen.Rendering.Tests
- CompositorAssetTestsVixen.Rendering.Tests
- CompositorBuilderVixen.Rendering
- GpuClusterRasterVixen.Rendering
- GpuClusterResolveVixen.Rendering
- GpuClusterSoftwareRasterVixen.Rendering
- GpuVisibilityTilesVixen.Rendering
- SceneRenderHostTestsVixen.Engine.Renderer.Tests
- SkinnedClusterTestsVixen.Rendering.Tests
- VirtualGeometryContentTestsVixen.Rendering.Tests
- VirtualGeometryDeviceTestsVixen.Graphics.Golden.Tests
- VirtualGeometryFrameTestsVixen.Rendering.Tests
- VirtualGeometryGoldenTestsVixen.Graphics.Golden.Tests
- VirtualGeometryRenderFeatureVixen.Rendering
- VirtualGeometrySystemVixen.Rendering
- VisibilityBufferRendererVixen.Rendering
- VisibilityResolveTestsVixen.Rendering.Tests
- ImportedGeometryLoadsTestsVixen.Editor.Assets.Tests