Repository navigation
D3D12.X: command list #142 applies the quad sample mask (XCL_SAMPLE_MASK=1) - #3076
CharlyRien wants to merge 2 commits into
Conversation
|
Tested Clean detached
7 passed, 0 failed, 0 ignored, 0 skips. All native processes and the Arc wrapper exited 0. The executable SHA-256 held before, under, and after the lock. Not tested Hardware MSAA, end-to-end command-list-to-GPU wiring, the runtime enable switch, retail smoke, and the full suite. AI use T3 Code / Codex ( |
Command list xcl-dev#142 of the newer layout (SetQuadSampleMaskX, a stub so far) gets a handler that only counts: its calls, those with a mask other than all ones, and the title's graphics work recorded while such a mask is current on its list (direct draws, DispatchMesh, and graphics ExecuteIndirect calls by kind, each once at the title's call). One tally line every ten seconds of graphics work, so a window without use reads as zeros. Nothing is applied: no shader, io or state change. It answers whether xcl-dev#3076 has anything to act on in a title before that PR's shader change is tried. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
4c6207d to
0bab2ef
Compare
|
A test of this change in the world of the retail title, plus two things a port to Setup: RTX 4070 SUPER 12 GB (driver 621.40), Ryzen 7 5700X, 32 GB RAM, Windows 10 19045, Rust 1.100.0, release. A local test tree ( The title does set partial masks in the world. Your 200 s run saw only all-ones masks; past the loading screens they come:
1. Two-pass mesh draws don't get the mask. On if !compute_pass {
quad_kill_io(&mut io, with(this, |s| s.quad_kill));
}( 2. The io slots are taken on Not judged yet: whether the dithered fades now look right. In these runs the comparable scenes were dominated by draws skipped while their pipelines were built cold, so the frames can't settle it. A run with warm caches is next. AI use: Claude Code (Claude Opus 5.5) ported the change, made the two-pass addition, ran the title and wrote this comment. |
Every console mesh pipeline on main now has a two-pass form, whose mesh pass builds its io in prepare_two_pass_stage (two_pass_io), not through bind_abi, so quad_kill_io never ran for those draws: with XCL_SAMPLE_MASK=1 none of them was masked. The mesh pass (not the compute pass) now writes the list's mask into IO_QUAD_KILL as bind_abi does. Found and tested by Eterst on xcl-dev#3076 (RTX 4070 SUPER, a retail title's world: 0 masked draws without it, 19,494 with it, in 300 s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0bab2ef to
ccd6134
Compare
|
Rebased on What changed in the rebase, both from Eterst's test above (thanks):
The branch merges with Setup: RTX 3090 24 GB (Resizable BAR off), driver 616.56, Ryzen 9 5950X, 32 GB RAM, Windows 11 22631, Rust 1.100.0, release tests, AI use: Claude Code with Claude Opus 5.5 did the rebase, added the two-pass commit, ran the tests and wrote this. The person running these tests asked for it. |
|
On head
The fixture called the newer-layout #142 handler, took snapshots through the list-state and IO-packing helpers, then submitted the four scissored draws on one native command list. For each switch/backend combination I compared the entire resolved 16×16 float target with a native reference shader that selected pixels directly by screen coordinates. Every value was exactly the white draw color or blue clear color. The two checkerboards occupied opposite positions. The enabled and disabled tests ran in separate processes; both passed with zero skips. These are whole-pixel 0/0xffff masks on a multisampled target. The readback is a hardware resolve, not a per-sample dump. The test uses synthetic tracked list state, normal vertex/pixel draws and the translated shader IO. It does not exercise guest vtable lookup, the two-pass mesh binding path or a retail fade. AI use: OpenAI Codex adapted the test fixture, ran the GPU comparisons and drafted this report. |
|
@andrewDoing thanks for the MSAA comparison against a native reference on the RTX 5070, on AI use: Claude Code with Claude Opus 5.5 wrote this reply. |
Every console mesh pipeline on main now has a two-pass form, whose mesh pass builds its io in prepare_two_pass_stage (two_pass_io), not through bind_abi, so quad_kill_io never ran for those draws: with XCL_SAMPLE_MASK=1 none of them was masked. The mesh pass (not the compute pass) now writes the list's mask into IO_QUAD_KILL as bind_abi does. Found and tested by Eterst on xcl-dev#3076 (RTX 4070 SUPER, a retail title's world: 0 masked draws without it, 19,494 with it, in 300 s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ccd6134 to
9e68021
Compare
|
Rebased on Read, CI: the 4 Description refreshed (Tested, Regression run, AI use). The body now has io slots 119 / 120, the two-pass commit, and the reports of Eterst, andrewDoing and JJAutoCompare. Stack: RTX 3090 24 GB (Resizable BAR off), driver 616.56, Ryzen 9 5950X, 32 GB RAM, Windows 11 22631; Rust 1.100.0, release tests, AI use: rebase, test runs and this comment done with Claude Code (Claude Opus 5.5), checked by me. |
…AMPLE_MASK=1) The newer layout's command list xcl-dev#142, SetQuadSampleMaskX(u64), takes the two PA_SC_AA_MASK registers: 16 sample bits for each pixel of a 2x2 quad (X0Y0, X1Y0, X0Y1, X1Y1 from bit 0). A retail title sets it per draw from dithered fade tables (0 to 4 pixels of the quad, each 0 or 0xFFFF, and the complement for the other side of a cross-fade). As a stub every pixel is drawn, so LOD cross-fades draw both levels whole. The name is the one xcl-dev#1274 gives the slot (a no-op there). Host (hle/d3d12x/quad_mask.rs, bind.rs): the handler keeps the mask per list as the samples it takes away; bind_abi writes them into io slots 119 / 120 (recomp::IO_QUAD_KILL) of graphics draws, only when the mask is partial; reset and ClearState go back to all ones, a mid-list split inherits it. Older layout: xcl-dev#142 is another method, answered as the stub did. Off unless XCL_SAMPLE_MASK=1: off, the io slots stay 0 and nothing is discarded. Translator: every pixel shader starts (before its EXEC is taken) with the test. HLSL: one uniform branch on the two io words, then a discard of the pixel whose quad word is all ones. Direct DXIL: the same straight-line, one conditional discard. No pixel shader on main has early depth; one that gets it must not get this test (the discarded pixels' depth would still be written). Tests: mask decoding and the title's masks, the slot, the io wiring across reset / ClearState / split, the HLSL text and the direct path's discards, and a GPU draw through both paths with each kind of mask. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every console mesh pipeline on main now has a two-pass form, whose mesh pass builds its io in prepare_two_pass_stage (two_pass_io), not through bind_abi, so quad_kill_io never ran for those draws: with XCL_SAMPLE_MASK=1 none of them was masked. The mesh pass (not the compute pass) now writes the list's mask into IO_QUAD_KILL as bind_abi does. Found and tested by Eterst on xcl-dev#3076 (RTX 4070 SUPER, a retail title's world: 0 masked draws without it, 19,494 with it, in 300 s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9e68021 to
13a94c5
Compare
|
Rebased on Rebased and tested with Claude Code (Claude Opus 5.5), checked and posted by me. |
|
No open or merged PR implements command list #142 AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
merge-check AI-written and posted by Foniass without a human check of each point. |
Command list #142 of the newer console layout,
SetQuadSampleMaskX(u64), is a stub onmain: every pixel is drawn. The u64 is the twoPA_SC_AA_MASKregisters, 16 sample bits for each pixel of a 2×2 quad. A retail title sets it per draw from dithered fade tables (0 to 4 pixels of the quad, each 0 or 0xFFFF, and the complement for the other side of a cross-fade), so LOD cross-fades draw both levels whole instead of a dither pattern. This applies the mask in the translated pixel shaders, behindXCL_SAMPLE_MASK=1(off by default). The slot's name is the one #1274 gives it (a no-op there).What is in it (two commits)
First commit:
crates/xcl/src/hle/d3d12x/quad_mask.rs(new): the Pr/newer title startup #142 handler (newer layout only; on the older one Pr/newer title startup #142 is another method, answered as before), the mask kept per list as the samples it takes away, the switch, a log line at the first call and counts at powers of two from 1024.crates/xcl/src/hle/d3d12x/bind.rs: the list's mask; reset andClearStatego back to all ones, a mid-list split inherits it;bind_abiwrites it into io slots 119 / 120 of graphics draws only when it is partial.real.rs: the slot.crates/xcl/src/gpu/recomp/mod.rs:IO_QUAD_KILL = [119, 120](trap-temp SGPR slots, aftermain's 113–118:IO_LOOP_BUDGET,IO_GROUP_LIMIT,IO_THREAD_LIMIT115–117,IO_MESH_GROUP_BASE118; belowKERNEL_SCC_SLOT, 125).crates/xcl/src/gpu/recomp/emit.rs(HLSL) andcrates/xcl/src/gpu/dxil/lower_gfx.rs(direct DXIL): every pixel shader starts, before its EXEC is taken, with the test: HLSL one uniform branch on the two io words, then a discard of the pixel whose 16 bits are all taken away; direct DXIL the same straight-line with one conditional discard. With the switch off the io words are 0 and nothing is discarded, but the text of every pixel shader changes, so the translator identity changes.mainhas early depth (the direct path'searly_depth_stencilflag exists, every caller passes false). One that gets it (Recompiler: console pixel shaders tested depth-first keep early depth #2181) must not get this test: the depth of the discarded pixels would still be written. The comment at the test says so.ClearState/ split; the HLSL text and the direct path's discards (dxil::core_tests); a GPU draw through both paths with each kind of mask, 16×16 pixels compared (recomp::tests::gpu_quad_sample_mask_discards_the_quad_pixels_it_takes_away).Second commit (from Eterst's test in this thread): every console mesh pipeline on
mainhas a two-pass form, whose mesh pass builds its io inprepare_two_pass_stage(two_pass_io), not throughbind_abi, so withXCL_SAMPLE_MASK=1none of those draws was masked. The mesh pass (not the compute pass) now writes the list's mask intoIO_QUAD_KILLasbind_abidoes. Eterst measured it on an RTX 4070 SUPER, a retail title's world: 0 masked draws without it, 19,494 with it, in 300 s.+360 / −7 in 9 files for the two commits.
Tested
13a94c5onmain0fe06eb(rebased 29/11 evening; one conflict, ingpu/dxil/core_tests.rsonly:mainhad added a test where this PR addsquad_sample_mask_starts_pixel_shaders_on_both_paths, both kept;main's io slots checked again, still nothing at 119 / 120,IO_MESH_GROUP_BASE= 118 is the last). RTX 3090 24 GB (Resizable BAR off), driver 616.56, Ryzen 9 5950X, 32 GB RAM, Windows 11 22631; Rust 1.100.0, release tests.cargo check --release -p xcl --lib --bins: passes, the same 38 warnings asmain0fe06eb; the test build has the same 18 warnings asmain0fe06eb(no new one).XCL_ADAPTER=warp, so the GPU tests, the GPU drawgpu_quad_sample_mask_discards_the_quad_pixels_it_takes_awayamong them, run on WARP or skip;XCL_REQUIRE_GPUunset; the tests that open the hardware adapter whateverXCL_ADAPTERsays left out with--skip):cargo test --release -p xcl --lib -- gpu::recomp::tests hle::d3d12x::quad_mask hle::d3d12x::real::readback_routing_tests gpu::dxil::core_tests hle::d3d12x::bind::tests shaders::pipeline_library::tests shaders::warm_library::tests --test-threads=4: 370 passed, 6 failed, 19 ignored; 155 of the passes are tests that skipped (no GPU, or no mesh shaders on WARP), the GPU draw among them. The 6 failures are 5shaders::pipeline_library::testsandshaders::warm_library::tests::cold_publish_makes_an_unchanged_corpus_reusable:CreateComputePipelineStatereturns E_INVALIDARG on this machine's WARP, which has no SM 6.6. That is a local artefact of a WARP run here. This PR's 7 tests passed: the 3quad_masktests,list_142_sets_the_quad_sample_mask,quad_sample_mask_reaches_the_io_of_the_lists_draws,quad_sample_mask_starts_pixel_shaders_on_both_paths, and the GPU draw (skipped: no GPU).main0fe06eb: 363 passed, the same 6 failed with the same error, 19 ignored. The difference is this PR's 7 tests.XCL_REQUIRE_GPU=mesh, release):cargo test --release -p xcl --lib -- d3d12x::quad_mask:: list_142_sets_the_quad_sample_mask quad_sample_mask_reaches_the_io_of_the_lists_draws quad_sample_mask_starts_pixel_shaders_on_both_paths gpu_quad_sample_mask_discards_the_quad_pixels_it_takes_away --test-threads=1: 7 passed, 0 failed, 0 ignored, noSKIPPEDline: this PR's 7 tests, the GPU drawgpu_quad_sample_mask_discards_the_quad_pixels_it_takes_awayamong them (run on the card, not skipped).ccd6134: a four-draw mask sequence on a 4× MSAA target against a native reference shader, both backends, switch off and on: every resolved pixel matched.4c6207d: the GPU draw test and 6 host tests, 7 passed.0bab2efonmaine429936.cargo test --workspace --no-fail-fast -- --test-threads=4(debug): 2133 passed, 9 failed, 48 ignored. The 9 are the 9 testsmaine429936itself failed on a GPU, the same names as in this report on an RTX 4080. The 7 tests of this PR passed, the GPU draw among them (both paths, each kind of mask, 16×16 pixels compared).4c6207donmain2c717a0): a run withXCL_SAMPLE_MASK=1had no device removal and no crash; in it the title only set an all-ones mask (1024 calls, 0 partial), so nothing was discarded: that run checks that the switch is harmless, not that the fades are right.xcl-smoke block of the XCL_SAMPLE_MASK=1 run (4c6207d)
Regression run
Same machine as under Tested, same title, 60 s each (the
scripts/smoke.ps1default), both throughmaind52ff48'sscripts/smoke.ps1,XCL_PREPARE=0, the same scripted A presses (XCL_PRESS_A_AT),XCL_SAMPLE_MASKunset. Each run started from its own copy of the same shader cache, made by anothermaincommit, so cold for both. The head is onmain0fe06eb; themainrun is ofmaind52ff48(the newestmaintoday, 170 commits later), not of the head's base: the check asks for a commit ofmain.maind52ff48:this head
13a94c5(main0fe06eb+ this PR's two commits):main's 517 (116.6 %; the check wants at least 80 %), peak commit 15,349 MB against 15,968 MB (96.1 %; at most 125 %). Last three 2 s slices: head 61 60 61,main61 60 61 presents. 60 s covers the start of the title, not a long stay in its world.maind52ff48, so the difference between the two runs includes those commits, not only this PR.The earlier pair (200 s, earlier head 0bab2ef on main e429936)
Earlier pair: same machine, same title, 200 s, the same scripted A presses (
XCL_PRESS_A_AT),XCL_PREPARE=0,XCL_SAMPLE_MASKunset, both throughmain'sscripts/smoke.ps1, each starting from its own copy of the same shader cache (made by anothermaincommit, so cold for both).main:
earlier head
0bab2ef:main's, under the 80 % of CONTRIBUTING. The whole difference is in the first 25 s:mainpresented 603 frames there, the head none; after 25 s the two runs are within about 2 % (1,795 frames against 1,838).main's own runs of this build gave 1,908, 2,442 and 1,744 frames; a second run of the head with the cache its first run filled gave 1,751.main's own first run of this build shows the same slow driver compiles at 25.7 s and its first frame at 28.2 s; only its second run (the pair above) started fast.The other runs of that setup:
maine429936, its first run (frames 1908; a compile of another branch ran on the same machine during its first 95 s, so it is not a clean reference):earlier head
0bab2ef, second run, with the cache its first run filled:maine429936, third run, with the cache its second run filled:Not tested
XCL_SAMPLE_MASK=1(the regression run above has it unset), and the whole suite on a GPU on this head (only this PR's tests ran on the GPU).AI use
AI use: working out the call's meaning from the values the title passes, the code, the tests, the two-pass commit, the rebases, the test, title and smoke runs and this description were done with Claude Code (Claude Opus 5.5), checked and posted by me.
🤖 Generated with Claude Code