diff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs index 757ee9c1c5..eb20fa5c8e 100644 --- a/crates/xcl/src/hle/d3d12x/real.rs +++ b/crates/xcl/src/hle/d3d12x/real.rs @@ -10760,9 +10760,15 @@ mod release_tests { } n } + // (the last release asks for the desc, to log a buffer's address: a texture's has none) + unsafe extern "system" fn get_desc(_this: *mut c_void, out: *mut D3D12_RESOURCE_DESC) -> *mut D3D12_RESOURCE_DESC { + *out = D3D12_RESOURCE_DESC { Dimension: D3D12_RESOURCE_DIMENSION_TEXTURE2D, ..Default::default() }; + out + } let mut orig = [0usize; 12]; orig[1] = add_ref as usize; orig[2] = release as usize; + orig[pc_slot!("ID3D12Resource", "GetDesc")] = get_desc as usize; let mut ext = vec![0usize; 13]; ext[0] = orig.as_ptr() as usize; ext[1..].copy_from_slice(&orig); diff --git a/crates/xcl/src/hle/d3d12x/sparse.rs b/crates/xcl/src/hle/d3d12x/sparse.rs index f866cbca39..bc72aa86c3 100644 --- a/crates/xcl/src/hle/d3d12x/sparse.rs +++ b/crates/xcl/src/hle/d3d12x/sparse.rs @@ -5667,12 +5667,13 @@ mod tests { dev.expect("D3D12 device") } - /// Whether `dev` is a software device (WARP). + /// Whether `dev` is a software device (WARP, or the Microsoft Basic Render Driver CI runs on, + /// which is the default adapter there and need not carry DXGI_ADAPTER_FLAG_SOFTWARE). unsafe fn software(dev: &ID3D12Device) -> bool { use windows::Win32::Graphics::Dxgi::*; let Ok(factory) = CreateDXGIFactory1::() else { return false }; let adapter: windows::core::Result = factory.EnumAdapterByLuid(dev.GetAdapterLuid()); - adapter.and_then(|a| a.GetDesc1()).is_ok_and(|d| d.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0) + adapter.and_then(|a| a.GetDesc1()).is_ok_and(|d| d.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0 || (d.VendorId, d.DeviceId) == (0x1414, 0x8c)) } /// The small ones of an upload's runs go up in dispatches: each lands where it belongs (far diff --git a/crates/xcl/tests/d3d12_mesh_stream.rs b/crates/xcl/tests/d3d12_mesh_stream.rs index d742ee26d0..3a9cdbdd0a 100644 --- a/crates/xcl/tests/d3d12_mesh_stream.rs +++ b/crates/xcl/tests/d3d12_mesh_stream.rs @@ -2,8 +2,8 @@ //! (`d3d12x::real::dev_create_pipeline_state` / `translated_mesh_stream`), with no game data. //! //! Runs on any D3D12 adapter (AMD, NVIDIA, Intel, or WARP) with zero vendor-specific skips: -//! 1. Synthetic console MS placed in the AS slot with no MS slot is refused cleanly with -//! `E_INVALIDARG` and records the `"in the AS slot – refused"` error. +//! 1. Synthetic console MS placed in the AS slot with no MS slot is taken as the mesh shader +//! (#541) and, having no NGG variant, refused cleanly with `E_INVALIDARG` by its translation. //! 2. Synthetic console MS paired with an AS subobject is refused cleanly with `E_INVALIDARG`. //! 3. Empty, truncated, unknown-subobject, and unreadable-shader pipeline streams fail cleanly //! without panicking or crashing. @@ -91,11 +91,13 @@ fn console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly() { SizeInBytes: std::mem::size_of::(), pPipelineStateSubobjectStream: &st as *const _ as *mut c_void, }; - let err = unsafe { d2.CreatePipelineState::(&desc) }.expect_err("MS in AS slot must be refused"); + let err = unsafe { d2.CreatePipelineState::(&desc) }.expect_err("MS with no NGG variant must be refused"); assert_eq!(err.code(), E_INVALIDARG); + // since #541 it is not refused for its slot: it is translated as the MS it is, and this + // container has no NGG variant to translate assert!( - real::stats().translation_errors.iter().any(|e| e.contains("in the AS slot")), - "expected AS-slot refusal in translation_errors: {:?}", + real::stats().translation_errors.iter().any(|e| e.starts_with("MS: ")), + "expected the MS translation's refusal in translation_errors: {:?}", real::stats().translation_errors );