Class TiledCullFeeder
Namespace: ValveResourceFormat.Renderer.Buffers
Assembly: Renderer.dll
CPU side of compute_tile_cullbits and compute_depthbin_cullbits: projects world space volumes into the screen AABBs, hulls and depth keys those passes rasterize into bits.
public sealed class TiledCullFeederInheritance
Remarks
Neither compute pass sees world space, so frustum rejection happens here, and a rejected item costs a bit rather than a test - item count sets the word stride, the buffer size and the shading loop's length. Cull space is pixels and the depth key is octaves past the near plane; common/light_cull.slang defines both the same way and the two must not drift.
Fields
BatchBarnLights
Batch index holding barn light faces.
public const int BatchBarnLights = 0Field Value
BatchCount
Item classes culled together in one dispatch. Batch 2 is reserved for light probe volumes.
public const int BatchCount = 3Field Value
BatchEnvMaps
Batch index holding environment map probes.
public const int BatchEnvMaps = 1Field Value
ItemsPerMask
Items per mask. Batches pad up to a whole number of these so no word spans two batches.
public const int ItemsPerMask = 32Field Value
Properties
BinDispatch
Gets the depth bin pass dispatch size.
public (int X, int Y, int Z) BinDispatch { get; }Property Value
DepthKeyRange
Gets the span of the depth key, log2(SliceFar / SliceNear). Valid after .
public float DepthKeyRange { get; }Property Value
ItemArray
Gets the backing array to upload from.
public CullItem[] ItemArray { get; }Property Value
CullItem[]
ItemCount
Gets the live entries of this frame, tail padding included.
public int ItemCount { get; }Property Value
MaskCount
Gets the mask count across all batches, which is the dispatch's mask axis.
public int MaskCount { get; }Property Value
MaxItemViewDepth
Gets how far along the view axis the furthest item this frame reached.
public float MaxItemViewDepth { get; }Property Value
Remarks
The slice distribution is fitted to this rather than to the render far plane: it is logarithmic, so every empty octave past the last light thickens every slice nearer in. Unbounded volumes are excluded, since they would pin it to its ceiling.
Params
Gets the constants both compute passes read.
public ref readonly CullParams Params { get; }Property Value
PlaneArray
Gets the hull vertex array indexes.
public Vector2[] PlaneArray { get; }Property Value
Vector2[]
PlaneCount
Gets the live entries of this frame.
public int PlaneCount { get; }Property Value
SliceFar
Gets the far distance the slice distribution was fitted to this frame, in world units.
public float SliceFar { get; }Property Value
SliceNear
Gets the near distance the slice distribution starts at, which is the camera's near plane.
public float SliceNear { get; }Property Value
SliceRatio
Gets how much deeper each slice is than the last. Valid after .
public float SliceRatio { get; }Property Value
TileDispatch
Gets the tile pass dispatch size.
public (int X, int Y, int Z) TileDispatch { get; }Property Value
TotalWords
Gets the uints the cull bits buffer needs for this frame's layout.
public int TotalWords { get; }Property Value
ViewportSize
Gets the viewport the items were projected against, which is the extent of cull space.
public Vector2 ViewportSize { get; }Property Value
Methods
AddBarnLights(ReadOnlySpan<BarnLightCullVolume>)
Adds one item per barn light face. Item i is always light i: the shading pass indexes the light array by bit position, so a face that fails to project is rejected in place, not dropped.
public void AddBarnLights(ReadOnlySpan<BarnLightCullVolume> volumes)Parameters
volumes ReadOnlySpan<BarnLightCullVolume>
Cull volume per barn light face, in shading pass index order.
AddCounts(int, int)
Claims batch slots without projecting anything, for a frame that will not bin at all.
public void AddCounts(int barnLights, int envMaps)Parameters
barnLights int
Barn light faces the shading pass will iterate.
envMaps int
Env map probes the shading pass will iterate.
Remarks
The masks are filled with ones instead, but the shading pass still indexes them through the bases and strides derives from these counts, so the layout still has to be right.
AddEnvMaps(List<SceneEnvMap>)
Adds one item per environment map probe, slotted by .
public void AddEnvMaps(List<SceneEnvMap> envMaps)Parameters
envMaps List<SceneEnvMap>
Begin(int, int, int, int, float, float, Vector2, in Matrix4x4, Vector3, Vector3, float)
Starts a frame, capturing everything the batches added afterwards are projected against.
public void Begin(int tileCols, int tileRows, int tileSize, int depthBins, float minSliceFar, float maxSliceFar, Vector2 viewportSize, in Matrix4x4 worldToProjection, Vector3 cameraPosition, Vector3 cameraDirection, float cameraNearPlane)Parameters
tileCols int
tileRows int
tileSize int
depthBins int
minSliceFar float
maxSliceFar float
viewportSize Vector2
worldToProjection Matrix4x4
cameraPosition Vector3
cameraDirection Vector3
cameraNearPlane float
BinBase(int)
Gets the first uint of a batch's depth bin region.
public uint BinBase(int batch)Parameters
batch int
Returns
BinnedCount(int)
Gets the slots holding an item that can match a tile. The gap to is what projected to nothing - behind the near plane or off screen - and the CPU rejected outright.
public int BinnedCount(int batch)Parameters
batch int
Batch index.
Returns
End()
Lays the batches out back to back in the item and bits buffers, padding each tail so the tile pass's unconditional load stays in bounds. Call once every batch is added.
public void End()SlotCount(int)
Gets the slots a batch claimed, which is every item the shading pass iterates.
public int SlotCount(int batch)Parameters
batch int
Batch index.
Returns
Stride(int)
Gets a batch's word stride, ceil(itemCount / 32).
public uint Stride(int batch)Parameters
batch int
Returns
TileBase(int)
Gets the first uint of a batch's tile region.
public uint TileBase(int batch)Parameters
batch int

