Skip to content
Open
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
12 changes: 12 additions & 0 deletions d3d12/crates/leonida-gpu/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> = 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 {
Expand Down
2 changes: 1 addition & 1 deletion d3d12/crates/leonida-gpu/src/indirect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<windows::Win32::Graphics::Dxgi::DXGI_ADAPTER_DESC1> {
pub(crate) fn adapter_of(device: &ID3D12Device) -> Option<windows::Win32::Graphics::Dxgi::DXGI_ADAPTER_DESC1> {
use windows::Win32::Graphics::Dxgi::{CreateDXGIFactory2, DXGI_CREATE_FACTORY_FLAGS, IDXGIAdapter1, IDXGIFactory4};
// SAFETY: plain queries.
unsafe {
Expand Down
Loading