Skip to content

Commit

Permalink
Skip the cube compatibility on a downlevel flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Jun 1, 2021
1 parent f62d0d5 commit 0b9a860
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion wgpu-core/src/device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,14 @@ impl<B: GfxBackend> Device<B> {
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;
};

Expand Down
4 changes: 2 additions & 2 deletions wgpu-core/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ impl<B: GfxBackend> Adapter<B> {
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 {
Expand Down
4 changes: 2 additions & 2 deletions wgpu-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0b9a860

Please sign in to comment.