What and why
This is the synthetic part of milestone M3 in docs/d3d12_vulkan.md §6, claimed in #1380. M3 is the last gate before the game's own first frames. The new d3d12_m3_frame_test uses only the D3D12 API on the proxy and translator-output shaders (vs_m3.asm, ps_m3.asm, ps_m3_post.asm, hand-written RDNA2):
- Pass 1: draws three rectangles with
OMSetRenderTargetsinto two render targets (R8G8B8A8_UNORM and R32_FLOAT) and a D24_UNORM_S8_UINT depth/stencil buffer.- Depth test LESS with write; stencil REPLACE (refs 1, 2) and EQUAL.
- The far rectangle is drawn inside an OCCLUSION query, resolved with
ResolveQueryDatainto a readback buffer.
- Resource barriers: RT →
PIXEL_SHADER_RESOURCE|COPY_SOURCE, and RT →COPY_SOURCE. - Pass 2: the first target is sampled through an SRV in a descriptor table (the M2 path) by a translated PS into a third target.
- Frames: six frames in a ring of three slots, so three frames in flight. Each slot has its own fence (
Signal,SetEventOnCompletionwith an event,Wait), and root constants change every frame. - Check: every pixel of all three targets, with the float target bit-exact, plus the occlusion sample count, compared against a CPU reference: error 0, exact count.
No layer change was needed: everything M3 asks for, apart from render passes, already works.
Not covered:
- render passes (
BeginRenderPass, D3D-27, @Ryx69) and occlusion during pipeline statistics (D3D-162); - BINARY_OCCLUSION, MSAA, depth/stencil copies and read-only DSVs;
- the game's own first frames, which need the executable.
The generic shader harness skips the fixtures (OTHER_HARNESS). The §6 M3 row now says "Synthetic part met".
Depends on: #1489 (M2, which contains #907). Until #1489 lands, this diff shows M1.5 + M2 + M3.
Tested
- AMD Radeon 880M (26.11.2) and NVIDIA RTX 5070 Laptop (617.42), Windows 11, MSVC 19.44,
LEONIDA_VK_VALIDATION=1(synchronization validation included), head1a156425:d3d12_m3_frame: 6 frames × 3 targets × 4096 pixels, error 0; 3555 occlusion samples in total, exact on both GPUs.d3d12_m2_textured: passes on both.- 0 validation errors.
- Full ctest:
- AMD: 90/90.
- NVIDIA: all pass except
d3d12_vulkan_device, which fails onmaintoo (placed UNORM clear rounding, being fixed separately, see #1380).
- Mutation check: with the depth test removed from the CPU reference, the test fails as it should.
run_gpu_tests.py --filter _m3: 3/3 translated,spirv-valclean, skipped as run byd3d12_m3_frame_test.tests/test_ctest_registration.pyandtests/test_shader_checks.py: 45 passed.
Checklist
- No game data, keys or online access
- Tested on two GPUs
- Docs updated (
docs/d3d12_vulkan.md§6, M3 row)
AI-assisted (Claude Code).
🤖 Generated with Claude Code
Activity
28ff8437669b1d11Thanks @whattheflop, that's a careful run. 73,728 pixel comparisons and the per-frame occlusion counts (800 … 405, 3,555 in total) match on an RTX 3080 and the 9800X3D's Radeon iGPU, with sync validation on.
Your fence sampling (1,2,3,1,2,3 on NVIDIA and 1,1,1,… on AMD) is also useful. It shows that NVIDIA really has up to three slots in flight, so the reuse wait is exercised there. On AMD the GPU drains each frame before the next sample, so the ring is mostly exercised for correctness, not overlap. I'll put that in the docs row.
AI-assisted (Claude Code).
This pull request is a draft
Merging is unavailable until it is marked ready for review.
Independent AI-assisted Windows GPU verification of the published draft head
1a156425c7e887300f867b07e81c6819a54bddd2. GitHub recorded base99f99890c5ebe186ef2f9fe8ff6d675745d9e621, which was also the merge base. Upstreammainwas41f448261e1de8a410b4d760e69a7e5656cef858. This run used the published head as-is. M3 is @AlxcBTW's claim from #1380 (claim).Stock offscreen
d3d12_m3_frame_testexited 0 on the GeForce RTX 3080 (616.64) and the Ryzen 7 9800X3D Radeon iGPU (Windows driver 32.0.21030.2001). The Vulkan loader showed one vendor ICD per process, the empty implicit-layer search path, andVK_LAYER_KHRONOS_validation1.4.363.0 in both the instance and device dispatch chains. The layer's startup report listed Synchronization on both GPUs. There were zero validation errors, warnings, or reported sync hazards in both completed stock runs.spirv-val. Including the reusedvs_m2, 4/4 shaders used by M3 translated and passed, with all four independently rechecked usingspirv-val --target-env vulkan1.3.R32_FLOATtarget matched bit for bit.Windows 11 25H2 (26200.9974), MSVC 19.38.33145, Windows SDK 10.0.26100.0, Vulkan SDK 1.4.363.0, uv-managed Python 3.12.13, and WSL LLVM 21.1.8
llvm-mcwith AMDGPU.Scope was synthetic indexed offscreen draws through the D3D12-to-Vulkan proxy: MRT, D24S8 depth and stencil via
OMSetRenderTargets, transitions, precise occlusion resolve, descriptor-table SRV sampling in pass two, and same-queue fence reuse. Coverage excludesBeginRenderPass, occlusion during pipeline statistics, binary occlusion, MSAA, depth/stencil copies, read-only DSVs, cross-queue dependencies, presentation, and retail game frames. The standalone M2 test and broader suite were outside this run.