Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
atlv24 committed Jan 11, 2025
1 parent e1a6713 commit 0385bb6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
4 changes: 1 addition & 3 deletions naga/src/back/msl/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,7 @@ impl TypedGlobalVariable<'_> {
let (space, access, reference) = match var.space.to_msl_name() {
Some(space) if self.reference => {
let access = if var.space.needs_access_qualifier()
&& !self
.usage
.intersects(valid::GlobalUse::WRITE | valid::GlobalUse::ATOMIC)
&& !self.usage.intersects(valid::GlobalUse::WRITE)
{
"const"
} else {
Expand Down
3 changes: 0 additions & 3 deletions naga/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2023,9 +2023,6 @@ pub enum Statement {
///
/// Doing atomics on images with mipmaps is not supported, so there is no
/// `level` operand.
///
/// This statement is a barrier for any operations on the corresponding
/// [`Expression::GlobalVariable`] for this image.
ImageAtomic {
/// The image to perform an atomic operation on. This must have type
/// [`Image`]. (This will necessarily be a [`GlobalVariable`] or
Expand Down
29 changes: 29 additions & 0 deletions naga/tests/out/glsl/atomicTexture.cs_main.Compute.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#version 310 es

precision highp float;
precision highp int;

layout(local_size_x = 2, local_size_y = 1, local_size_z = 1) in;

layout(r32ui) uniform highp uimage2D _group_0_binding_0_cs;

layout(r32i) uniform highp iimage2D _group_0_binding_1_cs;


void main() {
uvec3 id = gl_LocalInvocationID;
imageAtomicMax(_group_0_binding_0_cs, ivec2(0, 0), 1u);
imageAtomicMin(_group_0_binding_0_cs, ivec2(0, 0), 1u);
imageAtomicAdd(_group_0_binding_0_cs, ivec2(0, 0), 1u);
imageAtomicAnd(_group_0_binding_0_cs, ivec2(0, 0), 1u);
imageAtomicOr(_group_0_binding_0_cs, ivec2(0, 0), 1u);
imageAtomicXor(_group_0_binding_0_cs, ivec2(0, 0), 1u);
imageAtomicMax(_group_0_binding_1_cs, ivec2(0, 0), 1);
imageAtomicMin(_group_0_binding_1_cs, ivec2(0, 0), 1);
imageAtomicAdd(_group_0_binding_1_cs, ivec2(0, 0), 1);
imageAtomicAnd(_group_0_binding_1_cs, ivec2(0, 0), 1);
imageAtomicOr(_group_0_binding_1_cs, ivec2(0, 0), 1);
imageAtomicXor(_group_0_binding_1_cs, ivec2(0, 0), 1);
return;
}

2 changes: 1 addition & 1 deletion naga/tests/out/hlsl/atomicTexture.ron
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
compute:[
(
entry_point:"cs_main",
target_profile:"cs_6_6",
target_profile:"cs_5_0",
),
],
)
2 changes: 1 addition & 1 deletion naga/tests/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ fn convert_wgsl() {
),
(
"atomicTexture",
Targets::SPIRV | Targets::METAL | Targets::HLSL | Targets::WGSL,
Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL,
),
(
"atomicOps-float32",
Expand Down

0 comments on commit 0385bb6

Please sign in to comment.