Remove hold of snatch write lock during present (#8608)

This commit is contained in:
Connor Fitzgerald authored and GitHub committed 2025-12-05 10:44:04 -05:00
1 parent 655441c162
commit d85408afb2
2 files changed
+11 -2

No files matched your search

+1
View File
@@ -203,6 +203,7 @@ By @cwfitzgerald in [#8609](https://github.com/gfx-rs/wgpu/pull/8609).
- The `STORAGE_READ_ONLY` texture usage is now permitted to coexist with other read-only usages. By @andyleiserson in [#8490](https://github.com/gfx-rs/wgpu/pull/8490).
- Validate that buffers are unmapped in `write_buffer` calls. By @ErichDonGubler in [#8454](https://github.com/gfx-rs/wgpu/pull/8454).
- Add WGSL parsing for mesh shaders. By @inner-daemons in [#8370](https://github.com/gfx-rs/wgpu/pull/8370).
- Shorten critical section inside present such that the snatch write lock is no longer held during present, preventing other work happening on other threads. By @cwfitzgerald in [#8608](https://github.com/gfx-rs/wgpu/pull/8608).
#### naga
+10 -2
View File
@@ -293,7 +293,11 @@ impl Surface {
.take()
.ok_or(SurfaceError::AlreadyAcquired)?;
let result = match texture.inner.snatch(&mut device.snatchable_lock.write()) {
let mut exclusive_snatch_guard = device.snatchable_lock.write();
let inner = texture.inner.snatch(&mut exclusive_snatch_guard);
drop(exclusive_snatch_guard);
let result = match inner {
None => return Err(SurfaceError::TextureDestroyed),
Some(resource::TextureInner::Surface { raw }) => {
let raw_surface = self.raw(device.backend()).unwrap();
@@ -337,7 +341,11 @@ impl Surface {
.take()
.ok_or(SurfaceError::AlreadyAcquired)?;
match texture.inner.snatch(&mut device.snatchable_lock.write()) {
let mut exclusive_snatch_guard = device.snatchable_lock.write();
let inner = texture.inner.snatch(&mut exclusive_snatch_guard);
drop(exclusive_snatch_guard);
match inner {
None => return Err(SurfaceError::TextureDestroyed),
Some(resource::TextureInner::Surface { raw }) => {
let raw_surface = self.raw(device.backend()).unwrap();