Skip to content

Commit

Permalink
fix(core): validate dst_buffer isn't destroyed when resolving query…
Browse files Browse the repository at this point in the history
… sets
  • Loading branch information
ErichDonGubler committed Nov 21, 2024
1 parent 5ca92bf commit c70f54c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148]
- Lower `QUERY_SET_MAX_QUERIES` (and enforced limits) from 8192 to 4096 to match WebGPU spec. By @ErichDonGubler in [#6525](https://github.com/gfx-rs/wgpu/pull/6525).
- Allow non-filterable float on texture bindings never used with samplers when using a derived bind group layout. By @ErichDonGubler in [#6531](https://github.com/gfx-rs/wgpu/pull/6531/).
- Replace potentially unsound usage of `PreHashedMap` with `FastHashMap`. By @jamienicol in [#6541](https://github.com/gfx-rs/wgpu/pull/6541).
- Reject destroyed buffers in query set resolution. By @ErichDonGubler in #????.

#### Naga

Expand Down
5 changes: 3 additions & 2 deletions wgpu-core/src/command/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,14 @@ impl Global {

dst_buffer.same_device_as(cmd_buf.as_ref())?;

let snatch_guard = dst_buffer.device.snatchable_lock.read();
dst_buffer.check_destroyed(&snatch_guard)?;

let dst_pending = cmd_buf_data
.trackers
.buffers
.set_single(&dst_buffer, hal::BufferUses::COPY_DST);

let snatch_guard = dst_buffer.device.snatchable_lock.read();

let dst_barrier = dst_pending.map(|pending| pending.into_hal(&dst_buffer, &snatch_guard));

dst_buffer
Expand Down

0 comments on commit c70f54c

Please sign in to comment.