Deferred lighting: split by feature (64-register base pass + local-lights pass + reflection pass) #827

Closed
opened 2026-10-17 21:14:15 +00:00 by sky_line · 2 comments
Owner

Deferred lighting is the largest pass on Pascal and is register-bound, not ALU- or bandwidth-bound.

Measured (GTX 1080, 4K, today's build): g_defer_light 7.0 ms at high settings and 4.9 ms at Firestorm-equivalent; the split shadow + reflection pass (g_defer_sr) is another 2.1 ms at high. Registers: split combine 116-126, uber kernel 128. The memory controller runs at ~36% on the 1080 and ~15% on a 5090, so there is bandwidth to spare.

Register probes (RenderVKLightRegProbe, same specialisation constants as production):

Variant Registers
Base shading only 64
Base + atmosphere 64
Base + reflections 127
Base + local lights 128

The local-light loop and the reflection code (probe walk / SSR) each pin the kernel at 128 registers for every pixel, including pixels with no local light and no reflection contribution.

Plan: split by feature

  1. Base pass at ~64 registers for every pixel: sun / moon with shadow, ambient / irradiance, atmosphere / haze, emissive. It writes the lit result.
  2. Local-lights pass only where there are lights: driven by the existing tile / froxel light lists (RenderVKLightCulling); tiles with zero lights are skipped entirely (indirect dispatch over non-empty tiles), additive onto the base result.
  3. Reflection pass separately: probe sampling + SSR resolve, only for pixels whose roughness / metallic make the term non-negligible (or tiles with any such pixel), additive.

Intermediate results go through VRAM (trading bandwidth for occupancy). Output must match the current image (A/B snapshot diff); keep the old kernels behind a setting for A/B.

Measure

Registers per new kernel (RenderVKPipelineStats), then a serial A/B on the GTX 1080 (Firestorm-equivalent and high) and the RTX 5090, in the same scene. Expected 2-3 ms at high on Pascal, 1.5-2 ms at Firestorm-equivalent.

Deferred lighting is the largest pass on Pascal and is register-bound, not ALU- or bandwidth-bound. **Measured (GTX 1080, 4K, today's build):** `g_defer_light` 7.0 ms at high settings and 4.9 ms at Firestorm-equivalent; the split shadow + reflection pass (`g_defer_sr`) is another 2.1 ms at high. Registers: split combine 116-126, uber kernel 128. The memory controller runs at ~36% on the 1080 and ~15% on a 5090, so there is bandwidth to spare. **Register probes (`RenderVKLightRegProbe`, same specialisation constants as production):** | Variant | Registers | |---|---| | Base shading only | 64 | | Base + atmosphere | 64 | | Base + reflections | 127 | | Base + local lights | 128 | The local-light loop and the reflection code (probe walk / SSR) each pin the kernel at 128 registers for *every* pixel, including pixels with no local light and no reflection contribution. ### Plan: split by feature 1. **Base pass at ~64 registers for every pixel:** sun / moon with shadow, ambient / irradiance, atmosphere / haze, emissive. It writes the lit result. 2. **Local-lights pass only where there are lights:** driven by the existing tile / froxel light lists (`RenderVKLightCulling`); tiles with zero lights are skipped entirely (indirect dispatch over non-empty tiles), additive onto the base result. 3. **Reflection pass separately:** probe sampling + SSR resolve, only for pixels whose roughness / metallic make the term non-negligible (or tiles with any such pixel), additive. Intermediate results go through VRAM (trading bandwidth for occupancy). Output must match the current image (A/B snapshot diff); keep the old kernels behind a setting for A/B. ### Measure Registers per new kernel (`RenderVKPipelineStats`), then a serial A/B on the GTX 1080 (Firestorm-equivalent and high) and the RTX 5090, in the same scene. Expected 2-3 ms at high on Pascal, 1.5-2 ms at Firestorm-equivalent.
sky_line added this to the Slipstream project 2026-10-17 21:14:15 +00:00
Author
Owner

Merged into vulkan-port-tb (4b0d7a92bd + merge 4475c3ef04). Replaces the split path's combine with tile classify + BASE (all non-local terms) + LOCAL (indirect over lit tiles only). Reflections stay in BASE: they sit inside nonlinear steps, so they can't be added afterwards.

Registers (GTX 1080): BASE 72, LOCAL 114-115 (80 in one spec variant), classify 48; the old combine is 116-127.

GTX 1080, 4K, interleaved on/off within each session (same scene):

  • High, serial: on 28.24 / 29.58 vs off 29.54 / 32.15 (session 0); on 28.63 / 30.06 vs off 30.71 / 31.50 (session 1). About -1.85 ms.
  • Firestorm-equivalent: on 14.82 / 14.22 vs off 15.38 / 14.39; on 14.66 / 14.25 vs off 15.69 / 14.75. About -0.55 ms.
  • Deferred lighting itself at high (serial): 6.3-6.7 ms -> base 1.92 + shadow 0.98 + reflect 0.95 + classify 0.85.

Image: a snapshot diff of on vs off is at the animated-scene noise floor (mean 2.8-2.9 vs 2.0-2.9 for same-setting pairs), with differences only on moving avatars / particles / water.

Follow-up seen: classify costs 0.8-1.2 ms (light grid build + lit-guard scan), which is the next thing to slim.

Still to do: a validation-layer run; live toggle cycling; the async-deferred path on the 5090.

Merged into vulkan-port-tb (4b0d7a92bd + merge 4475c3ef04). Replaces the split path's combine with tile classify + BASE (all non-local terms) + LOCAL (indirect over lit tiles only). Reflections stay in BASE: they sit inside nonlinear steps, so they can't be added afterwards. **Registers (GTX 1080):** BASE 72, LOCAL 114-115 (80 in one spec variant), classify 48; the old combine is 116-127. **GTX 1080, 4K, interleaved on/off within each session (same scene):** - High, serial: on 28.24 / 29.58 vs off 29.54 / 32.15 (session 0); on 28.63 / 30.06 vs off 30.71 / 31.50 (session 1). About -1.85 ms. - Firestorm-equivalent: on 14.82 / 14.22 vs off 15.38 / 14.39; on 14.66 / 14.25 vs off 15.69 / 14.75. About -0.55 ms. - Deferred lighting itself at high (serial): 6.3-6.7 ms -> base 1.92 + shadow 0.98 + reflect 0.95 + classify 0.85. **Image:** a snapshot diff of on vs off is at the animated-scene noise floor (mean 2.8-2.9 vs 2.0-2.9 for same-setting pairs), with differences only on moving avatars / particles / water. **Follow-up seen:** classify costs 0.8-1.2 ms (light grid build + lit-guard scan), which is the next thing to slim. Still to do: a validation-layer run; live toggle cycling; the async-deferred path on the 5090.
Author
Owner

Fixed in Slipstream 1.3.0 (stable): https://git.slipstreamviewer.org/sky_line/Slipstream/releases/tag/v1.3.0

If you still see this on 1.3.0, reply here and we'll reopen it.

Fixed in **Slipstream 1.3.0** (stable): https://git.slipstreamviewer.org/sky_line/Slipstream/releases/tag/v1.3.0 If you still see this on 1.3.0, reply here and we'll reopen it.
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#827
No description provided.