Per-frame constants: storage buffers -> uniform buffers #814

Closed
opened 2026-10-17 18:10:01 +00:00 by sky_line · 2 comments
Owner

Every per-frame constant block is a readonly storage buffer (frame info ~4.5 KB, light info, probe header, draw views). On NVIDIA a uniform-index storage-buffer read is a per-lane global load into a register; a uniform-buffer read is a constant-bank operand with no register and no latency (Pascal has no other uniform path). The blocks are vec4 / mat4 arrays, so the std140 layout is byte-identical and well under 64 KB: no image change. Expected: fewer registers in the 126-128-register lighting kernels and every other shader reading frame constants; helps all NVIDIA generations.

Measure: register counts (pipeline stats) of the lighting kernels / G-buffer / lit alpha before and after; shader-clock ATMOS and LOCAL stages.

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.

Every per-frame constant block is a readonly storage buffer (frame info ~4.5 KB, light info, probe header, draw views). On NVIDIA a uniform-index storage-buffer read is a per-lane global load into a register; a uniform-buffer read is a constant-bank operand with no register and no latency (Pascal has no other uniform path). The blocks are vec4 / mat4 arrays, so the std140 layout is byte-identical and well under 64 KB: no image change. Expected: fewer registers in the 126-128-register lighting kernels and every other shader reading frame constants; helps all NVIDIA generations. Measure: register counts (pipeline stats) of the lighting kernels / G-buffer / lit alpha before and after; shader-clock ATMOS and LOCAL stages. 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
Author
Owner

Merged with #815 and #816 (ada2bb088a, 454fd3ecc0, 9be87d4e98). GTX 1080, 4K, old vs new build A/B/A/B: Firestorm-equivalent 17.0 -> 15.1 ms, high 37.0 -> 32.6-33.9 ms (~30 FPS), with RenderVKLightStage off (staging measured +0.3-0.8 ms, now default off). Split combine 121-127 -> 116-126 registers; uber still 128 (local lights + reflections hold it). Remaining before close: image A/B, validation layers on the new UBO bindings, ship.

Merged with #815 and #816 (ada2bb088a, 454fd3ecc0, 9be87d4e98). GTX 1080, 4K, old vs new build A/B/A/B: Firestorm-equivalent 17.0 -> 15.1 ms, high 37.0 -> 32.6-33.9 ms (~30 FPS), with RenderVKLightStage off (staging measured +0.3-0.8 ms, now default off). Split combine 121-127 -> 116-126 registers; uber still 128 (local lights + reflections hold it). Remaining before close: image A/B, validation layers on the new UBO bindings, ship.
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#814
No description provided.