From 44fdfb80d0173788536be8bb2711ffe4ccb0752d Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Thu, 13 Aug 2020 17:26:44 -0400 Subject: [PATCH] Fix support for d24unorm format --- wgpu-core/src/conv.rs | 4 ++-- wgpu-core/src/instance.rs | 4 ++++ wgpu-core/src/lib.rs | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wgpu-core/src/conv.rs b/wgpu-core/src/conv.rs index 633c3fa6bd..d8cff595ed 100644 --- a/wgpu-core/src/conv.rs +++ b/wgpu-core/src/conv.rs @@ -370,8 +370,8 @@ pub(crate) fn map_texture_format( // Depth and stencil formats Tf::Depth32Float => H::D32Sfloat, Tf::Depth24Plus => { - if private_features.texture_d24_s8 { - H::D24UnormS8Uint + if private_features.texture_d24 { + H::X8D24Unorm } else { H::D32Sfloat } diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index 6a40726549..885ff5056b 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -744,6 +744,10 @@ impl Global { let private_features = PrivateFeatures { shader_validation: desc.shader_validation, anisotropic_filtering: enabled_features.contains(hal::Features::SAMPLER_ANISOTROPY), + texture_d24: phd + .format_properties(Some(hal::format::Format::X8D24Unorm)) + .optimal_tiling + .contains(hal::format::ImageFeature::DEPTH_STENCIL_ATTACHMENT), texture_d24_s8: phd .format_properties(Some(hal::format::Format::D24UnormS8Uint)) .optimal_tiling diff --git a/wgpu-core/src/lib.rs b/wgpu-core/src/lib.rs index 0e992cadfd..30ea6a252b 100644 --- a/wgpu-core/src/lib.rs +++ b/wgpu-core/src/lib.rs @@ -199,6 +199,7 @@ struct Stored { struct PrivateFeatures { shader_validation: bool, anisotropic_filtering: bool, + texture_d24: bool, texture_d24_s8: bool, }