HLE: bridge ID3D12Device before direct ResetDevice and cache D3D11 companion #1667
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1677"
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 eizispark on 2026-11-24T19:12:21Z.
MFResetDXGIDeviceManagerXpreviously tried callingIMFDXGIDeviceManager::ResetDevicedirectly withpDevicebefore checking whetherpDeviceimplementsID3D12Device. Under XCL'snullD3D12 backend (NullObj::QueryInterfaceanswersS_OKto every IID, includingIID_ID3D11DeviceandIID_ID3D10Multithread), systemmfplat.dllacceptedNullObjdirectly and stored it insideIMFDXGIDeviceManager, causing subsequentLockDevice(IID_ID3D11Device)calls to fail withMF_E_UNEXPECTED(0xC00D36BB).In addition,
MFResetDXGIDeviceManagerXcreated a new companionID3D11Device(D3D11CreateDevice+VIDEO_SUPPORT) on every call rather than reusing the companion D3D11 device for the adapter LUID.What is in it
crates/xcl/src/hle/mfplat.rs: checkdevice_unk.cast::<ID3D12Device>()before falling back to directIMFDXGIDeviceManager::ResetDevice, cache multithread-protected companionID3D11Deviceinstances per adapter LUID (recreating only ifID3D11Device::GetDeviceRemovedReasonat vtable slot 39 reports removal), and addnull_d3d12_device_bridges_to_real_d3d11_and_reuses_companion_per_luidcovering both thenullD3D12 backend and hardwareID3D12DeviceLUID caching.Tested
32.0.32015.16001), AMD Ryzen 7 9800X3D, Windows 11 x64,rustc 1.100.0 (0ef1bc386 2026-11-09)(stable-x86_64-pc-windows-msvc), debug (unit + workspace tests) and release (60 s title smoke).cargo test -p xcl --lib mfplat: 4 passed, 0 failed, 0 ignored (null_d3d12_device_bridges_to_real_d3d11_and_reuses_companion_per_luidverified failing with0xC00D36BB(MF_E_UNEXPECTED) before the fix).cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 777 passed, 0 failed, 41 ignored (SKIPPED GPU/SDK tests: 3 —test_title_draws_with_a_root_signature_under_the_debug_layer: nod3d12SDKLayers.dll;heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows;uploads_start_from_each_subresources_state: no D3D12 debug layer).Regression run
main(9e3831e1f570d3646e53ab753b19ec07eb8f1485):PR (
8c441777a6c06197b00baca498790ae02f4154f5):Not tested
MFResetDXGIDeviceManagerX+MFSourceReader/ hardware MFTs) undergraphics = "null"or Linux / Wine.d3d12SDKLayers.dllnot installed on this machine).AI use
mfplat.rsandd3d11.h(ID3D11DeviceVtbl), wrote the regression test and fix, ran the workspace test suite andscripts/smoke.ps1runs, and drafted this PR description.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T21:37:43Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by frenziedcoder on 2026-11-24T21:54:42Z.
NVIDIA test report for
8c44177: the full workspace and a smoke pair on the retail title, next to @DavidM1911's RTX 3060 Ti library run above. Full suite green, the PR's own test passes, and a clean smoke pair (1654 vs 1655 frames).Tested
stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (SDK 10.0.26100.0). Exact head8c441777a6c06197b00baca498790ae02f4154f5, no local changes.cargo build --workspace && cargo test --workspace -- --test-threads=4(debug): 777 passed, 0 failed, 41 ignored; the PR's own test passes. SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).test_title_draws_with_a_root_signature_under_the_debug_layerreports ok, but this machine has no D3D12 debug layer (debug layer requested but unavailable … (0x887A002D)), so it ran without the layer and is no evidence either way.Regression run (
scripts/smoke.ps1 -Seconds 60, release, the retail title of #505 at its start screen;XCL_PSO_PRELOAD=0for both builds, because this machine's preload list holds the program of #1307)base (
9e3831e, this PR's merge base withmain):this PR:
Not tested: hardware Media Foundation video playback;
graphics = "null"; the debug-layer test (see above); Linux / Wine; AMD.AI use: Claude Code (Claude Opus 5.5) built and ran the tests and smoke runs on my machine and wrote this report; I checked it.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T04:38:03Z.
XCL PR #1677 verification
Head
8c441777a6c06197b00baca498790ae02f4154f5, clean detached checkout. The PR changescrates/xcl/src/hle/mfplat.rsonly.STOR-WINLAB ran Windows 11 Enterprise Evaluation x64, build 26200, on an AMD Family 23 Model 113 CPU with Intel Arc A770 Graphics and driver 32.0.101.9175. DXC was 1.9.2609.5. Rust was 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc).
Tested
cargo build --workspaceandcargo test --workspace --no-runboth exited 0 outside the Arc mutex. The latter built 19 test executables.cargo test -p xcl --lib hle::mfplat::tests -- --test-threads=1ran underInvoke-ArcTest.ps1withXCL_ADAPTER=A770. All 4 passed, with 0 failed, 0 ignored and no skip markers. For both null and hardware D3D12 inputs, the new test locked a genuine D3D11 device and confirmed the same COM identity across two Media Foundation managers for each LUID. The token test rejected an invalid token and checked device-handle usability after a valid reset. The other tests checked null arguments and export routing.cargo test --workspace --no-fail-fast -- --test-threads=4ran once under the same mutex and adapter setting withRUST_TEST_NOCAPTURE=1. Cargo exited 101. The 20 summaries inpr1677-suite.logcover 19 test binaries and 1 doctest target and total 761 passed, 16 failed and 41 ignored. The bundled title logged a passing MFPlat reset check.Workspace failures and skips
The library had 15 shader-recompiler failures. Eleven reported
CreateComputePipelineStatereturning0x80070057, and four reported output mismatches. The end-to-end title test failed its dynamic depth-bias check. The log contains 6 lines beginning withSKIPPED. Two cited wave64, two cited the D3D12 debug layer, one cited tiled resource tier and one cited heap windows. Those skips provide no coverage.Not tested
A matched main run, retail-title smoke or playback, other GPU vendors, and forced device removal during a companion reset.
AI use
T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr1677-suite.logand published.Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-26T17:18:14Z.
NVIDIA and AMD full-suite run, to go with the reports above by JJAutoCompare, frenziedcoder, since none of them covers AMD. Tested exact head
8c441777(on its base9e3831e).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 776 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.null_d3d12_device_bridges_to_real_d3d11_and_reuses_companion_per_luid.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 777 passed, 0 failed, 41 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main8b957bectoo, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:29:03Z.
Triage (#1607) – head
8c44177No open or merged PR makes the same change (main's
MFResetDXGIDeviceManagerXincrates/xcl/src/hle/mfplat.rsstill tries the directResetDevicefirst, which the null backend's every-IIDQueryInterfacepasses).Points in the diff: a real
ID3D12Deviceis now always bridged to the companion D3D11 device, even on Windows builds whose manager accepts it directly, so a title that later locks the device asID3D12Devicegets a D3D11 one. Ind3d11_bridge_for_luid, the cached pointer is used outside the lock (d3d11_device_aliveon a borrowed raw pointer) while another thread may remove and release it.HLE:is not one of the repository's commit areas.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.