startup: translate slot 57 mesh requests with a depth-only pixel stage #2598
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2606"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T23:15:45Z.
Part of #2413 (item T5, the null-export half; #2520 covered the no-pixel-stage half).
What changed
A slot 57 request whose pixel stage exports only to the null target (
exp null off, off, off, off done vm) passed the role check since #2421 but was then refused withslot 57 mesh with a depth-only pixel stage is not covered. That refusal is removed, so the pair goes through the existing pair path:Stage.exportwrites nothing for thenulltarget. Thevmflag still emits the existingif (!(exec & 1)) discard;when EXEC was narrowed, so an alpha test keeps its kill. This is the same two-line hunk as the open #2026 (first commit of this branch, byte-identical, so it drops out if #2026 merges first).classify_decodedis not changed here.translate_mesh57no longer raises for a null-only pixel stage. The role check is unchanged: a null export mixed with any other non-colour export is still refused.hlsl_psalready emitsvoid main(PSIn i)with noSV_Targetwhen the stage has no colour export, andmanifest()already writes an emptytargetsline. The manifest keeps that line instead ofps none, because the pixel stage still decides coverage (discard) and must be bound.Why it is not handled like the no-pixel case (#2520): all 29 measured depth-only pixel stages read a texture and write EXEC before the null export, and 2 of them also store to an image. Dropping the stage would lose the kill (depth written for pixels that are discarded) and the stores.
Tests
Windows 11, Python 3.13, at this branch's head:
tests/startup_mesh57_depth_only_check.py(new, pure Python, registered in CMakeLists.txt, AGENTS.md and the platform-independent workflow job) pairs the accepted mesh fixture with hand-built pixel words:v_interp_mov_f32,v_cmp_gt_f32 vcc, 0.5, v0,s_andn2_b64 exec, exec, vcc,exp null done vm,s_endpgm. It checks the decode, that the pair translates, that the pixel HLSL has noSV_Targetand keeps the discard, and that the manifest ends in an emptytargetsline and has nops none. Controls: the same stage without the EXEC narrowing has no discard; a null export followed by a position export is still refused with the incompatible-export message. With the translator change reverted the check exits 1.Two existing assertions that expected the old refusal were updated to the new outcome: the skeleton check's depth-only case now expects
ok, and the watch check's synthetic null-export pair now reaches the mesh shape check, with the same refusal as its synthetic colour pair.Local observation (not reproducible from the repository)
29 locally requested slot 57 pairs stopped first at the depth-only refusal.
All 29 now stop in the mesh stage, at refusals that already exist; none translates. Shapes of the 29 pixel stages: 31 to 437 instructions; each reads a texture (
image_sampleorimage_load) and writes EXEC before its null export; 24 have the single null export as the instruction befores_endpgm; 2 contain an image store. The common form interpolates two attributes, samples one texture channel (dmask:0x8), compares and narrows EXEC.DXC (Windows SDK 10.0.26100) compiled the new fixture pair as
ms_6_5andps_6_0locally. Nothing was drawn.Measured versus hypothesis
s_load with a register offset through the resource heap, 1sampler from a descriptor, 1image_store modifier a16. These are expected to be the next pixel-side refusals once the mesh stages pass, but the request path never reached them.targetsline is what a future slot 57 runtime loader needs to create a pipeline with zero render targets and a depth view. No runtime code reads slot 57 results yet.Not verified
.ms57/.ps57results (issue item R1), so these draws are not submitted. Zero-RTV plus depth translated draws are the subject of the open #2417.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T23:21:17Z.
Review: COMMENTED
Review of head
94fed370against origin/main (comment only).Code: the diff is small and consistent with the description.
tools/startup/gfx2hlsl.pyStage.export: thenulltarget returns after the existingvmdiscard, so an alpha-test kill is kept and no render-target write is emitted.translate_mesh57: the null-only refusal is removed; the role check for a null export mixed with another non-colour export is unchanged.Linux commands run on the exact head:
python3 -B tests/startup_mesh57_depth_only_check.py-> okpython3 -B tests/startup_mesh57_skeleton_check.py-> okpython3 -B tests/startup_gfx2hlsl_watch_check.py-> passedpython3 -B tests/startup_translator_check.py-> 0 failedpython3 tests/docs_links_check.py-> ok;python3 tests/bidi_controls_check.py-> ok;git diff --check origin/main...HEAD-> cleantools/startup/gfx2hlsl.pyfrom origin/main -> the new depth-only check exits 1.nullearly return inStage.export-> the new depth-only check exits 1.Findings: no code defect found. The new test guards the behavior (discard kept, no
SV_Target, emptytargetsline, mixed null+position still refused).Not covered by this review:
.github/workflows/windows.ymlhas a one-line change registering the new test; it should be exercised by this PR's own CI run.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-25T23:50:14Z.
Thanks for #2606. As agreed in #2413, I'm building the source-built depth-only draw on top of it, and I checked the translator half first. Everything below was run on your head
94fed370and on a local merge of it with current main66026a39(#2026 merged at 23:22Z; the merge has no conflicts). Windows 11, Python 3.12 venv, DXC from the Windows SDK 10.0.26100.0.What works
vmdiscard is kept, there is noSV_Target, and the manifest ends in an emptytargetsline.pending_keyskeeps the pair pending with only.ms57.cso, or with a truncated.ps57.cso, and reports it done once both are complete.debug_errors=0 debug_warnings=0, no skips, at your head and on the merge with main. I'll open it once the first question below is settled, because its refusal controls depend on the answer.Questions
To reproduce, save this as
null_mix.pyand runpython -B null_mix.pyfrom the repository root. It uses onlyMESHandrequestfromtests/startup_mesh57_skeleton_check.py.python -B null_mix.py dxccompiles with DXC instead of writing sources only.exp mrt0 v0, v0, v0, v0beforeexp null off, off, off, off done vmtranslates (ok,targets 0,SV_Targetin the pixel HLSL), and so doesexp null … donefollowed byexp mrt0 … done. With DXC both publish.ms57.csoand.ps57.cso. Atcece3a36both stopped atexport target null. In #2413 R0Y00 asked to keep the mixed colour/null refusal for this narrow profile. Since #2026 deliberately draws a null export aftermrt0in the general pixel path, would the refusal belong intranslate_mesh57only, for example refusing a slot 57 pixel stage that has a null export next to any other export?exp mrtz v0, off, off, offbefore the null export, with the entry EXEC, also translates (SV_Depth, emptytargets). The description says a null export mixed with any other non-colour export is still refused; ismrtzmeant to be the exception? (mrtzafter av_cmpxis still refused by the existing MRTZ rule.)param0next to the null export, after merging main. At your head this is refused withslot 57 pixel stage has an incompatible export or termination. On the merge with main it translates, because #2026 makesclassify_decodedreturnpsfor a stage with a null export. Without DXC the result isokand.ps57.hlslassignso.param0insidevoid main(PSIn i), whereois not declared. With DXC it stops atdxc ps: error: use of undeclared identifier 'o'and leaves the two.hlslfiles next to the.fail, instead of the named refusal.pos0next to the null export is still refused by name. So this appears only after a rebase on main.exp null v0, off, off, off done vmtranslates and the channel is dropped. The null target writes nothing anyway, so this may well be intended; I'm only asking because #2026 keeps a partial compressed enable mask on a null export refused.Not covered: source-built programs only, no captured requests, nothing loaded at runtime (R1 does not exist yet).
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T00:13:22Z.
Review: CHANGES_REQUESTED
Keep T5 scoped to a slot-57 pixel stage whose only export target is
null. The existing general pixel behavior from #2026 can keep its mixed-export forms. I reran the proposed controls on the rebased1f41b562: the pure depth-only check passes, but each ofmrt0 + null,mrtz + nullandparam0 + nullreturnsokin manifest-only mode. Please enforce the narrower shape intranslate_mesh57before HLSL publication. Include the inverse export order and confirm mixed forms leave no manifest. For the null-only case, keep the VM discard and the real pixel stage with zero color targets. The D32 sentinel comparison and discard-removal mutant described above are the right independent evidence.Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-26T00:26:39Z.
Thanks. Pushed
8bd527a8on top of1f41b562.Reproduction. At
1f41b562in manifest-only mode (X2W_FXC=), all six mixed forms returnedokand wrote.ms57.hlsl,.ps57.hlsland.ms57.txt:mrt0 + null,mrtz + null,param0 + nulland the inverse ordersnull + mrt0,null + mrtz,null + param0.Narrower shape.
translate_mesh57now refuses a slot 57 pixel stage that has anullexport next to any other export target, withslot 57 pixel stage mixes the null export with another export. The check runs after the existing role check and before any source, bytecode or manifest is written.Stage.exportandclassify_decodedare unchanged, so the general pixel path from #2026 keeps its mixed forms.null + pos0still gets the existingincompatible export or terminationmessage.Inverse order, no manifest.
tests/startup_mesh57_depth_only_check.pycovers the three forms in both orders (six cases). Each case checks the decoded export order, the exact refusal, and that the directory holds only thereq_*inputs and<key>.fail: no.hlsland no.ms57.txt. With the new check disabled, the test fails on all six cases (12 failed assertions).Null-only. Unchanged and still asserted: the
vmdiscard is kept, the pixel stage has noSV_Target, and the manifest ends in an emptytargetsline withoutps none.D32 sentinel and discard-removal mutant. I left this out of the PR on purpose: @roansystemlabs is building the source-built depth-only draw on top of this branch, as agreed in #2413, and I do not want to duplicate it. For reference, a local draw of the alpha-test pair into a D32 target cleared to 1.0 (zero render targets, depth test LESS) matched its reference on WARP and on one hardware adapter, and the same draw with the
discardline removed from the generated pixel source failed with 115 depth mismatches. If you would rather have that fixture in this PR, say so and I will push it as a separate commit.Commands at
8bd527a8(Windows 11):Not verified:
nullexport carrying a channel is unchanged and still accepted.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T00:32:53Z.
I retested
8bd527a8on Windows. The six mixed-export cases now refuse before publication, and the null-only, skeleton, watch and translator checks all pass. This addresses the export-shape finding. @roansystemlabs, please publish your existing D32 draw fixture on this head, or link an exact-head run with the discard-removal mutant if the branch is already ready. That will let us verify the actual depth distinction on the revised candidate.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T02:02:25Z.
Review: APPROVED
I reran the offline depth-only, mesh-skeleton and watcher controls at your exact head plus the test-only #2680 commit. WARP and RTX 4060 Laptop each matched all 1,024 D32 pixels and kept color cleared with zero debug warnings. Both adapters detected 181 depth mismatches against a no-write reference and 134 when the discard was removed. The six mixed export forms still refuse before publication. This resolves the T5 scope review. The fixture can follow as its own PR.
Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-26T01:47:09Z.
Thanks. Here is the D32 draw fixture on your exact head
8bd527a8: #2680 (one commit,120eef54, tests and docs only, no translator change).ctest --preset release --no-tests=error -j 1 -R '^startup_mesh57_skeleton' -Vat8bd527a8+120eef54, Windows 11, Release, MSVC 14.44, DXC 10.0.26100.0: 9/9 passed. That includes the offline check, which now expects your exact refusal (slot 57 pixel stage mixes the null export with another export) for a colour export before the null export of the drawn stage; the other mixed forms are left to yourstartup_mesh57_depth_only_check.py.startup_mesh57_depth_only,startup_gfx2hlsl_watchandstartup_gfx2hlsl_export_null{,_draw_warp,_draw_hardware}pass too.startup_mesh57_skeleton_depth_hardwareran on an NVIDIA GeForce RTX 3070 (10de:2484, driver 32.0.16.2101).startup_mesh57_skeleton_depth_warpran on the Microsoft Basic Render Driver (1414:008c, 10.0.26100.9818). Both had the debug layer enabled,debug_errors=0 debug_warnings=0, and no skips. The pair is drawn twice into a D32 target cleared to 1.0, depth test LESS. 259 pixels are covered: 181 keep a written depth and 78 keep the sentinel only because of the discard. Against the CPU reference the result isdepth_mismatches=0, and colour stays cleared. In-test controls: a reference without the depth writes gives 181 mismatches, and the same mesh with a null export that does not discard gives 134.Translator mutants at the same head, each reverted:
vmignored fornullinStage.export): the baseline draw fails withdepth_mismatches=134on both adapters, and the offline check andstartup_mesh57_depth_onlyfail.discard;fornull): the baseline fails with 181 on both, and the same two checks fail.Not covered: source-built programs only, no captured request, nothing loaded at runtime (R1). The
binary(llvm-mc) mode was not run here.AI-assisted.