Render D3D12 medium froxel atlas

This commit is contained in:
Meta Vens 2026-05-09 14:09:59 +01:00
commit 1cce998908
10 changed files with 419 additions and 39 deletions

View file

@ -35,11 +35,15 @@ resource graph beyond smoke-pass scaffolding.
plus a fixed body brush table feed a base field draw followed by one additive
up-facing gravity quad per body. The target is scalar `R16_Float`: height is
one value, and the format still supports the additive render-target blending
the brush pass needs. Mode `11` exposes it.
the brush pass needs.
- D3D12 uploads the live froxel primitive table and field instance table into
default-heap structured buffers each frame, using the upload ring only as the
copy source. Their SRVs are created in the transient descriptor heap used by
the consuming pass, avoiding impossible static+transient heap co-binding.
- D3D12 renders the first medium froxel atlas from the field instance buffer
into diagnostic and transport render targets. Mode `11` exposes froxel
density, so the debug path now follows the renderer being built rather than a
Grid-height bring-up convenience.
- Renderer calls receive current window dimensions, and the D3D12 backend can
recreate swapchain buffers plus dependent smoke resources on resize.
- Resize waits for the GPU, disposes swapchain-dependent targets, rebuilds
@ -67,9 +71,9 @@ resource graph beyond smoke-pass scaffolding.
- The offscreen smoke target copies to the swapchain. Keep this only if the real
post-process graph needs it; otherwise present from the final render target
path with no ornamental copy.
- The D3D11 and D3D12 field table builders are temporarily duplicated. Extract
them into one shared field ABI owner before the second backend starts to
drift.
- D3D11 and D3D12 field table builders are temporarily duplicated by design.
D3D11 is reference-only and will be removed after migration; do not pay DRY
tax merely to preserve it.
## Required Before Real Pass Migration

View file

@ -22,13 +22,16 @@ has feature parity.
- The first real migrated pass is the Grid height pass. D3D12 uploads Aquarium
frame constants plus a fixed body brush table, renders a base Grid field, then
draws one additive up-facing gravity quad per body into a 128x128
scalar `R16_Float` Grid height target. Render debug mode `11` displays that
target.
scalar `R16_Float` Grid height target.
- D3D12 now owns the first field-resource upload path: CPU-built froxel
primitive ids and field instances upload through the per-frame upload ring,
copy into default-heap structured buffers, and bind as transient SRVs for the
diagnostic shader. This proves the backend can feed real Aquarium field data
without reading directly from upload memory.
- The D3D12 medium pass renders a packed frustum froxel atlas into diagnostic
and transport render targets from the field instance buffer. Render debug mode
`11` now displays D3D12 froxel density, matching the future renderer path
rather than the temporary Grid-height bring-up view.
- Resize waits for the GPU, releases swapchain-dependent resources, rebuilds
static shader/RTV descriptor arenas, then recreates backbuffer views and
dependent render targets. Descriptor exhaustion on resize is no longer a
@ -40,7 +43,7 @@ has feature parity.
## Migration Order
1. Keep D3D11 as the visual reference.
1. Keep D3D11 as the visual reference only.
2. Move shared renderer contracts behind explicit backend-neutral types.
3. Port the Grid height pass after preserving D3D11 as the reference output.
4. Keep capacity diagnostics loud while the backend is still small enough to

View file

@ -79,16 +79,14 @@ The D3D12 backend has begun migrating this order with a proper brush-based Grid
height pass. It uploads the Aquarium frame constant buffer plus a fixed body
brush table through the D3D12 upload ring, renders the base Grid field, then
draws one additive up-facing gravity quad per body into a 128x128
scalar `R16_Float` Grid height target. D3D12 render debug mode `11` displays
that target. D3D11 remains the visual reference until the full pass chain
reaches parity.
scalar `R16_Float` Grid height target. D3D11 remains the visual reference until
the full pass chain reaches parity.
D3D12 also uploads the current froxel primitive id table and field instance
table into default-heap structured buffers every frame. The diagnostic smoke
shader reads both SRVs through the transient descriptor heap; this is only a
resource-path proof, not the migrated scene or medium pass yet. The D3D11 and
D3D12 table builders should be collapsed into one shared field ABI before more
field consumers are ported.
table into default-heap structured buffers every frame. The D3D12 medium pass
renders a packed frustum froxel atlas into diagnostic and transport render
targets from those field instances, and mode `11` displays the froxel density
target. The scene and resolve passes have not been migrated yet.
The shader far distance is frame-derived, not a fixed constant. C# sends the
distance from the camera to the Grid origin plus the Grid radius, which matches