Repository navigation
startup: apply the decoded slot 57 depth-stencil state behind X2W_DEPTH_STATE - #2169
Conversation
…TH_STATE
With X2W_DEPTH_STATE=1 (off by default), translated draws of device slot 57
pipelines take the depth-stencil state decoded from state block A
(pipeline_state_decode.h) instead of the desktop default, and set the decoded
stencil reference on the command list after SetPipelineState. A block the
decoder refuses, or one that is too short, keeps the desktop state and logs
the reason. The state is only used when a depth view is bound. With the switch
off nothing reads the words, so the description, pipeline key and list state
are unchanged.
Checks: startup_depth_state (device-free selector, switch-off control),
startup_slot57_depth_{warp,hardware} (two overlapping triangles of unequal
depth, reversed-Z winner, switch off, wrong direction, separate stencil cases
with a known reference, refusal fallbacks). Raster bias, depth bounds,
clears and DSV binding stay out of scope.
Refs R0Y00#1999
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tedin7
left a comment
There was a problem hiding this comment.
Review of head 7019d04 (comment only, no approval).
Read: depth_state_apply.h, the d3d12_draw.inl hunks, CMake wiring, git diff --stat origin/main...HEAD (8 files, +654/-3).
Commands executed locally (Linux):
python3 tests/docs_links_check.py: self-test passed, 18 Markdown files, 402 links OK.python3 tests/bidi_controls_check.py: self-test passed, 1456 files, no bidi controls.git diff --check origin/main...HEAD: clean.g++ -std=c++17 -Isrc tests/startup_depth_state_check.cpp: cannot build here,d3d12.his missing on Linux. So the C++ tests and the--mutate switchcontrol were NOT run by me. I did not run a mutation of the new logic.gh pr checks 2169: Linux Python job passes. Windows build/test and gfx1013 jobs were still pending when I looked. I did not run a separate Win2025 job.
Findings:
- P1: none.
- P2: none.
- Nit 1 (
d3d12_draw.inl~1191): the decoded stencil reference is applied withOMSetStencilRefon every draw of that pipeline. It overwrites anyOMSetStencilRefthe title issued before. That matches the doc comment, but it is worth a line indocs/startup-runtime.mdthat the switch makes register state win over list state. - Nit 2 (
d3d12_draw.inl~1191): the guardpass.dsv_format != UNKNOWN || bound->dsv_format != UNKNOWNrepeats thedsv_formatchoice made inpipeline_for(line 492). Both give the same result today. A shared helper would stop them drifting apart. - Nit 3:
static LONG loggedis shared by the applied and refused log paths, so 24 lines of one kind can hide the other. Only affects diagnostics.
What looks right:
- With the switch off,
select_depth_stencilreturns nothing and the desktop state is unchanged. - The new pipeline-cache key only includes the depth-stencil bytes when they are actually used, so the key and the
DepthStencilStateassignment agree. - Slot 57 pipelines keep any desktop state found first.
- The title is neutral, and I saw nothing that breaks clean-room.
Not verified: the Windows/WARP result of startup_slot57_depth_* and startup_depth_state*. Please rely on the Windows CI job finishing green before Ready.
AI-assisted; commands listed were executed locally.
…unters Review nits on R0Y00#2169: one helper chooses the depth view format for both the pipeline key and the stencil-reference guard, the applied and refused log paths count separately, and the docs say that with the switch on the register state wins over list state. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@tedin7, the three nits are in
AI-assisted. |
tedin7
left a comment
There was a problem hiding this comment.
Review of head 3b184b31f6daf7b44c74c0d308382e0c156ffa46 (2 commits on top of main).
Verdict: no blockers found. Two small notes (P2) and one nit.
Checked locally (Linux)
git diff --stat origin/main...HEAD: 8 files, +662/-4.python3 tests/docs_links_check.py: pass (18 files, 402 links).python3 tests/bidi_controls_check.py: pass.git diff --check origin/main...HEAD: clean.python3 -I -m py_compile tests/startup_slot57_depth_check.py: ok.x86_64-w64-mingw32-g++ -std=c++17 -Isrc tests/startup_depth_state_check.cpp: compiles. I could not run the binary: wine here exits with code 53 for any binary, so no pass/fail result and no mutation result from me for the device-free test. The author's mutation table in the PR body (switch ignored, ZFUNC swapped, stencil ref not set) was not re-run by me.- CI at review time: Linux Python checks pass; Windows build and gfx1013 jobs still pending. The WARP/hardware fixture (
startup_slot57_depth_*) needs the Windows job to count.
Read-through
depth_state_apply.his small and pure. Switch off returns the empty default before anything reads the block. Short block and decoder refusal both set a reason and apply nothing. Stencil ref is carried only whenStencilEnableis true. Matches the unit test cases.translation_for: guardinfo->path == 57 && !bound->has_depth_stencilis right. The desktop state is kept when the decoder refuses.pipeline_for: the PSO key hashes the depth desc only when it is actually used, so a no-DSV pass shares the default PSO. Good.- The new
startup_slot57_depthtarget and the tests are wired in CMake like the neighbouringstartup_stream_depth. The--mutate switchcontrol uses WILL_FAIL, likestartup_pipeline_state_offset_control.
Findings
- P2
src/startup_stubs/d3d12_draw.inl(draw_translated, theOMSetStencilRefcall): the reference is list state and stays set after this draw. A later draw of a different pipeline that relies on an earlier titleOMSetStencilRefwill now see this value instead. The PR body and docs already say the order is unmeasured. Suggest a one-line note in the docs that the value is not restored, or restore it, so the next reader does not assume it is scoped. - P2 The log counters are
static LONGand capped at 24. Fine for a switch that is off by default. If the cap is hit, a later refusal reason is silent. Optional: log the reason once per distinct string. - nit
depth_boundsis reported in the log ("depth bounds not applied"). Consider anOMSetDepthBoundsfollow-up item in the docs, if not already listed.
No clean-room or title concerns: the title is neutral, and the decoder cites register layout sources only.
AI-assisted; commands listed were executed locally.
|
Resolved the CMake overlap with the depth-target tests and scoped the decoded stencil reference to the slot 57 draw. The next draw sees the saved guest reference, and a successful Reset starts at zero. The mixed-pipeline fixture observes both in pixel readback. The Windows Release selection passed 8/8 with WARP and RTX 4060 Laptop, zero skips. Rebuilding with just the restore removed made st_ref_restore draw blue instead of green on both backends. |
Refs #1999 (item A, second half)
Change
This applies the slot 57 depth-stencil decoder from #2124 to translated draws behind a new switch
X2W_DEPTH_STATE=1. The switch is off by default.translation_forind3d12_draw.inl. Wheninfo->path == 57, the pipeline has no depth-stencil state yet and the switch is on, block A is passed toread_depth_stencil_words/decode_depth_stencil. Slot 57 pipelines carry no desktopDEPTH_STENCILsubobject, so this block is the only thing that can sethas_depth_stencilthere; the check stays in place as a guard.pipeline_foruses the decoded state only when a DSV is bound. The binding already exists (slot 50, used bystartup_stream_depth), so item D is not needed for this part.draw_translatedsets it withOMSetStencilRefright afterSetPipelineState. That overrides any earlier titleOMSetStencilReffor the draw. Whether the console expects this order is not measured, and the docs say so.src/startup_stubs/depth_state_apply.h. The decoder itself is unchanged.startup_depth_stateand its controlstartup_depth_state_switch_control, which fails under--mutate switch;startup_stream_depth_*andstartup_slot57_blend_draw_*, which still pass.Test
New fixture
tests/startup_slot57_depth.cpp+tests/startup_slot57_depth_check.py. The same renderer runs on WARP and on hardware (skip 77 where none is available), with synthetic shaders and two overlapping triangles at z = 0.25 and z = 0.75:Mutations: each fails the fixtures.
rz_greaterdraws green instead of red.startup_pipeline_statealso fails.st_equal_hitdraws blue instead of green.Run on
7019d041, rebased on5d02dd37, with an NVIDIA GeForce RTX 3080 (driver 32.0.16.2124), WARP 10.0.26100.9818 and Windows 11 build 26200:Not covered: raster state and depth bias (item B), depth bounds, back-face-only stencil state, interaction with a title
OMSetStencilRef, clears (#1806), and derived path 55 pipelines that inherit the state. The offsets 0xB8–0xC4 are #2124's and were not measured again.AI-assisted (Claude Code).
🤖 Generated with Claude Code