Skip to content

Commit

Permalink
Fix out of bounds access when surface texture is written to by multip…
Browse files Browse the repository at this point in the history
…le command buffers
  • Loading branch information
cwfitzgerald committed Jul 3, 2022
1 parent aaabd56 commit 7d85efb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions wgpu-core/src/device/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,14 +773,15 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
//Note: locking the trackers has to be done after the storages
let mut trackers = device.trackers.lock();

used_surface_textures.set_size(texture_guard.len());

//TODO: if multiple command buffers are submitted, we can re-use the last
// native command buffer of the previous chain instead of always creating
// a temporary one, since the chains are not finished.

// finish all the command buffers first
for &cmb_id in command_buffer_ids {
// we reset the used surface textures every time we use it, so make sure to set_size on it.
used_surface_textures.set_size(texture_guard.len());

#[allow(unused_mut)]
let mut cmdbuf = match hub
.command_buffers
Expand Down

0 comments on commit 7d85efb

Please sign in to comment.