Skip to content

Commit

Permalink
revert clear op for nv12 texture
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaopengli89 committed Oct 26, 2023
1 parent 9d43522 commit 263920f
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions wgpu-core/src/device/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,33 +773,26 @@ impl<A: HalApi> Device<A> {
);

let mut clear_views = SmallVec::new();
let plane_count = if desc.format == wgt::TextureFormat::NV12 {
2
} else {
1
};
for mip_level in 0..desc.mip_level_count {
for array_layer in 0..desc.size.depth_or_array_layers {
for plane in 0..plane_count {
let desc = hal::TextureViewDescriptor {
label: clear_label,
format: desc.format,
dimension,
usage,
range: wgt::ImageSubresourceRange {
aspect: wgt::TextureAspect::All,
base_mip_level: mip_level,
mip_level_count: Some(1),
base_array_layer: array_layer,
array_layer_count: Some(1),
},
plane,
};
clear_views.push(
unsafe { self.raw.create_texture_view(&raw_texture, &desc) }
.map_err(DeviceError::from)?,
);
}
let desc = hal::TextureViewDescriptor {
label: clear_label,
format: desc.format,
dimension,
usage,
range: wgt::ImageSubresourceRange {
aspect: wgt::TextureAspect::All,
base_mip_level: mip_level,
mip_level_count: Some(1),
base_array_layer: array_layer,
array_layer_count: Some(1),
},
plane: 0,
};
clear_views.push(
unsafe { self.raw.create_texture_view(&raw_texture, &desc) }
.map_err(DeviceError::from)?,
);
}
}
resource::TextureClearMode::RenderPass {
Expand Down

0 comments on commit 263920f

Please sign in to comment.