Skip to content

Commit

Permalink
call clear_texture in initialize_texture_memory with a single range a…
Browse files Browse the repository at this point in the history
…t a time
  • Loading branch information
Wumpf committed Sep 7, 2021
1 parent e793a51 commit 533a2f8
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions wgpu-core/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl<A: hal::Api> BakedCommands<A> {
device_tracker: &mut TrackerSet,
texture_guard: &mut Storage<Texture<A>, id::TextureId>,
) -> Result<(), DestroyedTextureError> {
let mut ranges = Vec::new();
let mut ranges: Vec<TextureInitRange> = Vec::new();
for texture_use in self.texture_memory_init_actions.drain(..) {
let texture = texture_guard
.get_mut(texture_use.id)
Expand Down Expand Up @@ -227,20 +227,17 @@ impl<A: hal::Api> BakedCommands<A> {
);
self.encoder.clear_texture(
raw_texture,
&ranges
.iter()
.map(|r| wgt::ImageSubresourceRange {
aspect: wgt::TextureAspect::All,
base_mip_level: r.mip_range.start,
mip_level_count: NonZeroU32::new(
r.mip_range.end - r.mip_range.start,
),
base_array_layer: r.layer_range.start,
array_layer_count: NonZeroU32::new(
r.layer_range.end - r.layer_range.start,
),
})
.collect::<Vec<wgt::ImageSubresourceRange>>(),
&wgt::ImageSubresourceRange {
aspect: wgt::TextureAspect::All,
base_mip_level: range.mip_range.start,
mip_level_count: NonZeroU32::new(
range.mip_range.end - range.mip_range.start,
),
base_array_layer: range.layer_range.start,
array_layer_count: NonZeroU32::new(
range.layer_range.end - range.layer_range.start,
),
},
);
}
}
Expand Down

0 comments on commit 533a2f8

Please sign in to comment.