Repository navigation
D3D12.X: align promoted UAV clear values, key UAV support by adapter LUID, and use device-aware footprints fallback - #2280
Conversation
…LUID, and use device-aware footprints fallback Follow-up to xcl-dev#1988 and xcl-dev#1991 fixing three D3D12.X resource/format bugs in `crates/xcl/src/hle/d3d12x/device_x.rs` and `crates/xcl/src/hle/d3d12x/real.rs`: 1. Clear-value format mismatch on promoted B5G6R5 / B8G8R8X8 RT+UAV textures: xcl-dev#1991 promoted B5G6R5_UNORM (85) + UAV -> R8G8B8A8_UNORM (28) and B8G8R8X8_UNORM (88) + UAV -> B8G8R8A8_UNORM (87) in `pc_resource_desc`, but resource creation still mapped `clear.Format` via `pc_clear` (leaving 85/88 unchanged), causing D3D12 `CreateCommittedResource`/`CreatePlacedResource` to fail with `E_INVALIDARG`. Add `pc_clear_format` / `pc_clear_for_desc` to align `(28, 85) => 28` and `(87, 88) => 87` (preserving native 85/88 on RT-only textures without UAV) across `create_placed_resource_x`, `dev_create_committed_resource_x`, `dev_create_placed_resource_x` fallback, and `own_memory_if_larger_on_the_pc`. 2. Pointer-ABA stale cache in `device_format_supports_uav`: `UAV_FORMAT_SUPPORT` keyed by raw `device as usize` pointer without eviction on release; reusing a freed device address on another adapter returned stale UAV support. Key `UAV_FORMAT_SUPPORT` by `((luid.LowPart, luid.HighPart), format)` via `ID3D12Device::GetAdapterLuid()` (matching `TYPED_UAV_SUPPORT`). 3. Device-unaware retry in `get_copyable_footprints_x`: Retry used `pc_resource_desc(&x)` instead of `pc_resource_desc_for_device(this, &x)`, leaving device-unsupported `ALLOW_UNORDERED_ACCESS` intact so `GetCopyableFootprints` still returned `UINT64_MAX`. Switch to `pc_resource_desc_for_device(this, &x)`. Assisted-by: Google Antigravity (Gemini 4 Neon)
|
AMD run (listed as untested), on a machine with two GPUs (RX 9070 XT + RTX 3060), each picked with Head
Each run used one adapter, so this covers the LUID-keyed UAV support per device on two different vendors, but not switching adapters inside one process. |
|
Independent Windows release test on clean head
Result: 14 passed, 0 failed, 0 ignored; no SKIPPED messages, including Not tested: full workspace, retail title, paired smoke runs, or live switching between multiple adapters. AI use: OpenAI Codex (GPT-6; exact variant unavailable) ran the tests and drafted this report. |
|
Test report: AMD Radeon RX 7800 XT (RDNA3, native wave64) for head Setup: RX 7800 XT, driver 32.0.31035.1003, Windows 11 Pro 10.0.26200, rustc/cargo 1.100.0, debug build, DXC 1.9.0.5512 ( Targeted (
Full suite (
Not tested: retail title or AI use: this report was run and written by Claude Code (Claude Sonnet 5.5). I read the diff but did not change any code. |
|
Independent Windows test of Tested
Not tested Texture pixel readback, the parent revision, retail titles, or the full workspace suite. The adapter-selection change was temporary. AI use OpenAI Codex (GPT-6.2 Sol) prepared and ran the tests, verified the results, and wrote this report. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
What is in it
Follow-up to #1988 and #1991 fixing three D3D12.X resource-creation and format-support bugs in
crates/xcl/src/hle/d3d12x/device_x.rsandcrates/xcl/src/hle/d3d12x/real.rs:B5G6R5/B8G8R8X8RT+UAV textures (pc_clear_format/pc_clear_for_desc): D3D12.X: global shader-visible sampler heap, typed UAV validation, and occlusion/query VA fixes #1991 promotedB5G6R5_UNORM(85) +ALLOW_UNORDERED_ACCESStoR8G8B8A8_UNORM(28) andB8G8R8X8_UNORM(88) +ALLOW_UNORDERED_ACCESStoB8G8R8A8_UNORM(87) inpc_resource_desc, but resource creation still ranclearthroughpc_clear(leavingclear.Formatat85/88), causing D3D12CreateCommittedResource/CreatePlacedResourceto fail withE_INVALIDARG. Addpc_clear_format(pc_format, clear_format)andpc_clear_for_desc(clear, pc_format, buf)aligning(28, 85) => 28and(87, 88) => 87(while preserving native85/88on render-target-only resources without UAV), and wire it acrosscreate_placed_resource_x,dev_create_committed_resource_x,dev_create_placed_resource_xfallback, andown_memory_if_larger_on_the_pc.device_format_supports_uav:UAV_FORMAT_SUPPORTpreviously keyed by rawdevice as usizepointer and was never evicted on device release; reusing a freed device address on a different adapter returned stale UAV support. KeyUAV_FORMAT_SUPPORTby((luid.LowPart, luid.HighPart), format)viaID3D12Device::GetAdapterLuid()(matchingTYPED_UAV_SUPPORT).get_copyable_footprints_x: WhenGetCopyableFootprintsreturnsUINT64_MAX, retry withpc_resource_desc_for_device(this, &x)instead ofpc_resource_desc(&x)(matchingget_resource_allocation_info_xandcreate_placed_resource_x), so device-unsupportedALLOW_UNORDERED_ACCESSflags are stripped on retry.Tested
1.9.2609.5(01b62ad4), release build.0 passed, 3 failed:pc_clear_for_desc_aligns_promoted_uav_targets_onlysaw85instead of28,device_format_supports_uav_keys_cache_by_adapter_luidhit the stale pointer-keyed cache on pointer reuse across adapter LUIDs, andget_copyable_footprints_x_strips_device_unsupported_uav_on_retryleftALLOW_UNORDERED_ACCESSset on retry).cargo test -j 4 -p xcl --lib hle::d3d12x::device_x::tests -- --nocaptureandcargo test --release -p xcl --lib hle::d3d12x::device_x::tests -- --nocapture): 14 passed, 0 failed, 0 ignored (0.21 s; all 10 existingdevice_xtests + 4 new tests:pc_clear_for_desc_aligns_promoted_uav_targets_only,gpu_promoted_uav_clear_values_pass_create_committed_resourceverifying live RTX 4060CreateCommittedResourcefails withpc_clearand succeeds withpc_clear_for_descfor both85->28and88->87RT+UAV textures,device_format_supports_uav_keys_cache_by_adapter_luid, andget_copyable_footprints_x_strips_device_unsupported_uav_on_retry).cargo build --release --workspaceandcargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture): 23 test binaries, 1254 passed, 0 failed, 46 ignored, plus 27 runtimeSKIPPEDlines (20no wave64on RTX 4060,3wave32 per-lane formrefusedby driver,2missingd3d12SDKLayers.dll/ D3D12 debug layer,1driver shader cache toggle unavailable,1no heap windows).Regression run
Baseline (
origin/main1a0bbe3a):PR head (
7fa87890):Not tested
#[ignore]tests on this machine.CreateCommittedResourceand 60 s title smoke ran live).AI use
Implemented and verified with Google Antigravity (Gemini 4 Neon). All code changes, failing-first and post-fix unit tests, full workspace release tests, and paired 60 s RTX 4060 smoke runs were reviewed and executed locally.