Class LightBinner
Namespace: ValveResourceFormat.Renderer
Assembly: Renderer.dll
Per scene owner of the tile and depth bin cull passes: the item layout, the GPU buffers they read and write, and the constants that tell the shading pass where to look.
public sealed class LightBinner : IDisposableInheritance
Implements
Remarks
One per , because the bit indices it produces are positions in that scene's barn light and env map arrays. The 3D skybox has its own arrays, so its bits mean nothing against these.
Constructors
LightBinner(Scene)
Per scene owner of the tile and depth bin cull passes: the item layout, the GPU buffers they read and write, and the constants that tell the shading pass where to look.
public LightBinner(Scene scene)Parameters
scene Scene
Remarks
One per , because the bit indices it produces are positions in that scene's barn light and env map arrays. The 3D skybox has its own arrays, so its bits mean nothing against these.
Properties
CullBits
Gets the buffer holding this scene's per tile and per depth bin masks.
public StorageBuffer? CullBits { get; }Property Value
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
Methods
Bind()
Binds this scene's masks and their layout for the shading pass.
public void Bind()Dispatch()
Rasterizes the items projected into per tile and per depth bin masks, so the shading pass iterates only what reaches a given fragment.
public void Dispatch()Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()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 two 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()SetPixelRemap(Vector4)
Points this pass's pixels at the ones the masks were built for. The viewmodel draws into the same target through a different projection, so it cannot take its tile from gl_FragCoord directly.
public void SetPixelRemap(Vector4 remap)Parameters
remap Vector4
Pixel remap: xy scale, zw bias.
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 publishes the resulting layout. Must run before the view buffer upload preceding , since the shading pass reads the layout.
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.

