D3D12.X: strip console-only fence flags on CreateFence #3386
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3386"
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 Kalmarv on 2026-11-29T12:14:46Z.
What is in it
D3D12_FENCE_FLAGSindev_create_fence(crates/xcl/src/hle/d3d12x/real.rs) viapc_fence_flags(flags)before calling PCCreateFence:0x7(D3D12_FENCE_FLAG_SHARED | D3D12_FENCE_FLAG_SHARED_CROSS_ADAPTER | D3D12_FENCE_FLAG_NON_MONITORED) and any upper-32-bit caller garbage, preventing PCCreateFencefrom rejecting console fence flags withE_INVALIDARG(0x80070057).hle::d3d12x::real::fence_flags_tests(pc_fence_flags_strips_console_and_upper_bitsanddev_create_fence_sanitizes_console_flags).Tested
dev_create_fence_sanitizes_console_flagsfails before the fix on WARP with0x80070057(E_INVALIDARG) when passed console flag bit0x10000.cargo test -p xcl --lib -j 4 -- hle::d3d12x::real::fence_flags_tests:: --nocapture): 2 passed, 0 failed, 0 ignored.cargo test --workspace -j 2 -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched --skip uma_driver::tests::withXCL_DXC_DIRset to DXC 1.9 on RTX 5070 Ti): 41 test binaries, 2611 passed, 0 failed, 49 ignored, 9 filtered out.SKIPPEDbreakdown (26 total): 21no wave64(RTX 5070 Ti is wave32), 3refused(V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32#1426semantics), 2no heap windows(XCL_HEAP_WINDOWS=1opt-in).Regression run
Not tested
D3D12_FENCE_FLAG_NON_MONITOREDwas only checked in the pure bitmask unit test because the WARP software adapter does not support non-monitored fences.CreateFencewere not run directly; those paths are covered by the synthetic unit and WARP tests.test_title_runs_and_game_folder_is_untouched,uma_driver::tests::, wave64 GPU tests, andXCL_HEAP_WINDOWS=1opt-in unit tests were not run in the workspace suite.AI use
Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-29T14:20:58Z.
Reviewed and tested at
2e09e72f.Looks clean and minimal —
pc_fence_flagsmasks to the valid PCD3D12_FENCE_FLAGSbits and drops upper-32-bit garbage, logs once on console-only bits, and the isolated WARP child test covers all cases.Tested locally
32.0.16.2140), AMD Ryzen 7 7800X3D,rustc 1.100.0.cargo test -p xcl --lib hle::d3d12x::real::fence_flags_tests:: -- --test-threads=1: 2 passed, 0 failed.AI use
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-30T16:03:06Z.
Test report for #3386 at
2e09e72ff5b8f91736fdfaa46a5b1242e6edecbe, against its merge-base withmain,d8bd9a38, under Wine on AMD.Tested
experimental-11.0-20261112, stock vkd3d-protonmaster71cae091. Debug build,x86_64-pc-windows-gnu, under Wine. It wasn't run on Windows.cargo test --locked -p xcl --lib --target x86_64-pc-windows-gnu -- <filter>.--test-threads=1 <name>): both pass:dev_create_fence_sanitizes_console_flags,pc_fence_flags_strips_console_and_upper_bits. 2 passed, 0 failed.--test-threads=2, with--skip gpu::and these six:failed_restore_stops_before_importing_an_unbacked_window,grooming_leaves_a_window_under_1_gib_only_its_hole(both run out of memory here),write_buffer_immediate_on_open_existing_heap_visible_to_cpu,coherent_buffer_sanitizes_console_flags_and_state,serialize_root_signature_strips_console_flags_and_preserves_pc_flagsandexecute_indirect_reads_the_arguments_written_before_it. Under Wine each of the last four ends the process or makes RADV reject later submissions (#3067), so without them the suite reaches its summary:2e09e72f: 1511 passed, 113 failed, 5 ignoredd8bd9a38: 1510 passed, 112 failed, 5 ignoredacphal::tests::xapu_connect_returns_oom_and_cleans_up_on_failure(a memory counter, 8192 against 65536). #3386 doesn't touch that code; on this head the test passes 5 of 5 alone and inhle::acphal::as a module, and it failed the same way once in the suite of #3305. So I take it for a flake of tests running side by side. Most of the base's failures under Wine aremain's known ones on stock vkd3d-proton: list creation refused (E_INVALIDARG, #175 / #1701) and the tests after it (#3067).Not tested
gpu::tests in the suite runs-p xcl --lib)AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:51:32Z.
merge-check
base:
d0832e614fhead:
2e09e72ff5merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2892 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (real.rs, +85/-2). Every CreateFence now has its flags masked to the PC's valid ones (SHARED, SHARED_CROSS_ADAPTER, NON_MONITORED); XCL's own NONE calls are unchanged. Findings: (1) the description doesn't say which console fence bits these are, what they mean on the console, or which title sends them, and Not tested says no such title was run, so the need isn't shown. (2) The log fires once per process (~4807-4811), so later, different console bits are dropped silently; logging each new combination once would keep that visible. (3)
dev_create_fence_sanitizes_console_flagsruns in a child process whose output is dropped on success, so askip_testthere shows as a plain pass (same pattern as console_heap.rs). (4) AI use names no tool or model; no what-and-why paragraph or issue link. Fine: dropping the upper 32 bits is right for a 32-bit enum, fence tracking and the extra reference are unchanged, the child process keepsadopt's vtable patch out of other tests, and the bitmask unit test checks the mask.performance: 60 s smoke of a retail title, main
d0832e61vs this merge (7fd32a77): 1516 -> 1667 frames shown (109 %; last presents per 2 s: 60 61 60), peak commit 18133 -> 17027 MB, 0 device removals, 0 crashes. git diff --check flags a new blank line at the end of real.rs.verdict: safe to merge (say which title sends the console fence bits, and log each new combination rather than once per process)
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T05:08:55Z.
Source review of head
2e09e72f:pc_fence_flagskeeps only bits0x1|0x2|0x4. Microsoft's current D3D12 header also definesD3D12_FENCE_FLAG_ALLOW_COMMAND_LIST_BARRIERS(0x8) andD3D12_FENCE_FLAG_ALLOW_QUEUE_AND_CPU_SYNC(0x10). Agility SDK 1.620 retail includes Fence Barriers Tier 1. The PR's test treats0x8as console-only.On a runtime and device supporting fence barriers,
CreateFence(value, 0x18)therefore reaches native D3D12 asCreateFence(value, 0). That changes the fence contract: Microsoft specifies these flags for command-list barriers and queue/CPU synchronization. This is a source-level compatibility concern; I have not measured a title or GPU failure from it.Please preserve the two defined PC bits while stripping confirmed console-only bits and upper-32-bit garbage. Let native D3D12 validate feature support and flag combinations rather than silently changing valid requested flags. Replace the
0x8-is-console-only test and add a regression such aspc_fence_flags(0x10018) == 0x18. On a fence-barrier-capable adapter, check thatID3D12Fence1::GetCreationFlagsretains the requested bits; keep a separate test for the confirmed console-only bit.Minimal mask and unit-test candidate
The candidate above illustrates the mask change; use the SDK's named constants if available in the binding. This review did not run builds, tests, or a title. AI use: OpenAI Codex (GPT-6.2 Sol) traced the PR and current D3D12 definitions; OpenAI Codex (GPT-6.2 Astra) independently checked the fence-barrier contract.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T06:55:35Z.
merge-check
base:
d0832e614fhead:
2e09e72ff5merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2892 passed, 0 failed, 51 ignored; failing: none (25 SKIPPED lines, all GPU tests on this adapter, e.g. no wave64)
review: Read the whole diff (1 file, real.rs). CreateFence now masks the flags to the PC's valid set (SHARED, SHARED_CROSS_ADAPTER, NON_MONITORED) and drops upper-32-bit garbage, logging the first dropped value once. The tests cover the helper and a WARP-device run of dev_create_fence (child process of the test binary, the only process code) with console bits, checking creation, the completed value and tracking. The child returns silently when WARP is missing. Scope is one function; the stripped bits were invalid on the PC anyway.
performance: no cost: one mask per fence creation and one atomic load on the rare path; reasoned, not measured.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300; Claude Code, Claude Sonnet 5.5 ran the build and the suite and read the diff; Claude Opus 5.5 checked this report (the diff review is Sonnet's)
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T07:00:32Z.
Merged at the checked head after a combined trial of #3400, #3386, #3393 and #3535 on
maind0832e61(RTX 4080 16 GB,cargo test --workspace --no-fail-fast -- --test-threads=4: 2896 passed, 0 failed, 51 ignored, 25 SKIPPED lines). Two merge checks: Foniass and ours.AI use: Claude Code (Claude Opus 5.5).