Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip the cube compatibility on a downlevel flag #1419

Merged
merged 1 commit into from
Jun 1, 2021
Merged
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
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
3 changes: 2 additions & 1 deletion wgpu-core/src/device/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,8 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
log::trace!("Device after submission {}: {:#?}", submit_index, trackers);
drop(trackers);
if !required_buffer_inits.map.is_empty() {
device.initialize_buffer_memory(required_buffer_inits, &mut *buffer_guard)?;
device
.initialize_buffer_memory(required_buffer_inits, &mut *buffer_guard)?;
}
}

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 @@ -322,6 +322,10 @@ impl<B: GfxBackend> Adapter<B> {
wgt::DownlevelFlags::NON_POWER_OF_TWO_MIPMAPPED_TEXTURES,
properties.downlevel.non_power_of_two_mipmapped_textures,
);
downlevel_flags.set(
wgt::DownlevelFlags::CUBE_ARRAY_TEXTURES,
adapter_features.contains(hal::Features::IMAGE_CUBE_ARRAY),
);
downlevel_flags.set(
wgt::DownlevelFlags::ANISOTROPIC_FILTERING,
private_features.anisotropic_filtering,
Expand Down
4 changes: 3 additions & 1 deletion wgpu-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,10 @@ 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 textures that are cube arrays.
const CUBE_ARRAY_TEXTURES = 0x0000_0020;
/// Supports samplers with anisotropic filtering
const ANISOTROPIC_FILTERING = 0x0000_0020;
const ANISOTROPIC_FILTERING = 0x0001_0000;
/// All flags are in their compliant state.
const COMPLIANT = 0x0000_003F;
}
Expand Down