Skip to content

Commit

Permalink
Merge gfx-rs#876
Browse files Browse the repository at this point in the history
876: Fix support for d24unorm format r=kvark a=kvark

**Connections**
fixes kvark/vange-rs#121 on some platforms

**Description**
We used to associate `D24Plus` with internal `D24S8`. This results in assuming that it has both DEPTH + STENCIL. Creating a binding from it then fails with the `All` aspect, since you can't view both. This is unexpected, since the user creates `D24Plus` with just a single aspect.

**Testing**
None needed

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
  • Loading branch information
bors[bot] and kvark authored Aug 13, 2020
2 parents 92aaa2b + 44fdfb8 commit 7e8b51b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wgpu-core/src/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions wgpu-core/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,10 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
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
Expand Down
1 change: 1 addition & 0 deletions wgpu-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ struct Stored<T> {
struct PrivateFeatures {
shader_validation: bool,
anisotropic_filtering: bool,
texture_d24: bool,
texture_d24_s8: bool,
}

Expand Down

0 comments on commit 7e8b51b

Please sign in to comment.