Gpass on both backends, one frame for every surface #33

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

Why

The main geometry pass is where the shared preparation meets each backend. Rendering every surface in one frame call keeps waits and submissions to one per frame, which the editor's several views need.

Decided

  • Depth prepass (position-only vertex shader), then the gpass; reversed Z; direct draws only (D3D12's ExecuteIndirect was 2.5-4x slower on the GPU and was removed).
  • Render targets, barrier tracker, gpass cache and light buffers per surface.
  • graphics::render_frame(std::span<const SurfaceFrame>): one fence wait, one submission and one present call per engine frame. SurfaceFrame{surface, FrameInfo{.light_set_key, .camera_entity, ...}}.
  • Surfaces are prepared first (targets, constant data, light buffers), then both passes' batches are recorded in one parallel pass.

Read first

  • Renderer, sections 10 and 11.
  • Engine/Graphics/Direct3D12/D3D12Gpass.cpp on master.

Steps

  • 1. Switch D3D12 to render_frame(span) and per-surface targets; check the surfaces test with four windows.
  • 2. Write the Vulkan gpass against the same frame packet.
  • 3. Run the renderer EngineTest on both backends and compare the pictures.

Done when

  • The renderer test looks the same on D3D12 and Vulkan (you check); four windows run in one frame; validation clean; 0 warnings; tidy 0.

Claude can help with

  • Barrier and layout transitions when validation complains.

Learn

  • What a depth prepass buys and when it doesn't pay.
## Why The main geometry pass is where the shared preparation meets each backend. Rendering every surface in one frame call keeps waits and submissions to one per frame, which the editor's several views need. ## Decided - Depth prepass (position-only vertex shader), then the gpass; reversed Z; direct draws only (D3D12's `ExecuteIndirect` was 2.5-4x slower on the GPU and was removed). - Render targets, barrier tracker, gpass cache and light buffers per surface. - `graphics::render_frame(std::span<const SurfaceFrame>)`: one fence wait, one submission and one present call per engine frame. `SurfaceFrame{surface, FrameInfo{.light_set_key, .camera_entity, ...}}`. - Surfaces are prepared first (targets, constant data, light buffers), then both passes' batches are recorded in one parallel pass. ## Read first - [Renderer](https://forgejo.unflavoredmeson.com/UnflavoredMeson/Primal_Plus_Plus/wiki/Renderer), sections 10 and 11. - `Engine/Graphics/Direct3D12/D3D12Gpass.cpp` on `master`. ## Steps - [ ] 1. Switch D3D12 to `render_frame(span)` and per-surface targets; check the surfaces test with four windows. - [ ] 2. Write the Vulkan gpass against the same frame packet. - [ ] 3. Run the renderer EngineTest on both backends and compare the pictures. ## Done when - [ ] The renderer test looks the same on D3D12 and Vulkan (you check); four windows run in one frame; validation clean; 0 warnings; tidy 0. ## Claude can help with - Barrier and layout transitions when validation complains. ## Learn - What a depth prepass buys and when it doesn't pay.
Sign in to join this conversation.
No assignees
No project
No milestone
Blocks
#35 Parallel preparation and command recording
UnflavoredMeson/Primal_Plus_Plus
#37 UI pass, offscreen surfaces and readback
UnflavoredMeson/Primal_Plus_Plus
#64 Render graph
UnflavoredMeson/Primal_Plus_Plus
#66 Pipeline caches on disk
UnflavoredMeson/Primal_Plus_Plus
Depends on
#32 Vulkan content, uploads and descriptors
UnflavoredMeson/Primal_Plus_Plus
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#33
No description provided.