Skip to content

Commit 7cb642e

Browse files
fix STATUS_HEAP_CORRUPTION crash in create_sampler (#8043)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
1 parent a116861 commit 7cb642e

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ By @Vecvec in [#7913](https://github.com/gfx-rs/wgpu/pull/7913).
6363

6464
Naga now requires that no type be larger than 1 GB. This limit may be lowered in the future; feedback on an appropriate value for the limit is welcome. By @andyleiserson in [#7950](https://github.com/gfx-rs/wgpu/pull/7950).
6565

66+
### Bug Fixes
67+
68+
#### Vulkan
69+
70+
Fix `STATUS_HEAP_CORRUPTION` crash when concurrently calling `create_sampler`. By @atlv24 in [#8043](https://github.com/gfx-rs/wgpu/pull/8043).
71+
6672
## v26.0.2 (2025-07-23)
6773

6874
### Bug Fixes

wgpu-hal/src/vulkan/device.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,19 +1404,21 @@ impl crate::Device for super::Device {
14041404
create_info = create_info.border_color(conv::map_border_color(color));
14051405
}
14061406

1407-
let raw = self
1408-
.shared
1409-
.sampler_cache
1410-
.lock()
1411-
.create_sampler(&self.shared.raw, create_info)?;
1407+
let mut sampler_cache_guard = self.shared.sampler_cache.lock();
1408+
1409+
let raw = sampler_cache_guard.create_sampler(&self.shared.raw, create_info)?;
14121410

14131411
// Note: Cached samplers will just continually overwrite the label
14141412
//
14151413
// https://github.com/gfx-rs/wgpu/issues/6867
14161414
if let Some(label) = desc.label {
1415+
// SAFETY: we are holding a lock on the sampler cache,
1416+
// so we can only be setting the name from one thread.
14171417
unsafe { self.shared.set_object_name(raw, label) };
14181418
}
14191419

1420+
drop(sampler_cache_guard);
1421+
14201422
self.counters.samplers.add(1);
14211423

14221424
Ok(super::Sampler { raw, create_info })

0 commit comments

Comments
 (0)