Repository navigation
startup: check the depth target binding of translated draws - #2156
Conversation
List slot 50 (OMSetRenderTargets) already forwards a bound depth-stencil view to the desktop list together with the colour targets, and the translated pipeline takes its DSVFormat from it. Nothing checked the depth values it produces, the debug layer after the fence, or the two unresolved-handle paths. This adds that coverage; no stand-in code changes, because the fixture found the binding correct. tests/startup_draw_depth_target.cpp draws a near (z 0.25) green and a far (z 0.75) red triangle with a depth-tested stream pipeline (LESS, writes on), one case per process, and reads back the colour target and the D32 depth values after the fence: - bound: green in front, depth 0.25 where drawn and 1.0 elsewhere, one bind, nothing unresolved, no debug-layer message (X2W_D3D12_DEBUG=1; the script says so if the layer is not installed); - null: a zero depth handle maps to no descriptor; the colour target is bound without depth (logged, counted once by x2w_d3d12_render_target_stats): red overwrites, depth keeps 1.0; - unknown: a handle in no descriptor heap refuses the whole bind (logged, counted once): nothing is drawn. Negative control startup_draw_depth_target_drop_control (WILL_FAIL): the bound case's draw with the zero handle, checked against the bound expectations; it exits 1 only when exactly the picture differs, and a broken run exits 2. A depth-only mesh pass is not covered: mesh pipelines reach the stand-in only as native desktop-bytecode streams, which must have a pixel stage and no depth format, so such a pipeline is refused at creation. Noted in docs/startup-runtime.md. Refs R0Y00#1999 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
R0Y00
left a comment
There was a problem hiding this comment.
The source-built readback covers the depth write, occlusion and the two unresolved-handle paths. Please fix the drop control's exit mapping before merge. I reproduced CTest treating Python exit 2 as a passing WILL_FAIL test, which means translation, fixture launch, or readback errors can make the control green.
After the fix, please rerun ctest --preset release --no-tests=error -R '^startup_draw_depth_target_' -V and include the output for an intentionally broken invocation of the control. The PR's Windows smoke preset omits this target and its tests, and the PR's /O2 workflow job is skipped.
tedin7
left a comment
There was a problem hiding this comment.
Review of head 2eb71c0ae6d43d9cd638d930e5720a21ea721466 (test and docs only: CMakeLists.txt, docs/startup-runtime.md, tests/startup_draw_depth_target.cpp, tests/startup_draw_depth_target_check.py).
Commands run locally on the PR head:
git diff --stat origin/main...HEAD: 4 files, +523, no production code touched.python3 tests/docs_links_check.py: self-test passed, 18 Markdown files, 398 links OK.python3 tests/bidi_controls_check.py: 1437 files, no bidirectional controls.git diff --check origin/main...HEAD: clean.python3 -m py_compile tests/startup_draw_depth_target_check.py: OK.gh pr checks 2156: Windows build and test, Linux Python checks and gfx1013 fixtures all pass. The /O2 job is skipped.- Mergeable, not a draft, title neutral, no clean-room concern seen.
Findings: P1=0, P2=0.
Read-through notes:
- The
checkmode asserts colour, depth, bind count, unresolved count and the log line for all three cases (bound,null,unknown). The expected values match the table in the PR body. - The
dropcontrol only returns 1 when the picture alone differs (UNBOUNDresult, one bind), and a broken run returns 2. A crash therefore does not count as the control failing for its stated reason. Good design. - Docs: the new section matches the checks. The
ctest -R "^startup_draw_depth_target_"command is consistent with the test names in CMake. The pattern also matches the_drop_controltests, which is fine because they are WILL_FAIL.
Nits (non-blocking):
- The
bounddebug-layer check is skipped with only a printed note when the layer is missing. That is honest, but the CI log is the only place that shows it. Consider also failing on the Windows CI runner when the layer is expected to be present. run_casetreats a missing-> drawn;as broken for every case exceptunknown. A short comment on whyunknownis exempt would help the next reader.
Not done: I did not mutate the stand-in logic or run the D3D12 fixtures here. They need Windows and a D3D12 device, and this Linux worktree has neither. I also did not request a separate Win2025 run, because the change adds no gfx2hlsl or shader code and the Windows CI job passed on this head. The WARP and hardware results are therefore taken from CI, not reproduced by me.
AI-assisted; commands listed were executed locally.
|
I removed WILL_FAIL from the drop cases. They now pass only when the actual colour, depth and bind count match the intended dropped-depth result. Windows Release passed all four WARP and RTX cases, and a deliberately missing fixture executable returned exit 2. Both the occlusion and depth documentation sections are retained. |
R0Y00
left a comment
There was a problem hiding this comment.
The drop control now accepts only its expected colour/depth mismatch. Windows Release passed both variants on WARP and RTX 4060 Laptop, and the missing-executable invocation returned exit 2, which fails the new CTest setup.
tedin7
left a comment
There was a problem hiding this comment.
Re-review of head 986414f6d00f7fcf88a5c9debca4161bf7c252eb (previous review was on 2eb71c0ae6d43d9cd638d930e5720a21ea721466). Test and docs only: CMakeLists.txt, docs/startup-runtime.md, tests/startup_draw_depth_target.cpp, tests/startup_draw_depth_target_check.py.
Commands run locally on this head:
git diff --stat origin/main...HEAD: 4 files, +521, no production code touched.git diff 2eb71c0 HEAD -- tests/startup_draw_depth_target_check.py: the only PR-owned change since the last review (the rest of the range is merges from main).python3 tests/docs_links_check.py: self-test passed, 18 Markdown files, 401 links OK.python3 tests/bidi_controls_check.py: 1455 files, no bidirectional controls.git diff --check origin/main...HEAD: clean.python3 -m py_compile tests/startup_draw_depth_target_check.py: OK.gh pr checks 2156: Windows build and test, Linux Python checks and gfx1013 fixtures pass. The /O2 job and the chart publish are skipped.- Mergeable, not a draft, title neutral, no clean-room concern seen.
Findings: P1=0, P2=0.
What changed and whether it holds:
- The drop control now returns 0 when the expected mismatch appears (red in front, depth 1.0, one colour bind) and 1 otherwise. A broken run still returns 2. The control no longer depends on a failing-test inversion, so a crash or a wrong picture fails CTest. This is stricter than before and I find no flaw in it.
CMakeLists.txt:2597-2604registers the control with no WILL_FAIL, which matches the new exit codes. The docs paragraph ("passes only when the intended colour and depth mismatch appears") matches the script.- The two nits from the last review were not applied. They stay non-blocking: (1) the missing debug layer is only a printed note; (2)
run_casehas no comment on whyunknownis exempt from the-> drawn;check.
Nit (new, non-blocking):
CMakeLists.txt:2596: the comment still says the control "must fail only its picture". It now passes only on that mismatch. Suggest rewording to match.
Not done: I did not run the D3D12 binary or mutate the stand-in. This Linux worktree has no Windows or D3D12 device, so a mutation of the exit-code logic could not be exercised here. I did not request a Win2025 run, because there is no gfx2hlsl or shader change and the Windows CI job passed on this head. The WARP and hardware results are taken from CI, not reproduced by me.
AI-assisted; commands listed were executed locally.
startup_placed_buffer_range_{region_only,walk_only}_control were
WILL_FAIL tests whose mutated run exited 1 for the stated failure and 0
otherwise. CTest's WILL_FAIL inverts every nonzero exit, so a crash or
an unrelated failure also passed them (the same mapping #2156's review
found). The controls are now ordinary tests: the region-only run exits 0
only when decisions differ in the partly committed cases and nowhere
else, the walk-only run only when the case-9 call count is its sole
failure, and 1 otherwise. A refused allocation or mapping is still a
capability skip (77).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up to #2156's review nits. - The bound case's debug-message check was skipped with a printed note when the D3D12 debug layer is not installed. It is now its own test, startup_draw_depth_target_debug_{warp,hardware}: it requires the bound picture and no debug-layer message after the fence, and exits 77 (a capability skip CTest reports) when the layer is missing, instead of passing with a note. The check mode keeps every pixel, depth and counter check. - run_case says why the unknown case is exempt from the "-> drawn;" check: the stand-in refuses the whole OMSetRenderTargets there, so no draw may be issued; nothing drawn is checked through the read-back and the refusal line. - The CMakeLists comment no longer says the drop control "must fail only its picture": it passes only when it reads back the unbound picture. Refs #1999 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #1999 (item D).
Problem
List slot 50 (
OMSetRenderTargets) forwards a bound depth-stencil view to the desktop list in the same call as the colour targets, andpipeline_fortakes the translated pipeline'sDSVFormatfrom it.startup_stream_depthalready checks the resulting colours for several bindings. No fixture read back the depth values a translated draw writes, checked the debug layer after the fence, or covered the two paths for a depth handle the stand-in cannot resolve.Change
Coverage only. The fixture found the binding correct, so no stand-in code changes.
tests/startup_draw_depth_target.cppdraws a near green triangle (z 0.25) and then a far red one (z 0.75) with a depth-tested stream pipeline (LESS, writes on). Each case runs in its own process, so its debug-layer messages belong to it. It reads back the colour target and the D32 depth values after the fence, then executes an empty list so the stand-in drains the stored debug messages.boundnullbinding no depthis logged andx2w_d3d12_render_target_statscounts one unresolved handle.unknownnot a known depth stencil view, counted once), so nothing is drawn: the clear colour stays and depth keeps 1.0.docs/startup-runtime.mdgains a short "Depth target on translated draws" section.Negative control
startup_draw_depth_target_drop_control_{warp,hardware}(WILL_FAIL) runs theboundcase's draw with the zero handle and checks it against theboundexpectations. It exits 1 only when exactly the picture differs (red in front, depth target untouched) while the draw still happened. Otherwise it exits 0, and a broken run exits 2, so it cannot pass by crashing.Observed on both backends: red in front and depth 1.0 everywhere, "failed for the stated reason".
Not covered
A depth-only mesh pass (no colour target, no pixel stage) is not covered. Mesh pipelines reach the stand-in only as native desktop-bytecode streams (
build_stream_pipeline), which must have a pixel stage and no depth format, so such a pipeline is refused when it is created. Supporting it is a separate change, and needs a hardware fixture or a capability skip, as the issue notes for WARP.The depth clear and the read-only DSV restore are left to #1806.
Verification
Windows 10 19045, MSVC 19.44. WARP: Microsoft Basic Render Driver, vendor 1414, device 008c, driver 10.0.19041.5794. Hardware: NVIDIA GeForce RTX 3060, vendor 10de, device 2503, driver 32.0.15.9636. The debug layer was enabled (
X2W_D3D12_DEBUG=1) in every run.startup_draw_depth_target_warppassed 10 of 10 repeated runs inrelease.tests/docs_links_check.pyandtests/bidi_controls_check.pypass.AI-assisted (Claude Code).
🤖 Generated with Claude Code