From 0b9a86006b869d7b9e6eb0dd127f3f7d7de8f33b Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Mon, 31 May 2021 20:16:04 -0400 Subject: [PATCH] Skip the cube compatibility on a downlevel flag --- wgpu-core/src/device/mod.rs | 9 ++++++++- wgpu-core/src/instance.rs | 4 ++-- wgpu-types/src/lib.rs | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index 5ba4dc19002..8d1db631cd7 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -681,7 +681,14 @@ impl Device { let mut view_caps = hal::image::ViewCapabilities::empty(); // 2D textures with array layer counts that are multiples of 6 could be cubemaps // Following gpuweb/gpuweb#68 always add the hint in that case - if desc.dimension == TextureDimension::D2 && desc.size.depth_or_array_layers % 6 == 0 { + if desc.dimension == TextureDimension::D2 + && desc.size.depth_or_array_layers % 6 == 0 + && (desc.size.depth_or_array_layers == 6 + || self + .downlevel + .flags + .contains(wgt::DownlevelFlags::CUBE_ARRAY_TEXTURES)) + { view_caps |= hal::image::ViewCapabilities::KIND_CUBE; }; diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index f40ac6cd44a..ea09a85986c 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -323,8 +323,8 @@ impl Adapter { properties.downlevel.non_power_of_two_mipmapped_textures, ); downlevel_flags.set( - wgt::DownlevelFlags::ANISOTROPIC_FILTERING, - private_features.anisotropic_filtering, + wgt::DownlevelFlags::CUBE_ARRAY_TEXTURES, + adapter_features.contains(hal::Features::IMAGE_CUBE_ARRAY), ); let downlevel = wgt::DownlevelProperties { diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index dfd062c7d9d..329718d65fe 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -693,8 +693,8 @@ bitflags::bitflags! { const DEVICE_LOCAL_IMAGE_COPIES = 0x0000_0008; /// Supports textures with mipmaps which have a non power of two size. const NON_POWER_OF_TWO_MIPMAPPED_TEXTURES = 0x0000_0010; - /// Supports samplers with anisotropic filtering - const ANISOTROPIC_FILTERING = 0x0000_0020; + /// Supports textures that are cube arrays. + const CUBE_ARRAY_TEXTURES = 0x0000_0020; /// All flags are in their compliant state. const COMPLIANT = 0x0000_003F; }