D3D12.X: keep logic ops on pipelines whose render targets are all UINT #2856
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2856"
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 ivall/xcl. Originally posted by tiagonleal on 2026-11-26T19:06:57Z.
sanitize_integer_rt_blendclearedLogicOpEnabletogether withBlendEnableon every integer render target. D3D12 on PC forbids blending on UINT and SINT targets, but logic ops are allowed on UINT targets, withBlendEnableFALSE andIndependentBlendEnableFALSE (slot 0's state then applies to every bound target). A console pipeline that ORs or XORs bit masks into a UINT target got plain overwrites on PC. The function came in with #1988, whose description gives no reason for clearing the logic op.With
IndependentBlendEnableFALSE, slot 0 now keeps its logic op when every bound target is UINT and the device reportsD3D12_OPTIONS.OutputMergerLogicOp.BlendEnableis still cleared. Without that capability the logic op is cleared as before and a warning is logged once. A logic op on a set with any non-UINT target (SINT, float, UNORM, UNKNOWN) is now cleared too, also when no integer target is bound, because D3D12 rejects such a pipeline. The independent-blend path is unchanged.Based on
e120925e, the lastmaincommit before #2555 (see Regression run).Rebased onto
main309c3ec5. The probe now sits next tomain'spipeline_library::activate, andmain's newsanitize_integer_rt_blendcall for the blend subobject of a pipeline stream also askslogic_op_supported().What is in it
crates/xcl/src/hle/d3d12x/real.rs:probe_logic_opcachesOutputMergerLogicOpat device creation;sanitize_integer_rt_blendtakeslogic_op_supportedand keeps the logic op on all-UINT target sets; newis_uint_dxgi_format; the four callers pass the cached valuelogic_op_stays_on_uint_render_targets,logic_op_dropped_without_output_merger_logic_opandlogic_op_dropped_unless_every_target_is_uint; the all-integer case ofinteger_rtv_blend_sanitization_clears_uint_sint_and_preserves_floatnow uses a SINT targetTested
cargo test -p xcl --lib pso_blend_and_tsharp_tests: 6 passed, 0 failed, 3 of 3 runs one29306f4logic_op_stays_on_uint_render_targets(real.rs:6732),logic_op_dropped_without_output_merger_logic_op(real.rs:6723) andlogic_op_dropped_unless_every_target_is_uint(real.rs:6770). The other three tests in the module pass.cargo test --workspace --no-fail-fast -- --test-threads=4, run twice one29306f4: 1441 passed, 4 failed, 47 ignored both times (25SKIPPEDlines: 21no wave64, 1no heap windows, 3 recompiler cases refused as unsupported). The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(CreateComputePipelineStatereturns E_OUTOFMEMORY, 0x8007000E). They fail the same way one120925eon this machine (cargo test -p xcl --lib fuzz_validate_and_gpu: 0 passed, 4 failed).mainf9a0cb80(headf013aeae):cargo test --workspace --no-fail-fast -- --test-threads=4, one run: 1463 passed, 4 failed, 47 ignored (25SKIPPEDlines). The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0to_3, as before. The other results in this section are from the earlier heads named in them.main309c3ec5(heada9e51cc4):cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4, one run: 2141 passed, 4 failed, 48 ignored (25SKIPPEDlines). All 4 failures also fail onmain309c3ec5on this machine (2138 passed, 4 failed, 48 ignored): the 4gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_*(#1919 fixes them). The other results in this section are from the earlier heads named in them.Regression run
scripts/smoke.ps1 -Seconds 60 -Title 9cc6a39e(Newer Retail Game), release builds of both commits in clean trees,main309c3ec5first, one run each, in one queue with this account's other PRs. Both runs hadXCL_PREPARE=0and the same warm DXIL cache. A warm-up run ofmaincame before them and is not shown. A second run ofmainat the end of the queue showed 302 frames and a peak commit of 10988 MB, so differences of a few tens of frames between runs are noise here.mainis slow for about the first minute of this title since #2959 (#3164 has the cause), which is why both runs show few frames.main(309c3ec5):This PR (
a9e51cc4):Not tested
OutputMergerLogicOpis covered by a unit test onlyIndependentBlendEnableTRUE are left as beforeXCL_PREPARE=0AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-26T19:07:06Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T20:27:20Z.
Independent desktop NVIDIA verification of PR #2856 at head
e29306f4b1e3dce921d03bef69c7c7f59ee441fd(1commit; exact parent & merge-base:e120925e3abc9956a8b9bae631969d32e8ccd43c, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
e29306f4)cargo test --release -p xcl --lib logic_op_dropped_without_output_merger_logic_op -- --nocapture1 passed; 0 failed; 0 ignored; 1344 filtered out(0.00s)cargo test --release -p xcl --lib logic_op_stays_on_uint_render_targets -- --nocapture1 passed; 0 failed; 0 ignored; 1344 filtered out(0.00s)cargo test --release -p xcl --lib logic_op_dropped_unless_every_target_is_uint -- --nocapture1 passed; 0 failed; 0 ignored; 1344 filtered out(0.00s)cargo test --release -p xcl --lib hle::d3d12x::real::(3 consecutive runs)66 passed; 0 failed; 0 ignored; 1279 filtered out× 3 (0.35s,0.36s,0.36s)cargo build --release -p xcl --bin xcl1m 09s, exit0)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
e120925e3abc9956a8b9bae631969d32e8ccd43c, cached baseline on the same machine):PR #2856 (
e29306f4b1e3dce921d03bef69c7c7f59ee441fd):Runtime log observations (
xcl.log)9223log lines,0[ERROR]/ device-removal / panic lines, and0OutputMergerLogicOplogic-op drop warnings.probe_logic_op(&device)ran cleanly during real RTX 4060 D3D12 device initialization.19561 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample13971 MB committed by the process; video memory 6115 MB local, 4650 MB non-local.Limits of coverage
title: 29640639exercises real RTX 4060 device initialization (probe_logic_op) and confirms zero regression across translated pipelines, draws, and dispatches, but the 60 s menu capture was not confirmed to create an active all-UINTLogicOpEnablepipeline on GPU (no on-GPU readback of a UINT bitwise logic-op render pass was run). Preservation on all-UINT render targets, dropping on SINT / mixed / non-UINT targets, and theD3D12_OPTIONS.OutputMergerLogicOpcapability gate were verified via the 3 new unit tests and 3× fullhle::d3d12x::real::runs (66/0/0).AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by cindertheblue on 2026-11-27T17:49:16Z.
Smoke pair for Regression run, head
f013aeaeandmain6089122a, the same title, 60 s each: no device removals or crashes, 103 % ofmain's frames (1,397 vs 1,353), 100 % of its peak commit (14,195 vs 14,188 MB). With both blocks pasted under Regression run,main'sscripts/pr_check.pyreportsdescription okfor this head and the current description.main6089122a:This PR's head
f013aeae:Tested
cargo build --release -p xcl) of both commits from clean worktrees.scripts\smoke.ps1 -Seconds 60 -StartupTimeoutSeconds 1800, withXCL_ADAPTER=7600andXCL_PREPARE=0(both logs:Shader preparation left out (XCL_PREPARE=0)).xcl.exe, so AMD's per-app driver cache was cold for both.Not tested
XCL_PREPARE=0), longer play, the test suite on this head.AI use
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T03:56:50Z.
merge-check
base:
fa204595a4head:
a9e51cc4a5merge: clean (trial merge 9388f10132f5e192f87f355687d1c3fb5399c901, local, not pushed; real.rs auto-merged;
git diff --checkclean; everysanitize_integer_rt_blendcall on current main gets the new argument)build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609) -> 2610 passed, 2 failed, 49 ignored; SKIPPED: 26, the usual set (21 no wave64 on this 32-lane GPU, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows). The three new tests passed:
logic_op_dropped_without_output_merger_logic_op,logic_op_stays_on_uint_render_targets,logic_op_dropped_unless_every_target_is_uint(plus the changed Case 3). Both failures aregpu_two_pass_cache_e2e::two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs(one test, counted twice), a known load flake of that driver-cache test, which this PR doesn't touch; it passed when rerun alone on the same merge.review: none blocking; whole diff read. PC D3D12 accepts
LogicOpEnableonly when independent blend is off, every bound target is*_UINT, and the device reportsOutputMergerLogicOp. That's what this keeps: slot 0's logic op stays in exactly that case (itsBlendEnableis cleared, since PC can't have both), and it's dropped everywhere else. Dropping it now also covers float-only target sets, which main passed through untouched. With independent blend on, integer slots lose blend and logic op as before. A mixed integer / float set with blending on slot 0 is still promoted to independent blend.probe_logic_opruns once ininit_with_remapright after device creation (it's still there on current main), and until it has runlogic_op_supported()is false, which drops logic ops: the safe side. If a device lacks the feature, a warning is logged once. AnUNKNOWNslot insideNumRenderTargetscounts as not UINT, which is conservative.performance: none (a few comparisons at pipeline creation, one feature query at startup). Title run (release build of the merge, scratch/fast-world.py fast profile, about 85 s in world): exit 0, 0 crashes, 0 device removals, world entry 85.5 s, peak commit 31,634 MB,
failed_pipelines0, no translation errors. 153 WARN lines against 86 on a mainfa204595run on the same harness (world entry 76.8 s, peak commit 33,027 MB). The difference is 77 "video memory: N MB in use, N MB over the budget" lines: Windows gave this run a 12,330 MB budget because other title runs shared the GPU at the time. That and "running out of commit" are the only new WARN kinds, and both come from machine load. The log has no logic-op line: the once-only "no OutputMergerLogicOp" warning never fired, so either the device reports the feature or the title never asked for a logic op on all-UINT targets (I didn't log which). Both runs show 0 fps in the world because the cache doesn't match the translator identity.verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, release build for the title run, DXC 1.9.2609 via XCL_DXC_DIR. Claude Code, Claude Opus 5.5: merge, build, suite, title run and full-diff review; this report.
Imported from ivall/xcl. Originally posted by throny on 2026-11-29T08:23:33Z.
merge-check claim
head:
a9e51cc4a5Imported from ivall/xcl. Originally posted by throny on 2026-11-29T08:40:59Z.
merge-check
base:
d8bd9a38head:
a9e51cc4a5merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2621 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at
d8bd9a38: 2618 passed, 0 failed, 49 ignored.review: no blocking finding. The device's logic-op support is probed once at device init, and with independent blending off, slot 0's logic op is kept when every target is UINT and the device supports it. All six callers are updated and the new tests fail without the change. One behaviour change the description does not state: a pipeline whose targets are all float and that carries a logic op used to pass through untouched and now loses the logic op. That agrees with D3D12 on PC, which takes logic ops on UINT targets only, but it should be said. A target slot of unknown format also drops the logic op (the careful side).
performance: not measured.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T13:57:40Z.
Review: COMMENTED
Code review of head
a9e51cc— no definite code defect found in the changed sanitizer or capability probe.I traced all four
sanitize_integer_rt_blendcall sites and checked the all-UINT, mixed-format, independent-blend, and unsupported-capability branches. The unit tests exercise the intended struct transformations. The core new behavior still lacks a driver-level test: no test creates a graphics PSO withLogicOpEnableon a UINT target, and the smoke run does not establish that the title uses one. Please add a focused WARP/debug-layer or hardware PSO creation and draw test before treating the compatibility fix as validated. I could not run Windows/GPU tests here.