Froxel light grid: lossless per-cell light masks built from the lights alone #812

Open
opened 2026-10-17 18:10:01 +00:00 by sky_line · 0 comments
Owner

The deferred lighting kernels spend ~4,900 of ~16,000 cycles per lit pixel on per-16x16-tile light culling (tile depth min/max from every pixel's depth + a light test per tile). RenderVKLightGrid (default off) moved that same work into its own kernel: no net gain.

Design: extend the existing light pass (clean_lights.comp) to build a finer froxel grid (screen tile x depth slice) with a 256-bit light mask per cell (MAX_VK_LIGHTS = 256, so it can never overflow), marked per light from its sphere / cone with no pixel depth reads. The deferred kernels pick their pixel's cell and walk its mask; the per-tile test, shared-memory mask and barriers go away. The forward consumers (alpha, particles, probe and mirror captures) can switch from the capped 64-light clusters to the same exact masks.

Measure: shader-clock stages, lighting time, image A/B on the ~370-light scene, register / shared-memory counts.

Context: measured on a GTX 1080 (Pascal) at 4K with the test-control channel and the shader clock (RenderVKShaderClockLighting) / pipeline stats (RenderVKPipelineStats). The frame is GPU-bound but not bandwidth-bound (memory controller ~36% busy on the 1080, ~14% on a 5090): it is latency / occupancy bound, so trading a little memory traffic for fewer registers and fewer dependent loads should help every GPU generation.

The deferred lighting kernels spend ~4,900 of ~16,000 cycles per lit pixel on per-16x16-tile light culling (tile depth min/max from every pixel's depth + a light test per tile). RenderVKLightGrid (default off) moved that same work into its own kernel: no net gain. **Design**: extend the existing light pass (clean_lights.comp) to build a finer froxel grid (screen tile x depth slice) with a 256-bit light mask per cell (MAX_VK_LIGHTS = 256, so it can never overflow), marked per light from its sphere / cone with no pixel depth reads. The deferred kernels pick their pixel's cell and walk its mask; the per-tile test, shared-memory mask and barriers go away. The forward consumers (alpha, particles, probe and mirror captures) can switch from the capped 64-light clusters to the same exact masks. Measure: shader-clock stages, lighting time, image A/B on the ~370-light scene, register / shared-memory counts. Context: measured on a GTX 1080 (Pascal) at 4K with the test-control channel and the shader clock (RenderVKShaderClockLighting) / pipeline stats (RenderVKPipelineStats). The frame is GPU-bound but not bandwidth-bound (memory controller ~36% busy on the 1080, ~14% on a 5090): it is latency / occupancy bound, so trading a little memory traffic for fewer registers and fewer dependent loads should help every GPU generation.
sky_line added this to the Slipstream project 2026-10-17 18:10:01 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sky_line/Slipstream#812
No description provided.