Repository navigation
D3D12.X: fix null UAV fallback and MSAA/typeless companion SRVs - #2511
ChalanaGimhanaX wants to merge 1 commit into
Conversation
|
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
|
On a machine without the D3D12 debug layer, Head
The cause is the forwarding loop in the parent test: for line in stderr.lines().filter(|l| l.starts_with("SKIPPED ")) {
eprintln!("{line}");
}libtest captures use std::io::Write;
let _ = writeln!(std::io::stderr(), "{line}");I have not built or run that change. AI use: Claude Code (Claude Opus 5.5) found this while testing the PR on this machine and wrote this comment. |
luckyteagirl
left a comment
There was a problem hiding this comment.
Could the companion SRV and the console T# use the same normalized descriptor? For a 4x MSAA texture with an explicit TEXTURE2D UAV descriptor, the new code publishes a TEXTURE2DMS SRV, but dev_create_uav_x still builds the T# from the original UAV dimension and labels it non-MSAA. With a default UAV descriptor, the T# gets the MSAA type but hardcodes one mip, which encodes LAST_LEVEL=0 instead of 2 for four samples.
The existing srv_tsharp_from_desc helper can build the metadata from the normalized native SRV and the actual sample count. A focused fixture could check the published SRV dimension and decoded T# type and sample count for both descriptor forms. Exact-head source review of ba93ea4418e3b8440fc563ad3b270e4f328cd166. No GPU run. AI-assisted review with Codex.
…cl-dev#2511) (cherry picked from commit 56085f55cfaad3c006146e812b154893d2140681)
|
Independent test report under Wine/Proton (not native Windows) for head Setup
Tests (debug,
Retail title, 300 s (release, from a copy of the same warm-cache snapshot;
Not tested
AI use
|
|
merge-check
|
|
merge-check claim |
|
merge-check |
|
Following the blocking merge check, here is a narrow candidate for the console-descriptor mismatch on head Candidate descriptor diffdiff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs
@@
g(this, srv_res, &srv, slot.pc_srv);
super::console_heap::publish(&slot, false);
+ if !deny_srv && matches!(
+ srv.ViewDimension,
+ D3D12_SRV_DIMENSION_TEXTURE2DMS | D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY
+ ) {
+ if let Some(t) = srv_tsharp_from_desc(slot.index, &rd, Some(&srv)) {
+ return super::console_heap::write(&slot, &t);
+ }
+ }
}This leaves the existing UAV T# path in place for ordinary views and the null companion case. Please extend the tests to decode the published T# for explicit and default 4× 2D and 2D-array views: the type should match the companion SRV, This candidate was checked against the source, but not applied, compiled, or run on a GPU. AI use: Codex (GPT-6.2 Sol) traced the call path and drafted the diff; Codex (GPT-6.2 Astra) independently checked the encoder and test gap. |
|
merge-check |
|
Follow-up to my candidate correction, tested against PR head I added a GPU regression comparing the entire console T# with the T# for the companion SRV actually published. It covers default and explicit UAVs for Texture2DMS and Texture2DMSArray. The debug-layer test failed on the unchanged PR merge (0 passed, 1 failed; slot 3's T# differed). With the small correction below, Tested candidate correction and regressiondiff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs
@@ -3839,6 +3839,11 @@ unsafe extern "system" fn dev_create_uav_x(this: *mut c_void, res: *mut c_void,
g(this, srv_res, &srv, slot.pc_srv);
super::console_heap::publish(&slot, false, srv_res as usize);
+ if !deny_srv && matches!(srv.ViewDimension, D3D12_SRV_DIMENSION_TEXTURE2DMS | D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY) {
+ if let Some(t) = srv_tsharp_from_desc(slot.index, &rd, Some(&srv)) {
+ return super::console_heap::write(&slot, &t);
+ }
+ }
}
@@ -14939,7 +14944,14 @@ void main() {
- let Ok(dev) = crate::gpu::agility::create_device(None, D3D_FEATURE_LEVEL_11_0) else {
+ let warp = if std::env::var("XCL_ADAPTER").as_deref() == Ok("warp") {
+ use windows::Win32::Graphics::Dxgi::{CreateDXGIFactory1, IDXGIAdapter, IDXGIFactory4};
+ let factory = CreateDXGIFactory1::<IDXGIFactory4>().expect("DXGI factory");
+ Some(factory.EnumWarpAdapter::<IDXGIAdapter>().expect("WARP adapter").cast::<windows::core::IUnknown>().expect("WARP IUnknown"))
+ } else {
+ None
+ };
+ let Ok(dev) = crate::gpu::agility::create_device(warp.as_ref(), D3D_FEATURE_LEVEL_11_0) else {
@@ -15040,9 +15052,34 @@ void main() {
dev_create_uav_x(dev.as_raw(), ms2da.as_raw(), std::ptr::null_mut(), &u_ms2da, slot_cpu(4));
+ let u_ms2d = D3D12_UNORDERED_ACCESS_VIEW_DESC {
+ Format: DXGI_FORMAT_R8G8B8A8_UNORM,
+ ViewDimension: D3D12_UAV_DIMENSION_TEXTURE2D,
+ ..Default::default()
+ };
+ dev_create_uav_x(dev.as_raw(), ms2d.as_raw(), std::ptr::null_mut(), &u_ms2d, slot_cpu(7));
+ dev_create_uav_x(dev.as_raw(), ms2da.as_raw(), std::ptr::null_mut(), std::ptr::null(), slot_cpu(8));
let errs2 = take_errors(&iq);
assert!(errs2.is_empty(), "MSAA companion SRV debug errors: {errs2:#?}");
+ // The console T# must describe the SRV actually published for each MSAA UAV.
+ for (k, resource, uav) in [
+ (3, &ms2d, None),
+ (4, &ms2da, Some(&u_ms2da)),
+ (7, &ms2d, Some(&u_ms2d)),
+ (8, &ms2da, None),
+ ] {
+ let rd = resource.GetDesc();
+ let slot = super::super::console_heap::slot(slot_cpu(k)).expect("console UAV slot");
+ let srv = uav_companion_srv(Some(&rd), uav, false).expect("MSAA companion SRV");
+ let expected = srv_tsharp_from_desc(slot.index, &rd, Some(&srv)).expect("MSAA T#");
+ let mut actual = [0u32; 8];
+ std::ptr::copy_nonoverlapping(slot.at as *const u32, actual.as_mut_ptr(), 8);
+ assert_eq!(actual, expected, "console T# differs from the published MSAA companion SRV at slot {k}");
+ assert_eq!((actual[3] >> 16) & 0xf, 2, "four samples require LAST_LEVEL=2");
+ assert_eq!((actual[5] >> 4) & 0xf, 0, "MSAA views have MAX_MIP=0");
+ }This validates the descriptor correction, not the full PR for merge. The full workspace suite and paired retail smoke were not run on this uncommitted candidate. AI use: OpenAI Codex (GPT-6.2 Sol) prepared the regression, correction, and report and ran the focused tests. |
|
No open or merged PR makes the same change. #3319 sanitizes formats of null-resource SRVs/RTVs in other functions and does not touch AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
Diff review (head The
AI use: Antigravity (Gemini 4 Neon) audited the full diff against |
|
merge-check Windows / AMD RDNA4 (native D3D12) — null UAV and MSAA companion SRV checks on Clean merge onto Setup
Tested
Counts are partial because two test processes aborted on each build.
Shared failures and process aborts
Retail smoke Ran
The first run's higher startup commit did not reproduce. These exits leave frame and steady-state memory behavior unverified. Diff review The existing explicit-MSAA descriptor concern remains in the merge. Not tested Remaining workspace tests after the aborts, retail performance, and translated-shader reads through an explicit MSAA companion descriptor. AI use Codex (GPT-6) merged and built the PR, ran the tests, compared the results with |
Fix invalid null UAV fallback dimensions in
dev_create_uav_checked_xand invalid MSAA /*_TYPELESScompanion SRV descriptors inuav_companion_srv, preventingDXGI_ERROR_INVALID_CALL(0x887A0001) device removals when console titles create image UAVs on unsupported formats, MSAA textures, or non-depth typeless textures.Part of #2461 and #1833.
What is in it
crates/xcl/src/hle/d3d12x/real.rs:dev_create_uav_checked_x: reusenull_uav_desc(desc.as_ref(), Some(&rd))instead ofD3D12_UNORDERED_ACCESS_VIEW_DESC { ..Default::default() }whenpc_typed_uav_supportedreturns false, avoiding zeroArraySize/WSizeonTexture1DArray,Texture2DArray, andTexture3Dnull UAV fallbacks.null_uav_desc: ignoreViewDimension == UNKNOWN (0)so it falls back tord, and map MSAA 2DArray (7) toTexture2DArraywithArraySize = 1.uav_companion_srv+concrete_srv_format: accept MSAA dimensions (6/7) fromresource_dim_to_viewwhendesc == None, emitD3D12_SRV_DIMENSION_TEXTURE2DMS/D3D12_SRV_DIMENSION_TEXTURE2DMSARRAYwhenrd.SampleDesc.Count > 1(preventingCREATESHADERRESOURCEVIEW_INVALIDDESCandID3D12Device::RemoveDevice), and normalize any remaining*_TYPELESSor depth-only format to a concrete same-family SRV format (preventingCREATESHADERRESOURCEVIEW_INVALIDFORMAT).uav_companion_srv_tests: added unit testuav_companion_srv_msaa_typeless_and_null_uav_dimensionsand D3D12 debug-layer testgpu_uav_null_fallback_and_msaa_typeless_companion_srv_debug_layer.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.8.2502.11, release build.uav_companion_srv_msaa_typeless_and_null_uav_dimensionsfailed (MSAA 2D default companion SRVreturnedNone).gpu_uav_null_fallback_and_msaa_typeless_companion_srv_debug_layerfailed underD3D12SDKLayers.dllwithID3D12Device::CreateShaderResourceView: The base resource was created as a multisample resource. You must specify D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY or D3D12_SRV_DIMENSION_TEXTURE2DMS.followed byID3D12Device::RemoveDevice(DXGI_ERROR_INVALID_CALL).ba93ea4):cargo test --release -p xcl --lib hle::d3d12x::real::uav_companion_srv_tests:: -- --test-threads=1 --nocaptureon RTX 3060: 4 passed, 0 failed, 0 skipped (0 D3D12 debug-layer errors).XCL_ADAPTER=warp): 4 passed, 0 failed, 0 skipped (0 D3D12 debug-layer errors).cargo build --release --workspace+cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1425 passed, 0 failed, 46 ignored across 37 test binaries.SKIPPEDlines (26): 21no wave64(RTX 3060 is 32-lane), 3 per-lane refused f16/f32 forms (#1426), 1pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode required), 1heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).cargo test --release -p xcl --test e2e -- --test-threads=1: 4 passed, 0 failed.Regression run
main (
6d051da):this PR (
ba93ea4):Not tested
AI use
real.rsnull UAV fallback and MSAA/typeless companion SRV fixes and tests, ran the failing-first check, targeted GPU/WARP tests, full workspace test suite, e2e tests, and smoke run, and drafted this PR description.