mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
metal: fix surface texture clear view
This commit is contained in:
committed by
Dzmitry Malyshau
parent
a1251dc36a
commit
55cbbdea62
@@ -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;
|
||||
@@ -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(
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user