Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/xcl/src/hle/d3d12x/real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions crates/xcl/src/hle/d3d12x/sparse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<IDXGIFactory4>() else { return false };
let adapter: windows::core::Result<IDXGIAdapter1> = 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
Expand Down
12 changes: 7 additions & 5 deletions crates/xcl/tests/d3d12_mesh_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -91,11 +91,13 @@ fn console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly() {
SizeInBytes: std::mem::size_of::<AsOnly>(),
pPipelineStateSubobjectStream: &st as *const _ as *mut c_void,
};
let err = unsafe { d2.CreatePipelineState::<ID3D12PipelineState>(&desc) }.expect_err("MS in AS slot must be refused");
let err = unsafe { d2.CreatePipelineState::<ID3D12PipelineState>(&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
);

Expand Down
Loading