Skip to content

Commit e9bff0f

Browse files
fix STATUS_HEAP_CORRUPTION crash in create_sampler (#8056)
A backport of #8043. Co-authored-by: Erich Gubler <[email protected]>
1 parent f01af23 commit e9bff0f

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ Bottom level categories:
4040

4141
## Unreleased
4242

43+
## v26.0.4 (2025-08-06)
44+
45+
### Bug Fixes
46+
47+
#### Vulkan
48+
49+
Fix `STATUS_HEAP_CORRUPTION` crash when concurrently calling `create_sampler`. By @atlv24 in [#8043](https://github.com/gfx-rs/wgpu/pull/8043).
50+
4351
## v26.0.3 (2025-07-30)
4452

4553
### 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)