Add D3D12 descriptor upload foothold

This commit is contained in:
Meta Vens 2026-05-09 12:35:55 +01:00
commit e672042a3e
5 changed files with 131 additions and 14 deletions

View file

@ -62,3 +62,4 @@
{"area":"renderer/d3d12","lesson":"Before building the transparent stochastic surface pipe, keep D3D11 as the reference backend and add D3D12 beside it behind IAquariumRenderer. The first D3D12 pass should prove device, command queue, swapchain, RTV heap, command list, fence, clear, and present lifecycle with headless execution before porting scene passes.","files":["src/Aquarium.Engine/AquariumHost.cs","src/Aquarium.Engine/Render/IAquariumRenderer.cs","src/Aquarium.Engine/Render/D3D11Renderer.cs","src/Aquarium.Engine/Render/D3D12Renderer.cs","docs/d3d12-migration.md","state/scratch.md"],"verification":["dotnet build src\\Aquarium.Engine\\Aquarium.Engine.csproj","Aquarium.Engine.exe --headless --renderer d3d12 with latest known-good live assembly exited 0","Aquarium.Engine.exe --headless --renderer d3d11 with latest known-good live assembly exited 0"],"ts":"2026-05-09"}
{"area":"renderer/backend-selection","lesson":"Backend-neutral startup logging matters once D3D12 exists beside D3D11. Live runtime messages should describe Aquarium host invariants, not claim a specific graphics API that may be false for the selected renderer.","files":["src/Aquarium.Engine.Live/AquariumRuntime.cs"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4 -HeadlessTimeoutSeconds 60","Latest slot Aquarium.Engine.exe --headless --renderer d3d12 exited 0 and logged D3D12 device/swapchain creation"],"ts":"2026-05-09"}
{"area":"renderer/d3d12","lesson":"A useful D3D12 foothold must exercise shader and PSO machinery, not just ClearRenderTargetView. The D3D12 backend now uses per-swapchain-buffer command allocators, a pass context, fullscreen root signature, compiled smoke shader, PSO, viewport/scissor/RTV binding, and DrawInstanced fullscreen triangle submission.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/Shaders/D3D12Smoke.hlsl","docs/d3d12-migration.md","state/scratch.md"],"verification":["dotnet build src\\Aquarium.Engine\\Aquarium.Engine.csproj","Aquarium.Engine.exe --headless --renderer d3d12 exited 0 and logged fullscreen smoke pipeline creation"],"ts":"2026-05-09"}
{"area":"renderer/d3d12","lesson":"D3D12 descriptor/upload ownership is now represented in the backend instead of hiding inside a draw call. The smoke pass uses a shader-visible CBV/SRV/UAV descriptor arena, one upload constant buffer per swapchain frame, a CBV descriptor table at b0, and per-frame writes before command recording. Generalize this foothold into renderer-wide descriptor and upload ring helpers before porting Aquarium scene resources.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/Shaders/D3D12Smoke.hlsl","docs/d3d12-migration.md","state/scratch.md"],"verification":["dotnet build src\\Aquarium.Engine\\Aquarium.Engine.csproj","Aquarium.Engine.exe --headless --renderer d3d12 exited 0 with CBV descriptor table smoke pass"],"ts":"2026-05-09"}

View file

@ -5,9 +5,11 @@
D3D12 migration foothold. D3D11 remains the visual reference renderer; the host
now talks through `IAquariumRenderer`, and `--renderer d3d12` selects a D3D12
backend with device/queue/swapchain/RTV heap/per-frame command allocators/fence,
plus a fullscreen root signature and smoke-test PSO that draws a diagnostic
fullscreen triangle. Next renderer work should port descriptor/upload/resource
ownership into D3D12 before building the stochastic transparent surface pipe.
plus a shader-visible descriptor arena, per-frame upload constant buffers,
fullscreen root signature, and smoke-test PSO that draws a diagnostic fullscreen
triangle. Next renderer work should generalize this into renderer-owned
descriptor/upload/resource helpers before building the stochastic transparent
surface pipe.
## Hot Context
@ -220,3 +222,9 @@ ownership into D3D12 before building the stochastic transparent surface pipe.
PSO, binds viewport/scissor/RTV, and draws a fullscreen triangle. This proves
shader, root signature, PSO, and draw submission before real Aquarium passes
migrate.
- D3D12 descriptor/upload foothold: the D3D12 path now owns a shader-visible
CBV/SRV/UAV descriptor arena and per-frame upload constant buffers. The smoke
pass binds a CBV descriptor table at b0 and uploads frame/debug/HDR-tinted
constants before drawing. This is still diagnostic, but it proves descriptor
heap visibility, root descriptor table binding, and per-frame CPU-to-GPU
upload ownership.