Skip to content

Vulkan Forward+: luminance-priority tile lists when overloaded#169

Merged
cursor[bot] merged 1 commit intomainfrom
cursor/vk-fp-luminance-priority-0a71
May 4, 2026
Merged

Vulkan Forward+: luminance-priority tile lists when overloaded#169
cursor[bot] merged 1 commit intomainfrom
cursor/vk-fp-luminance-priority-0a71

Conversation

@timfox
Copy link
Copy Markdown
Owner

@timfox timfox commented May 3, 2026

Summary

Implements roadmap item from FORWARD_PLUS_PIPELINE_AUDIT.md §8: when a 16px tile has more overlapping lights than r_forwardPlusMaxPerTile, the tile cull now keeps the top N by RGB luminance sum (packed dlight color) instead of always taking the first N light indices.

New cvar

  • r_forwardPlusLuminanceSort0 / 1, default 1, CVAR_ARCHIVE_ND. 1 = partial selection by RGB sum when overloaded; 0 = legacy first-candidate order when overloaded. No vid_restart (push constant per dispatch). Startup log when Forward+ is on and sort is 1.

Implementation

  • forward_plus_tile_cull.comp: per-tile candidate list (max 32), then partial selection sort for first maxPerTile rows when candCount > cap and luminanceSort != 0.
  • vk_forward_plus.c: vk_fp_push_t extended with luminance_sort uint; pipeline layout push range size updated; dispatch fills from cvar.
  • SPIR-V regenerated via ./scripts/compile_shaders.sh --apply (shader_data.c + generated tree).

Docs

Validation

  • ninja -C build-vk-Release (Vulkan renderer)
  • bash scripts/renderer_regression_check.sh — passed

Notes

  • Under capacity, tile output order remains increasing light index (same as before).
  • Sort key is linear RGB sum from SSBO color vec4 — cheap heuristic, not distance-based (still listed as future work in audit).
Open in Web Open in Cursor 

Add r_forwardPlusLuminanceSort (0/1, default 1, archived). Tile cull gathers
per-tile candidates then partial-selects top maxPerTile by RGB sum when
candidates exceed the cap; 0 keeps legacy first-N index order.

Extended vk_fp_push_t; SPIR-V from compile_shaders.sh --apply. Document in
FORWARD_PLUS_PIPELINE_AUDIT, QUICKSTART, CHANGELOG.

Co-authored-by: Tim Fox <timfox@outlook.com>
@cursor cursor Bot merged commit 14cf553 into main May 4, 2026
45 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants