diff --git a/d3d12/crates/leonida-gpu/src/host.rs b/d3d12/crates/leonida-gpu/src/host.rs index c5e110d4f0..462c954739 100644 --- a/d3d12/crates/leonida-gpu/src/host.rs +++ b/d3d12/crates/leonida-gpu/src/host.rs @@ -6088,7 +6088,19 @@ impl Host { /// Whether the host GPU supports the depth bounds test; logged once. pub(crate) fn depth_bounds(&self) -> bool { static BOUNDS: OnceLock = OnceLock::new(); + // A software adapter answers that it supports the test and then does not gate the draw: + // `OMSetDepthBounds` is accepted and every fragment passes (measured on WARP, which is + // what a CI runner without a card gets, and the same frame reads back 255 instead of 0). + // The query is right about the API surface and wrong about the driver, so the answer is + // no for a software adapter. + // Asked once: every `OMSetDepthBounds` and every replayed list comes here. *BOUNDS.get_or_init(|| { + if crate::indirect::adapter_of(&self.device) + .is_some_and(|d| d.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0) + { + tracing::info!(supported = false, "host depth bounds support (a software adapter)"); + return false; + } let mut options = D3D12_FEATURE_DATA_D3D12_OPTIONS2::default(); // SAFETY: writes `options` of the given size. let ok = unsafe { diff --git a/d3d12/crates/leonida-gpu/src/indirect.rs b/d3d12/crates/leonida-gpu/src/indirect.rs index 2ba5eda57e..a5634f039a 100644 --- a/d3d12/crates/leonida-gpu/src/indirect.rs +++ b/d3d12/crates/leonida-gpu/src/indirect.rs @@ -326,7 +326,7 @@ fn widest(device: &ID3D12Device) -> u32 { const WIDE: u32 = 1 << 20; /// The description of `device`'s adapter. -fn adapter_of(device: &ID3D12Device) -> Option { +pub(crate) fn adapter_of(device: &ID3D12Device) -> Option { use windows::Win32::Graphics::Dxgi::{CreateDXGIFactory2, DXGI_CREATE_FACTORY_FLAGS, IDXGIAdapter1, IDXGIFactory4}; // SAFETY: plain queries. unsafe {