From 97a274daa3c247ba668d173d569a0f4fbfe0bc1b Mon Sep 17 00:00:00 2001 From: Jasper Bekkers Date: Fri, 26 Feb 2021 14:46:57 +0100 Subject: [PATCH] Safeness bug in StorageImage2d::write It's pretty easy to see why this is unsafe, if multiple threads write to the same coordinate race-conditions happen. Ultimately this should be addressed through something like #216 and some higher level abstractions on top of our buffer types, but since we don't have those for now, marking this as unsafe seems to be the only thing we can do for now. --- crates/spirv-std/src/textures.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/spirv-std/src/textures.rs b/crates/spirv-std/src/textures.rs index f8e54497a8..06482d6fd3 100644 --- a/crates/spirv-std/src/textures.rs +++ b/crates/spirv-std/src/textures.rs @@ -89,7 +89,7 @@ impl StorageImage2d { /// Write a texel to an image without a sampler. #[spirv_std_macros::gpu_only] - pub fn write(&self, coordinate: V, texels: V2) + pub unsafe fn write(&self, coordinate: V, texels: V2) where I: Integer, V: Vector,