Lighting, tiled light culling and post-processing on both backends #34

Open
UnflavoredMeson/Primal_Plus_Plus
opened 2026-11-24 20:15:58 +00:00 by UnflavoredMeson · 0 comments
Owner

Why

Many lights need culling per screen tile; both backends have to agree on the tile size and the light layout.

Decided

  • Tiled light culling with one tile size (LightCullingTileSize) and MaxAverageLightsPerTile, both in CommonConstants.hlsli.
  • delight::prepare() resizes the culling buffers before recording.
  • Post-processing as in D3D12.

Read first

  • LinuxVulkanPort, phases 6f-6g.
  • Engine/Graphics/Direct3D12/D3D12LightCulling.cpp, D3D12PostProcess.cpp, Shaders/CullLights.hlsl on master.

Steps

  • 1. Write the Vulkan light buffers and culling dispatch.
  • 2. Add post-processing.
  • 3. Run with many point lights and compare both backends.

Done when

  • The renderer test's lights match on both backends (you check); validation and sync validation clean; 0 warnings; tidy 0.

Claude can help with

  • Reading the compute shader's tile frustum math with you.

Learn

  • How grid frustums per tile turn light culling into a compute problem.
## Why Many lights need culling per screen tile; both backends have to agree on the tile size and the light layout. ## Decided - Tiled light culling with one tile size (`LightCullingTileSize`) and `MaxAverageLightsPerTile`, both in `CommonConstants.hlsli`. - `delight::prepare()` resizes the culling buffers before recording. - Post-processing as in D3D12. ## Read first - [LinuxVulkanPort](https://forgejo.unflavoredmeson.com/UnflavoredMeson/Primal_Plus_Plus/wiki/LinuxVulkanPort), phases 6f-6g. - `Engine/Graphics/Direct3D12/D3D12LightCulling.cpp`, `D3D12PostProcess.cpp`, `Shaders/CullLights.hlsl` on `master`. ## Steps - [ ] 1. Write the Vulkan light buffers and culling dispatch. - [ ] 2. Add post-processing. - [ ] 3. Run with many point lights and compare both backends. ## Done when - [ ] The renderer test's lights match on both backends (you check); validation and sync validation clean; 0 warnings; tidy 0. ## Claude can help with - Reading the compute shader's tile frustum math with you. ## Learn - How grid frustums per tile turn light culling into a compute problem.
Sign in to join this conversation.
No assignees
No project
No milestone
Depends on
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
UnflavoredMeson/Primal_Plus_Plus#34
No description provided.