Skip to content

Commit

Permalink
Safeness bug in StorageImage2d::write
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Jasper-Bekkers committed Feb 26, 2021
1 parent 98fb0e0 commit 97a274d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/spirv-std/src/textures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl StorageImage2d {

/// Write a texel to an image without a sampler.
#[spirv_std_macros::gpu_only]
pub fn write<I, V, V2, const N: usize>(&self, coordinate: V, texels: V2)
pub unsafe fn write<I, V, V2, const N: usize>(&self, coordinate: V, texels: V2)
where
I: Integer,
V: Vector<I, N>,
Expand Down

0 comments on commit 97a274d

Please sign in to comment.