Class LightBinner
Namespace: ValveResourceFormat.Renderer
Assembly: Renderer.dll
Tile and depth bin light culling for one view of a scene.
public sealed class LightBinnerInheritance
object ← LightBinner
Remarks
Bit indices are positions in the barn light and env map arrays of that one scene, so masks are not interchangeable between scenes.
Constructors
LightBinner(SceneViewState)
Tile and depth bin light culling for one view of a scene.
public LightBinner(SceneViewState view)Parameters
view SceneViewState
Remarks
Bit indices are positions in the barn light and env map arrays of that one scene, so masks are not interchangeable between scenes.
Properties
CullBits
Gets the buffer holding this scene's per tile and per depth bin masks.
public StorageBuffer? CullBits { get; }Property Value
CullConstants
Gets the layout of this scene's masks and the view they were built for. Valid after LightBinner.Update(ViewConstants, int, int, bool).
public LightCullConstants CullConstants { get; }Property Value
DecalBinBase
Gets the first word of the projected decal batch's depth bin region.
public uint DecalBinBase { get; }Property Value
uint
DecalCullWords
Gets the mask words per tile and per depth bin of the projected decal batch.
public uint DecalCullWords { get; }Property Value
uint
DecalSlotCount
Gets the projected decal slots the decal pass iterates.
public int DecalSlotCount { get; }Property Value
int
DecalTileBase
Gets the first word of the projected decal batch's tile region. Valid after LightBinner.Update(ViewConstants, int, int, bool).
public uint DecalTileBase { get; }Property Value
uint
VisibilitySequence
Gets the sequence of the last readback folded into the lights, which they carry a stamp of so one it missed can be told apart from one it found dark.
public int VisibilitySequence { get; }Property Value
int
Methods
Bind()
Binds this scene's masks for the shading pass.
public void Bind()Delete()
Deletes the GPU buffers of the cull passes.
public void Delete()Dispatch()
Rasterizes the items LightBinner.Update(ViewConstants, int, int, bool) projected into per tile and per depth bin masks, so the shading pass iterates only what reaches a given fragment.
public void Dispatch()GetOverlayRegion(bool)
Gets the first word and stride of a batch's tile region, for the debug overlay.
public (uint TileBase, uint Words) GetOverlayRegion(bool envMaps)Parameters
envMaps bool
Whether to describe the env map batch rather than the barn light one.
Returns
LoadShaders()
Loads the three compute shaders. Call once the GL context exists.
public void LoadShaders()PollBarnLightVisibility()
Folds the oldest finished readback into the lights it was measured against, or does nothing when none has. What it applies is a ring depth behind, the price of never waiting.
public void PollBarnLightVisibility()SubmitVisibilityReadback()
Reduces this frame's barn light tile masks to one screen wide mask and queues it for readback. Skipped while every ring slot is in flight, so a stalled reader queues nothing.
public void SubmitVisibilityReadback()Update(ViewConstants, int, int, bool)
Projects every cull item for this frame and works out the resulting layout. Must run before the view buffer upload preceding LightBinner.Dispatch(), which carries the layout to the shading pass.
public void Update(ViewConstants viewConstants, int viewportWidth, int viewportHeight, bool enabled)Parameters
viewConstants ViewConstants
View the items are projected against.
viewportWidth int
Viewport width in pixels.
viewportHeight int
Viewport height in pixels.
enabled bool
Whether the caller wants binning this frame.

