Skip to content

Commit

Permalink
metal: fix surface texture clear view
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Dec 31, 2021
1 parent a1251dc commit 55cbbde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 3 additions & 9 deletions wgpu-core/src/present.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ When this texture is presented, we remove it from the device tracker as well as
extract it from the hub.
!*/

use std::{borrow::Borrow, num::NonZeroU32};
use std::borrow::Borrow;

#[cfg(feature = "trace")]
use crate::device::trace::Action;
Expand Down Expand Up @@ -128,17 +128,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let (texture_id, status) = match unsafe { suf.raw.acquire_texture(FRAME_TIMEOUT_MS) } {
Ok(Some(ast)) => {
let clear_view_desc = hal::TextureViewDescriptor {
label: Some("clear texture view"),
label: Some("clear surface texture view"),
format: config.format,
dimension: wgt::TextureViewDimension::D2,
usage: hal::TextureUses::COLOR_TARGET,
range: wgt::ImageSubresourceRange {
aspect: wgt::TextureAspect::All,
base_mip_level: 0,
mip_level_count: NonZeroU32::new(1),
base_array_layer: 0,
array_layer_count: NonZeroU32::new(1),
},
range: wgt::ImageSubresourceRange::default(),
};
let mut clear_views = smallvec::SmallVec::new();
clear_views.push(
Expand Down
2 changes: 2 additions & 0 deletions wgpu-hal/src/metal/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ impl crate::Device<super::Api> for super::Device {
conv::map_texture_view_dimension(desc.dimension)
};

//Note: this doesn't check properly if the mipmap level count or array layer count
// is explicitly set to 1.
let raw = if raw_format == texture.raw_format
&& raw_type == texture.raw_type
&& desc.range == wgt::ImageSubresourceRange::default()
Expand Down

0 comments on commit 55cbbde

Please sign in to comment.