summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/glsl-intrinsic/image/i64imageDim.slang476
-rw-r--r--tests/glsl-intrinsic/image/iimageDim.slang411
-rw-r--r--tests/glsl-intrinsic/image/iimageDimTiny.slang34
-rw-r--r--tests/glsl-intrinsic/image/imageAsParamWithMemoryQualifiers.slang43
-rw-r--r--tests/glsl-intrinsic/image/imageAsParamWithMemoryQualifiersError.slang27
-rw-r--r--tests/glsl-intrinsic/image/imageDim.slang303
-rw-r--r--tests/glsl-intrinsic/image/nonImageAsParamWithMemoryQualifierError.slang26
-rw-r--r--tests/glsl-intrinsic/image/u64imageDim.slang476
-rw-r--r--tests/glsl-intrinsic/image/uimageDim.slang410
-rw-r--r--tests/glsl/ssboMemberMemoryQualifier.slang54
-rw-r--r--tests/glsl/ssboMemberMemoryQualifierReadError.slang17
-rw-r--r--tests/glsl/ssboMemberMemoryQualifierWriteError.slang24
-rw-r--r--tests/glsl/ssboMemoryQualifier.slang39
-rw-r--r--tests/glsl/ssboMemoryQualifierReadError.slang27
-rw-r--r--tests/glsl/ssboMemoryQualifierWriteError.slang29
-rw-r--r--tests/glsl/ssboStructInsideStructMemoryQualifierError.slang23
-rw-r--r--tests/nv-extensions/nv-ray-tracing-motion-blur.slang2
-rw-r--r--tests/vkray/raygen.slang2
18 files changed, 2421 insertions, 2 deletions
diff --git a/tests/glsl-intrinsic/image/i64imageDim.slang b/tests/glsl-intrinsic/image/i64imageDim.slang
new file mode 100644
index 000000000..a6d38153e
--- /dev/null
+++ b/tests/glsl-intrinsic/image/i64imageDim.slang
@@ -0,0 +1,476 @@
+//TEST:SIMPLE(filecheck=CHECK_GLSL): -allow-glsl -stage compute -entry computeMain -target glsl
+//TEST:SIMPLE(filecheck=CHECK_SPV): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly
+
+// As per vulkan specification: https://registry.khronos.org/vulkan/specs/1.3/html/chap34.html#formats-definition
+// i64/u64 images do not require sampled image support; support is currently unlikley on hardware
+//#define test_when_hardware_supports_i64_and_u64_sampled_textures
+// i64/u64 images do not require texel buffers support; support is currently unlikley on hardware
+//#define TEST_when_hardware_supports_i64_and_u64_buffers
+
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
+buffer MyBlockName2
+{
+ uint data[1];
+} outputBuffer;
+
+layout(local_size_x = 1) in;
+
+//TEST_INPUT: set image_1d = RWTexture1D(format=R64_SINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=0,r64i) i64image1D image_1d;
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+//COM:TEST_INPUT: set image_buffer = RWTextureBuffer(format=R64_INT, stride=8, data=[0 1 0 1 0 1 0 1])
+uniform layout(binding=1,r64i) i64imageBuffer image_buffer;
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+//TEST_INPUT: set image_1dArray = RWTexture1D(format=R64_SINT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=2,r64i) i64image1DArray image_1dArray;
+//TEST_INPUT: set image_2d = RWTexture2D(format=R64_SINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=3,r64i) i64image2D image_2d;
+//TEST_INPUT: set image_2dRect = RWTexture2D(format=R64_SINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=4,r64i) i64image2DRect image_2dRect;
+//TEST_INPUT: set image_2dArray = RWTexture2D(format=R64_SINT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=6,r64i) i64image2DArray image_2dArray;
+//TEST_INPUT: set image_3d = RWTexture3D(format=R64_SINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=7,r64i) i64image3D image_3d;
+//TEST_INPUT: set image_cube = RWTextureCube(format=R64_SINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=8,r64i) i64imageCube image_cube;
+//TEST_INPUT: set image_cubeArray = RWTextureCube(format=R64_SINT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=9,r64i) i64imageCubeArray image_cubeArray;
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+//COM:TEST_INPUT: set image_2dMultiSample = RWTexture2D(format=R64_SINT, size=4, content=one, mipMaps = 1, sampleCount = two)
+uniform layout(binding=5,r64i) i64image2DMS image_2dMultiSample;
+//COM:TEST_INPUT: set image_2dMultiSampleArray = RWTexture2D(format=R64_SINT, size=4, content=one, mipMaps = 1, arrayLength=2, sampleCount = two)
+uniform layout(binding=10,r64i) i64image2DMSArray image_2dMultiSampleArray;
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+
+bool checkAllImageSize()
+{
+ return true
+ && imageSize(image_1d) == int(4)
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageSize(image_buffer) == int(4)
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageSize(image_1dArray) == ivec2(4, 2)
+ && imageSize(image_2d) == ivec2(4)
+ && imageSize(image_2dArray) == ivec3(4, 4, 2)
+ && imageSize(image_2dRect) == ivec2(4)
+ && imageSize(image_3d) == ivec3(4)
+ && imageSize(image_cube) == ivec2(4)
+ && imageSize(image_cubeArray) == ivec3(4, 4, 2)
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageSize(image_2dMultiSample) == ivec2(4)
+ && imageSize(image_2dMultiSampleArray) == ivec3(4, 4, 2)
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageLoad()
+{
+ return true
+ && imageLoad(image_1d, 0).x == 1
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageLoad(image_buffer, 0).x == 1
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageLoad(image_1dArray, ivec2(0)).x == 1
+ && imageLoad(image_2d, ivec2(0)).x == 1
+ && imageLoad(image_2dRect, ivec2(0)).x == 1
+ && imageLoad(image_2dArray, ivec3(0)).x == 1
+ && imageLoad(image_3d, ivec3(0)).x == 1
+ && imageLoad(image_cube, ivec3(0)).x == 1
+ && imageLoad(image_cubeArray, ivec3(0)).x == 1
+ && imageLoad(image_cubeArray, ivec3(0)).x == 1
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageLoad(image_2dMultiSample, ivec2(0), 1).x == 1
+ && imageLoad(image_2dMultiSampleArray, ivec3(0), 1).x == 1
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool resetAllImageValues()
+{
+ imageStore(image_1d, 0,i64vec4(1));
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ imageStore(image_buffer, 0,i64vec4(1));
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ imageStore(image_1dArray, ivec2(0),i64vec4(1));
+ imageStore(image_2d, ivec2(0),i64vec4(1));
+ imageStore(image_2dRect, ivec2(0),i64vec4(1));
+ imageStore(image_2dArray, ivec3(0),i64vec4(1));
+ imageStore(image_3d, ivec3(0),i64vec4(1));
+ imageStore(image_cube, ivec3(0),i64vec4(1));
+ imageStore(image_cubeArray, ivec3(0),i64vec4(1));
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ imageStore(image_2dMultiSample, ivec2(0), 1, i64vec4(1));
+ imageStore(image_2dMultiSampleArray, ivec3(0), 1,i64vec4(1));
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ return true;
+}
+int64_t load_image_1d()
+{
+ return imageLoad(image_1d, 0).x;
+}
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+int64_t load_image_buffer()
+{
+ return imageLoad(image_buffer, 0).x;
+}
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+int64_t load_image_1dArray()
+{
+ return imageLoad(image_1dArray, ivec2(0)).x;
+}
+int64_t load_image_2d()
+{
+ return imageLoad(image_2d, ivec2(0)).x;
+}
+int64_t load_image_2dRect()
+{
+ return imageLoad(image_2dRect, ivec2(0)).x;
+}
+int64_t load_image_2dArray()
+{
+ return imageLoad(image_2dArray, ivec3(0)).x;
+}
+int64_t load_image_3d()
+{
+ return imageLoad(image_3d, ivec3(0)).x;
+}
+int64_t load_image_cube()
+{
+ return imageLoad(image_cube, ivec3(0)).x;
+}
+int64_t load_image_cubeArray()
+{
+ return imageLoad(image_cubeArray, ivec3(0)).x;
+}
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+int64_t load_image_2dMultiSample()
+{
+ return imageLoad(image_2dMultiSample, ivec2(0), 1).x;
+}
+int64_t load_image_2dMultiSampleArray()
+{
+ return imageLoad(image_2dMultiSampleArray, ivec3(0), 1).x;
+}
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+
+// requires ImageLoad test to pass
+bool checkAllImageStore()
+{
+ bool loadCheck = true;
+
+ imageStore(image_1d, 0,i64vec4(0));
+ loadCheck = loadCheck && load_image_1d() == 0;
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ imageStore(image_buffer, 0,i64vec4(0));
+ loadCheck = loadCheck && load_image_buffer() == 0;
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ imageStore(image_1dArray, ivec2(0),i64vec4(0));
+ loadCheck = loadCheck && load_image_1dArray() == 0;
+ imageStore(image_2d, ivec2(0),i64vec4(0));
+ loadCheck = loadCheck && load_image_2d() == 0;
+ imageStore(image_2dRect, ivec2(0),i64vec4(0));
+ loadCheck = loadCheck && load_image_2dRect() == 0;
+ imageStore(image_2dArray, ivec3(0),i64vec4(0));
+ loadCheck = loadCheck && load_image_2dArray() == 0;
+ imageStore(image_3d, ivec3(0),i64vec4(0));
+ loadCheck = loadCheck && load_image_3d() == 0;
+ imageStore(image_cube, ivec3(0),i64vec4(0));
+ loadCheck = loadCheck && load_image_cube() == 0;
+ imageStore(image_cubeArray, ivec3(0),i64vec4(0));
+ loadCheck = loadCheck && load_image_cubeArray() == 0;
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ imageStore(image_2dMultiSample, ivec2(0), 1, i64vec4(0));
+ loadCheck = loadCheck && load_image_2dMultiSample() == 0;
+ imageStore(image_2dMultiSampleArray, ivec3(0), 1,i64vec4(0));
+ loadCheck = loadCheck && load_image_2dMultiSampleArray() == 0;
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ resetAllImageValues();
+ return loadCheck;
+}
+bool checkAllImageSamples()
+{
+ resetAllImageValues();
+ return true
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageSamples(image_2dMultiSample) == 2
+ && imageSamples(image_2dMultiSampleArray) == 2
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicAdd()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicAdd(image_1d, 0, 0) == 1
+ && load_image_1d() == 1
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicAdd(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 3
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicAdd(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicAdd(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 3
+ && imageAtomicAdd(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 3
+ && imageAtomicAdd(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicAdd(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 3
+ && imageAtomicAdd(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 3
+ && imageAtomicAdd(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 3
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicAdd(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 3
+ && imageAtomicAdd(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 3
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicExchange()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicExchange(image_1d, 0, 0) == 1
+ && load_image_1d() == 0
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicExchange(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 2
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicExchange(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicExchange(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 2
+ && imageAtomicExchange(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicExchange(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicExchange(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 2
+ && imageAtomicExchange(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 2
+ && imageAtomicExchange(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 2
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicExchange(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicExchange(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 2
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicMin()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicMin(image_1d, 0, 0) == 1
+ && load_image_1d() == 0
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicMin(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 1
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicMin(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicMin(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 1
+ && imageAtomicMin(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 1
+ && imageAtomicMin(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicMin(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 1
+ && imageAtomicMin(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 1
+ && imageAtomicMin(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 1
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicMin(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 1
+ && imageAtomicMin(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 1
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicMax()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicMax(image_1d, 0, 0) == 1
+ && load_image_1d() == 1
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicMax(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 2
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicMax(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicMax(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 2
+ && imageAtomicMax(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicMax(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicMax(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 2
+ && imageAtomicMax(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 2
+ && imageAtomicMax(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 2
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicMax(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicMax(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 2
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicAnd()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicAnd(image_1d, 0, 1) == 1
+ && load_image_1d() == 1
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicAnd(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 0
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicAnd(image_1dArray, ivec2(0), 1) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicAnd(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 0
+ && imageAtomicAnd(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 0
+ && imageAtomicAnd(image_2dArray, ivec3(0), 1) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicAnd(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 0
+ && imageAtomicAnd(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 0
+ && imageAtomicAnd(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 0
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicAnd(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 0
+ && imageAtomicAnd(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 0
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicOr()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicOr(image_1d, 0, 1) == 1
+ && load_image_1d() == 1
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicOr(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 3
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicOr(image_1dArray, ivec2(0), 1) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicOr(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 3
+ && imageAtomicOr(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 3
+ && imageAtomicOr(image_2dArray, ivec3(0), 1) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicOr(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 3
+ && imageAtomicOr(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 3
+ && imageAtomicOr(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 3
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicOr(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 3
+ && imageAtomicOr(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 3
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicXor()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicXor(image_1d, 0, 1) == 1
+ && load_image_1d() == 0
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicXor(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 3
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicXor(image_1dArray, ivec2(0), 1) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicXor(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 3
+ && imageAtomicXor(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 3
+ && imageAtomicXor(image_2dArray, ivec3(0), 1) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicXor(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 3
+ && imageAtomicXor(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 3
+ && imageAtomicXor(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 3
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicXor(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 3
+ && imageAtomicXor(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 3
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicCompSwap()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicCompSwap(image_1d, 0, 0, 2) == 1
+ && load_image_1d() == 1
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicCompSwap(image_buffer, 0, 1, 2) == 1
+ && load_image_buffer() == 2
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicCompSwap(image_1dArray, ivec2(0), 0, 2) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicCompSwap(image_2d, ivec2(0), 1, 2) == 1
+ && load_image_2d() == 2
+ && imageAtomicCompSwap(image_2dRect, ivec2(0), 1, 2) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicCompSwap(image_2dArray, ivec3(0), 0, 2) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicCompSwap(image_3d, ivec3(0), 1, 2) == 1
+ && load_image_3d() == 2
+ && imageAtomicCompSwap(image_cube, ivec3(0), 1, 2) == 1
+ && load_image_cube() == 2
+ && imageAtomicCompSwap(image_cubeArray, ivec3(0), 1, 2) == 1
+ && load_image_cubeArray() == 2
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicCompSwap(image_2dMultiSample, ivec2(0), 1, 1, 2) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicCompSwap(image_2dMultiSampleArray, ivec3(0), 1, 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 2
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+
+// CHECK_GLSL: void main(
+// CHECK_SPV: OpEntryPoint
+void computeMain()
+{
+ outputBuffer.data[0] = true
+ && checkAllImageSize()
+ && checkAllImageLoad()
+ && checkAllImageStore()
+ && checkAllImageSamples()
+ && checkAllImageAtomicAdd()
+ && checkAllImageAtomicExchange()
+ && checkAllImageAtomicMin()
+ && checkAllImageAtomicMax()
+ && checkAllImageAtomicAnd()
+ && checkAllImageAtomicOr()
+ && checkAllImageAtomicXor()
+ && checkAllImageAtomicCompSwap()
+ ;
+ // BUF: 1
+}
diff --git a/tests/glsl-intrinsic/image/iimageDim.slang b/tests/glsl-intrinsic/image/iimageDim.slang
new file mode 100644
index 000000000..cb9756d56
--- /dev/null
+++ b/tests/glsl-intrinsic/image/iimageDim.slang
@@ -0,0 +1,411 @@
+//TEST:SIMPLE(filecheck=CHECK_GLSL): -allow-glsl -stage compute -entry computeMain -target glsl
+//TEST:SIMPLE(filecheck=CHECK_SPV): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly
+
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
+buffer MyBlockName2
+{
+ uint data[1];
+} outputBuffer;
+
+layout(local_size_x = 1) in;
+
+//TEST_INPUT: set image_1d = RWTexture1D(format=R32_SINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=0,r32i) iimage1D image_1d;
+//TEST_INPUT: set image_buffer = RWTextureBuffer(format=R32_SINT, stride=8, data=[1 1 1 1])
+uniform layout(binding=1,r32i) iimageBuffer image_buffer;
+//TEST_INPUT: set image_1dArray = RWTexture1D(format=R32_SINT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=2,r32i) iimage1DArray image_1dArray;
+//TEST_INPUT: set image_2d = RWTexture2D(format=R32_SINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=3,r32i) iimage2D image_2d;
+//TEST_INPUT: set image_2dRect = RWTexture2D(format=R32_SINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=4,r32i) iimage2DRect image_2dRect;
+//TEST_INPUT: set image_2dMultiSample = RWTexture2D(format=R32_SINT, size=4, content=one, mipMaps = 1, sampleCount = two)
+uniform layout(binding=5,r32i) iimage2DMS image_2dMultiSample;
+//TEST_INPUT: set image_2dArray = RWTexture2D(format=R32_SINT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=6,r32i) iimage2DArray image_2dArray;
+//TEST_INPUT: set image_3d = RWTexture3D(format=R32_SINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=7,r32i) iimage3D image_3d;
+//TEST_INPUT: set image_cube = RWTextureCube(format=R32_SINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=8,r32i) iimageCube image_cube;
+//TEST_INPUT: set image_cubeArray = RWTextureCube(format=R32_SINT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=9,r32i) iimageCubeArray image_cubeArray;
+//TEST_INPUT: set image_2dMultiSampleArray = RWTexture2D(format=R32_SINT, size=4, content=one, mipMaps = 1, arrayLength=2, sampleCount = two)
+uniform layout(binding=10,r32i) iimage2DMSArray image_2dMultiSampleArray;
+
+bool checkAllImageSize()
+{
+ return true
+ && imageSize(image_1d) == int(4)
+ && imageSize(image_buffer) == int(4)
+ && imageSize(image_1dArray) == ivec2(4, 2)
+ && imageSize(image_2d) == ivec2(4)
+ && imageSize(image_2dArray) == ivec3(4, 4, 2)
+ && imageSize(image_2dRect) == ivec2(4)
+ && imageSize(image_2dMultiSample) == ivec2(4)
+ && imageSize(image_3d) == ivec3(4)
+ && imageSize(image_cube) == ivec2(4)
+ && imageSize(image_cubeArray) == ivec3(4, 4, 2)
+ && imageSize(image_2dMultiSampleArray) == ivec3(4, 4, 2)
+ ;
+}
+bool checkAllImageLoad()
+{
+ return true
+ && imageLoad(image_1d, 0).x == 1
+ && imageLoad(image_buffer, 0).x == 1
+ && imageLoad(image_1dArray, ivec2(0)).x == 1
+ && imageLoad(image_2d, ivec2(0)).x == 1
+ && imageLoad(image_2dRect, ivec2(0)).x == 1
+ && imageLoad(image_2dMultiSample, ivec2(0), 1).x == 1
+ && imageLoad(image_2dArray, ivec3(0)).x == 1
+ && imageLoad(image_3d, ivec3(0)).x == 1
+ && imageLoad(image_cube, ivec3(0)).x == 1
+ && imageLoad(image_cubeArray, ivec3(0)).x == 1
+ && imageLoad(image_cubeArray, ivec3(0)).x == 1
+ && imageLoad(image_2dMultiSampleArray, ivec3(0), 1).x == 1
+ ;
+}
+bool resetAllImageValues()
+{
+ imageStore(image_1d, 0, ivec4(1));
+ imageStore(image_buffer, 0, ivec4(1));
+ imageStore(image_1dArray, ivec2(0), ivec4(1));
+ imageStore(image_2d, ivec2(0), ivec4(1));
+ imageStore(image_2dRect, ivec2(0), ivec4(1));
+ imageStore(image_2dMultiSample, ivec2(0), 1, ivec4(1));
+ imageStore(image_2dArray, ivec3(0), ivec4(1));
+ imageStore(image_3d, ivec3(0), ivec4(1));
+ imageStore(image_cube, ivec3(0), ivec4(1));
+ imageStore(image_cubeArray, ivec3(0), ivec4(1));
+ imageStore(image_2dMultiSampleArray, ivec3(0), 1, ivec4(1));
+ return true;
+}
+int load_image_1d()
+{
+ return imageLoad(image_1d, 0).x;
+}
+int load_image_buffer()
+{
+ return imageLoad(image_buffer, 0).x;
+}
+int load_image_1dArray()
+{
+ return imageLoad(image_1dArray, ivec2(0)).x;
+}
+int load_image_2d()
+{
+ return imageLoad(image_2d, ivec2(0)).x;
+}
+int load_image_2dRect()
+{
+ return imageLoad(image_2dRect, ivec2(0)).x;
+}
+int load_image_2dMultiSample()
+{
+ return imageLoad(image_2dMultiSample, ivec2(0), 1).x;
+}
+int load_image_2dArray()
+{
+ return imageLoad(image_2dArray, ivec3(0)).x;
+}
+int load_image_3d()
+{
+ return imageLoad(image_3d, ivec3(0)).x;
+}
+int load_image_cube()
+{
+ return imageLoad(image_cube, ivec3(0)).x;
+}
+int load_image_cubeArray()
+{
+ return imageLoad(image_cubeArray, ivec3(0)).x;
+}
+int load_image_2dMultiSampleArray()
+{
+ return imageLoad(image_2dMultiSampleArray, ivec3(0), 1).x;
+}
+// requires ImageLoad test to pass
+bool checkAllImageStore()
+{
+ bool loadCheck = true;
+
+ imageStore(image_1d, 0, ivec4(0));
+ loadCheck = loadCheck && load_image_1d() == 0;
+ imageStore(image_buffer, 0, ivec4(0));
+ loadCheck = loadCheck && load_image_buffer() == 0;
+ imageStore(image_1dArray, ivec2(0), ivec4(0));
+ loadCheck = loadCheck && load_image_1dArray() == 0;
+ imageStore(image_2d, ivec2(0), ivec4(0));
+ loadCheck = loadCheck && load_image_2d() == 0;
+ imageStore(image_2dRect, ivec2(0), ivec4(0));
+ loadCheck = loadCheck && load_image_2dRect() == 0;
+ imageStore(image_2dMultiSample, ivec2(0), 1, ivec4(0));
+ loadCheck = loadCheck && load_image_2dMultiSample() == 0;
+ imageStore(image_2dArray, ivec3(0), ivec4(0));
+ loadCheck = loadCheck && load_image_2dArray() == 0;
+ imageStore(image_3d, ivec3(0), ivec4(0));
+ loadCheck = loadCheck && load_image_3d() == 0;
+ imageStore(image_cube, ivec3(0), ivec4(0));
+ loadCheck = loadCheck && load_image_cube() == 0;
+ imageStore(image_cubeArray, ivec3(0), ivec4(0));
+ loadCheck = loadCheck && load_image_cubeArray() == 0;
+ imageStore(image_2dMultiSampleArray, ivec3(0), 1, ivec4(0));
+ loadCheck = loadCheck && load_image_2dMultiSampleArray() == 0;
+ resetAllImageValues();
+ return loadCheck;
+}
+bool checkAllImageSamples()
+{
+ resetAllImageValues();
+ return true
+ && imageSamples(image_2dMultiSample) == 2
+ && imageSamples(image_2dMultiSampleArray) == 2
+ ;
+}
+bool checkAllImageAtomicAdd()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicAdd(image_1d, 0, 0) == 1
+ && load_image_1d() == 1
+ && imageAtomicAdd(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 3
+ && imageAtomicAdd(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicAdd(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 3
+ && imageAtomicAdd(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 3
+ && imageAtomicAdd(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 3
+ && imageAtomicAdd(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicAdd(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 3
+ && imageAtomicAdd(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 3
+ && imageAtomicAdd(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 3
+ && imageAtomicAdd(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 3
+ ;
+}
+bool checkAllImageAtomicExchange()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicExchange(image_1d, 0, 0) == 1
+ && load_image_1d() == 0
+ && imageAtomicExchange(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 2
+ && imageAtomicExchange(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicExchange(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 2
+ && imageAtomicExchange(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicExchange(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicExchange(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicExchange(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 2
+ && imageAtomicExchange(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 2
+ && imageAtomicExchange(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 2
+ && imageAtomicExchange(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 2
+ ;
+}
+bool checkAllImageAtomicMin()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicMin(image_1d, 0, 0) == 1
+ && load_image_1d() == 0
+ && imageAtomicMin(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 1
+ && imageAtomicMin(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicMin(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 1
+ && imageAtomicMin(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 1
+ && imageAtomicMin(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 1
+ && imageAtomicMin(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicMin(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 1
+ && imageAtomicMin(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 1
+ && imageAtomicMin(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 1
+ && imageAtomicMin(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 1
+ ;
+}
+bool checkAllImageAtomicMax()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicMax(image_1d, 0, 0) == 1
+ && load_image_1d() == 1
+ && imageAtomicMax(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 2
+ && imageAtomicMax(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicMax(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 2
+ && imageAtomicMax(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicMax(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicMax(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicMax(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 2
+ && imageAtomicMax(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 2
+ && imageAtomicMax(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 2
+ && imageAtomicMax(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 2
+ ;
+}
+bool checkAllImageAtomicAnd()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicAnd(image_1d, 0, 1) == 1
+ && load_image_1d() == 1
+ && imageAtomicAnd(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 0
+ && imageAtomicAnd(image_1dArray, ivec2(0), 1) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicAnd(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 0
+ && imageAtomicAnd(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 0
+ && imageAtomicAnd(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 0
+ && imageAtomicAnd(image_2dArray, ivec3(0), 1) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicAnd(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 0
+ && imageAtomicAnd(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 0
+ && imageAtomicAnd(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 0
+ && imageAtomicAnd(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 0
+ ;
+}
+bool checkAllImageAtomicOr()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicOr(image_1d, 0, 1) == 1
+ && load_image_1d() == 1
+ && imageAtomicOr(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 3
+ && imageAtomicOr(image_1dArray, ivec2(0), 1) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicOr(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 3
+ && imageAtomicOr(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 3
+ && imageAtomicOr(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 3
+ && imageAtomicOr(image_2dArray, ivec3(0), 1) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicOr(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 3
+ && imageAtomicOr(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 3
+ && imageAtomicOr(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 3
+ && imageAtomicOr(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 3
+ ;
+}
+bool checkAllImageAtomicXor()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicXor(image_1d, 0, 1) == 1
+ && load_image_1d() == 0
+ && imageAtomicXor(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 3
+ && imageAtomicXor(image_1dArray, ivec2(0), 1) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicXor(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 3
+ && imageAtomicXor(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 3
+ && imageAtomicXor(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 3
+ && imageAtomicXor(image_2dArray, ivec3(0), 1) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicXor(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 3
+ && imageAtomicXor(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 3
+ && imageAtomicXor(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 3
+ && imageAtomicXor(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 3
+ ;
+}
+bool checkAllImageAtomicCompSwap()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicCompSwap(image_1d, 0, 0, 2) == 1
+ && load_image_1d() == 1
+ && imageAtomicCompSwap(image_buffer, 0, 1, 2) == 1
+ && load_image_buffer() == 2
+ && imageAtomicCompSwap(image_1dArray, ivec2(0), 0, 2) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicCompSwap(image_2d, ivec2(0), 1, 2) == 1
+ && load_image_2d() == 2
+ && imageAtomicCompSwap(image_2dRect, ivec2(0), 1, 2) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicCompSwap(image_2dMultiSample, ivec2(0), 1, 1, 2) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicCompSwap(image_2dArray, ivec3(0), 0, 2) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicCompSwap(image_3d, ivec3(0), 1, 2) == 1
+ && load_image_3d() == 2
+ && imageAtomicCompSwap(image_cube, ivec3(0), 1, 2) == 1
+ && load_image_cube() == 2
+ && imageAtomicCompSwap(image_cubeArray, ivec3(0), 1, 2) == 1
+ && load_image_cubeArray() == 2
+ && imageAtomicCompSwap(image_2dMultiSampleArray, ivec3(0), 1, 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 2
+ ;
+}
+
+// CHECK_GLSL: void main(
+// CHECK_SPV: OpEntryPoint
+void computeMain()
+{
+ outputBuffer.data[0] = true
+ && checkAllImageSize()
+ && checkAllImageLoad()
+ && checkAllImageStore()
+ && checkAllImageSamples()
+ && checkAllImageAtomicAdd()
+ && checkAllImageAtomicExchange()
+ && checkAllImageAtomicMin()
+ && checkAllImageAtomicMax()
+ && checkAllImageAtomicAnd()
+ && checkAllImageAtomicOr()
+ && checkAllImageAtomicXor()
+ && checkAllImageAtomicCompSwap()
+ ;
+ // BUF: 1
+}
diff --git a/tests/glsl-intrinsic/image/iimageDimTiny.slang b/tests/glsl-intrinsic/image/iimageDimTiny.slang
new file mode 100644
index 000000000..28dca1bc3
--- /dev/null
+++ b/tests/glsl-intrinsic/image/iimageDimTiny.slang
@@ -0,0 +1,34 @@
+//TEST:SIMPLE(filecheck=CHECK_GLSL): -allow-glsl -stage compute -entry computeMain -target glsl
+//TEST:SIMPLE(filecheck=CHECK_SPV): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly
+
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
+buffer MyBlockName2
+{
+ uint data[1];
+} outputBuffer;
+
+layout(local_size_x = 1) in;
+
+//TEST_INPUT: set image_1d = RWTexture1D(format=R32_SINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=0,r32i) iimage1D image_1d;
+
+bool checkAllImageAtomicAdd()
+{
+ imageStore(image_1d, 0, ivec4(1));
+ return true
+ && imageAtomicAdd(image_1d, 0, 0) == 1
+ && imageLoad(image_1d, 0).x == 1
+ ;
+}
+
+// CHECK_GLSL: void main(
+// CHECK_SPV: OpEntryPoint
+void computeMain()
+{
+ outputBuffer.data[0] = true
+ && checkAllImageAtomicAdd()
+ ;
+ // BUF: 1
+}
diff --git a/tests/glsl-intrinsic/image/imageAsParamWithMemoryQualifiers.slang b/tests/glsl-intrinsic/image/imageAsParamWithMemoryQualifiers.slang
new file mode 100644
index 000000000..4766cb66f
--- /dev/null
+++ b/tests/glsl-intrinsic/image/imageAsParamWithMemoryQualifiers.slang
@@ -0,0 +1,43 @@
+//TEST:SIMPLE(filecheck=CHECK_GLSL): -allow-glsl -stage compute -entry computeMain -target glsl
+//TEST:SIMPLE(filecheck=CHECK_SPV): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly
+
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
+buffer MyBlockName2
+{
+ uint data[1];
+} outputBuffer;
+
+layout(local_size_x = 4) in;
+
+//TEST_INPUT: set someImage = RWTexture2D(format=R16G16B16A16_FLOAT, size=1, content=one, mipMaps = 1)
+uniform layout(binding=0,rgba16f) writeonly readonly image2D someImage;
+
+//TEST_INPUT: set someImage2 = RWTexture2D(format=R16G16B16A16_FLOAT, size=1, content=one, mipMaps = 1)
+uniform layout(binding=1,rgba16f) writeonly image2D someImage2;
+
+bool checkAllImageSizesParamSameQualifiers(writeonly readonly image2D val)
+{
+ return true
+ && imageSize(val) == ivec2(1)
+ ;
+}
+bool checkAllImageSizesParamMoreQualifiers(readonly writeonly image2D val)
+{
+ return true
+ && imageSize(val) == ivec2(1)
+ ;
+}
+
+// CHECK_GLSL: void main(
+// CHECK_SPV: OpEntryPoint
+void computeMain()
+{
+ outputBuffer.data[0] = true
+ && checkAllImageSizesParamSameQualifiers(someImage)
+ && checkAllImageSizesParamMoreQualifiers(someImage2)
+ ;
+ // BUF: 1
+
+} \ No newline at end of file
diff --git a/tests/glsl-intrinsic/image/imageAsParamWithMemoryQualifiersError.slang b/tests/glsl-intrinsic/image/imageAsParamWithMemoryQualifiersError.slang
new file mode 100644
index 000000000..cab9be395
--- /dev/null
+++ b/tests/glsl-intrinsic/image/imageAsParamWithMemoryQualifiersError.slang
@@ -0,0 +1,27 @@
+//TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target glsl
+//TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
+buffer MyBlockName2
+{
+ uint data[1];
+} outputBuffer;
+
+layout(local_size_x = 4) in;
+
+//TEST_INPUT: set someImage = RWTexture2D(format=R16G16B16A16_FLOAT, size=1, content=one, mipMaps = 1)
+uniform layout(binding=0,rgba16f) readonly image2D someImage;
+
+// CHECK: error 30048
+bool checkAllImageSizes(writeonly image2D val)
+{
+ return true
+ && imageSize(val) == ivec2(1)
+ ;
+}
+
+void computeMain()
+{
+ outputBuffer.data[0] = true
+ && checkAllImageSizes(someImage);
+ ;
+} \ No newline at end of file
diff --git a/tests/glsl-intrinsic/image/imageDim.slang b/tests/glsl-intrinsic/image/imageDim.slang
new file mode 100644
index 000000000..4699bc2ac
--- /dev/null
+++ b/tests/glsl-intrinsic/image/imageDim.slang
@@ -0,0 +1,303 @@
+//TEST:SIMPLE(filecheck=CHECK_GLSL): -allow-glsl -stage compute -entry computeMain -target glsl
+//TEST:SIMPLE(filecheck=CHECK_SPV): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly
+
+// shader_atomic_float2 is currently a very new extension; most hardware lacks
+// this extension and will fail this test if attempting to use atomic_float2
+// operations.
+// #define TEST_when_shader_atomic_float2_is_available
+
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
+buffer MyBlockName2
+{
+ uint data[1];
+} outputBuffer;
+
+layout(local_size_x = 1) in;
+
+//TEST_INPUT: set image_1d = RWTexture1D(format=R32_FLOAT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=0,r32f) image1D image_1d;
+//TEST_INPUT: set image_buffer = RWTextureBuffer(format=R32_FLOAT, stride=4, data=[1.0f 1.0f 1.0f 1.0f])
+uniform layout(binding=1,r32f) imageBuffer image_buffer;
+//TEST_INPUT: set image_1dArray = RWTexture1D(format=R32_FLOAT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=2,r32f) image1DArray image_1dArray;
+//TEST_INPUT: set image_2d = RWTexture2D(format=R32_FLOAT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=3,r32f) image2D image_2d;
+//TEST_INPUT: set image_2dRect = RWTexture2D(format=R32_FLOAT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=4,r32f) image2DRect image_2dRect;
+//TEST_INPUT: set image_2dMultiSample = RWTexture2D(format=R32_FLOAT, size=4, content=one, mipMaps = 1, sampleCount = two)
+uniform layout(binding=5,r32f) image2DMS image_2dMultiSample;
+//TEST_INPUT: set image_2dArray = RWTexture2D(format=R32_FLOAT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=6,r32f) image2DArray image_2dArray;
+//TEST_INPUT: set image_3d = RWTexture3D(format=R32_FLOAT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=7,r32f) image3D image_3d;
+//TEST_INPUT: set image_cube = RWTextureCube(format=R32_FLOAT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=8,r32f) imageCube image_cube;
+//TEST_INPUT: set image_cubeArray = RWTextureCube(format=R32_FLOAT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=9,r32f) imageCubeArray image_cubeArray;
+//TEST_INPUT: set image_2dMultiSampleArray = RWTexture2D(format=R32_FLOAT, size=4, content=one, mipMaps = 1, arrayLength=2, sampleCount = two)
+uniform layout(binding=10,r32f) image2DMSArray image_2dMultiSampleArray;
+
+bool checkAllImageSize()
+{
+ return true
+ && imageSize(image_1d) == int(4)
+ && imageSize(image_buffer) == int(4)
+ && imageSize(image_1dArray) == ivec2(4, 2)
+ && imageSize(image_2d) == ivec2(4)
+ && imageSize(image_2dArray) == ivec3(4, 4, 2)
+ && imageSize(image_2dRect) == ivec2(4)
+ && imageSize(image_2dMultiSample) == ivec2(4)
+ && imageSize(image_3d) == ivec3(4)
+ && imageSize(image_cube) == ivec2(4)
+ && imageSize(image_cubeArray) == ivec3(4, 4, 2)
+ && imageSize(image_2dMultiSampleArray) == ivec3(4, 4, 2)
+ ;
+}
+bool checkAllImageLoad()
+{
+ return true
+ && imageLoad(image_1d, 0).x == 1
+ && imageLoad(image_buffer, 0).x == 1
+ && imageLoad(image_1dArray, ivec2(0)).x == 1
+ && imageLoad(image_2d, ivec2(0)).x == 1
+ && imageLoad(image_2dRect, ivec2(0)).x == 1
+ && imageLoad(image_2dMultiSample, ivec2(0), 1).x == 1
+ && imageLoad(image_2dArray, ivec3(0)).x == 1
+ && imageLoad(image_3d, ivec3(0)).x == 1
+ && imageLoad(image_cube, ivec3(0)).x == 1
+ && imageLoad(image_cubeArray, ivec3(0)).x == 1
+ && imageLoad(image_cubeArray, ivec3(0)).x == 1
+ && imageLoad(image_2dMultiSampleArray, ivec3(0), 1).x == 1
+ ;
+}
+bool resetAllImageValues()
+{
+ imageStore(image_1d, 0, vec4(1));
+ imageStore(image_buffer, 0, vec4(1));
+ imageStore(image_1dArray, ivec2(0), vec4(1));
+ imageStore(image_2d, ivec2(0), vec4(1));
+ imageStore(image_2dRect, ivec2(0), vec4(1));
+ imageStore(image_2dMultiSample, ivec2(0), 1, vec4(1));
+ imageStore(image_2dArray, ivec3(0), vec4(1));
+ imageStore(image_3d, ivec3(0), vec4(1));
+ imageStore(image_cube, ivec3(0), vec4(1));
+ imageStore(image_cubeArray, ivec3(0), vec4(1));
+ imageStore(image_2dMultiSampleArray, ivec3(0), 1, vec4(1));
+ return true;
+}
+float load_image_1d()
+{
+ return imageLoad(image_1d, 0).x;
+}
+float load_image_buffer()
+{
+ return imageLoad(image_buffer, 0).x;
+}
+float load_image_1dArray()
+{
+ return imageLoad(image_1dArray, ivec2(0)).x;
+}
+float load_image_2d()
+{
+ return imageLoad(image_2d, ivec2(0)).x;
+}
+float load_image_2dRect()
+{
+ return imageLoad(image_2dRect, ivec2(0)).x;
+}
+float load_image_2dMultiSample()
+{
+ return imageLoad(image_2dMultiSample, ivec2(0), 1).x;
+}
+float load_image_2dArray()
+{
+ return imageLoad(image_2dArray, ivec3(0)).x;
+}
+float load_image_3d()
+{
+ return imageLoad(image_3d, ivec3(0)).x;
+}
+float load_image_cube()
+{
+ return imageLoad(image_cube, ivec3(0)).x;
+}
+float load_image_cubeArray()
+{
+ return imageLoad(image_cubeArray, ivec3(0)).x;
+}
+float load_image_2dMultiSampleArray()
+{
+ return imageLoad(image_2dMultiSampleArray, ivec3(0), 1).x;
+}
+// requires ImageLoad test to pass
+bool checkAllImageStore()
+{
+ bool loadCheck = true;
+ imageStore(image_1d, 0, vec4(0));
+ loadCheck = loadCheck && load_image_1d() == 0;
+ imageStore(image_buffer, 0, vec4(0));
+ loadCheck = loadCheck && load_image_buffer() == 0;
+ imageStore(image_1dArray, ivec2(0), vec4(0));
+ loadCheck = loadCheck && load_image_1dArray() == 0;
+ imageStore(image_2d, ivec2(0), vec4(0));
+ loadCheck = loadCheck && load_image_2d() == 0;
+ imageStore(image_2dRect, ivec2(0), vec4(0));
+ loadCheck = loadCheck && load_image_2dRect() == 0;
+ imageStore(image_2dMultiSample, ivec2(0), 1, vec4(0));
+ loadCheck = loadCheck && load_image_2dMultiSample() == 0;
+ imageStore(image_2dArray, ivec3(0), vec4(0));
+ loadCheck = loadCheck && load_image_2dArray() == 0;
+ imageStore(image_3d, ivec3(0), vec4(0));
+ loadCheck = loadCheck && load_image_3d() == 0;
+ imageStore(image_cube, ivec3(0), vec4(0));
+ loadCheck = loadCheck && load_image_cube() == 0;
+ imageStore(image_cubeArray, ivec3(0), vec4(0));
+ loadCheck = loadCheck && load_image_cubeArray() == 0;
+ imageStore(image_2dMultiSampleArray, ivec3(0), 1, vec4(0));
+ loadCheck = loadCheck && load_image_2dMultiSampleArray() == 0;
+ resetAllImageValues();
+ return loadCheck;
+}
+bool checkAllImageSamples()
+{
+ resetAllImageValues();
+ return true
+ && imageSamples(image_2dMultiSample) == 2
+ && imageSamples(image_2dMultiSampleArray) == 2
+ ;
+}
+bool checkAllImageAtomicAdd()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicAdd(image_1d, 0, 0.0f) == 1
+ && load_image_1d() == 1
+ && imageAtomicAdd(image_buffer, 0, 2.0f) == 1
+ && load_image_buffer() == 3
+ && imageAtomicAdd(image_1dArray, ivec2(0), 0.0f) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicAdd(image_2d, ivec2(0), 2.0f) == 1
+ && load_image_2d() == 3
+ && imageAtomicAdd(image_2dRect, ivec2(0), 2.0f) == 1
+ && load_image_2dRect() == 3
+ && imageAtomicAdd(image_2dMultiSample, ivec2(0), 1, 2.0f) == 1
+ && load_image_2dMultiSample() == 3
+ && imageAtomicAdd(image_2dArray, ivec3(0), 0.0f) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicAdd(image_3d, ivec3(0), 2.0f) == 1
+ && load_image_3d() == 3
+ && imageAtomicAdd(image_cube, ivec3(0), 2.0f) == 1
+ && load_image_cube() == 3
+ && imageAtomicAdd(image_cubeArray, ivec3(0), 2.0f) == 1
+ && load_image_cubeArray() == 3
+ && imageAtomicAdd(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 3
+ ;
+}
+bool checkAllImageAtomicExchange()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicExchange(image_1d, 0, 0.0f) == 1
+ && load_image_1d() == 0
+ && imageAtomicExchange(image_buffer, 0, 2.0f) == 1
+ && load_image_buffer() == 2
+ && imageAtomicExchange(image_1dArray, ivec2(0), 0.0f) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicExchange(image_2d, ivec2(0), 2.0f) == 1
+ && load_image_2d() == 2
+ && imageAtomicExchange(image_2dRect, ivec2(0), 2.0f) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicExchange(image_2dMultiSample, ivec2(0), 1, 2.0f) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicExchange(image_2dArray, ivec3(0), 0.0f) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicExchange(image_3d, ivec3(0), 2.0f) == 1
+ && load_image_3d() == 2
+ && imageAtomicExchange(image_cube, ivec3(0), 2.0f) == 1
+ && load_image_cube() == 2
+ && imageAtomicExchange(image_cubeArray, ivec3(0), 2.0f) == 1
+ && load_image_cubeArray() == 2
+ && imageAtomicExchange(image_2dMultiSampleArray, ivec3(0), 1, 2.0f) == 1
+ && load_image_2dMultiSampleArray() == 2
+ ;
+}
+#ifdef TEST_when_shader_atomic_float2_is_available
+bool checkAllImageAtomicMin()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicMin(image_1d, 0, 0.0f) == 1
+ && load_image_1d() == 0
+ && imageAtomicMin(image_buffer, 0, 2.0f) == 1
+ && load_image_buffer() == 1
+ && imageAtomicMin(image_1dArray, ivec2(0), 0.0f) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicMin(image_2d, ivec2(0), 2.0f) == 1
+ && load_image_2d() == 1
+ && imageAtomicMin(image_2dRect, ivec2(0), 2.0f) == 1
+ && load_image_2dRect() == 1
+ && imageAtomicMin(image_2dMultiSample, ivec2(0), 1, 2.0f) == 1
+ && load_image_2dMultiSample() == 1
+ && imageAtomicMin(image_2dArray, ivec3(0), 0.0f) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicMin(image_3d, ivec3(0), 2.0f) == 1
+ && load_image_3d() == 1
+ && imageAtomicMin(image_cube, ivec3(0), 2.0f) == 1
+ && load_image_cube() == 1
+ && imageAtomicMin(image_cubeArray, ivec3(0), 2.0f) == 1
+ && load_image_cubeArray() == 1
+ && imageAtomicMin(image_2dMultiSampleArray, ivec3(0), 1, 2.0f) == 1
+ && load_image_2dMultiSampleArray() == 1
+ ;
+}
+bool checkAllImageAtomicMax()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicMax(image_1d, 0, 0) == 1
+ && load_image_1d() == 1
+ && imageAtomicMax(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 2
+ && imageAtomicMax(image_1dArray, ivec2(0), 0.0f) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicMax(image_2d, ivec2(0), 2.0f) == 1
+ && load_image_2d() == 2
+ && imageAtomicMax(image_2dRect, ivec2(0), 2.0f) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicMax(image_2dMultiSample, ivec2(0), 1, 2.0f) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicMax(image_2dArray, ivec3(0), 0.0f) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicMax(image_3d, ivec3(0), 2.0f) == 1
+ && load_image_3d() == 2
+ && imageAtomicMax(image_cube, ivec3(0), 2.0f) == 1
+ && load_image_cube() == 2
+ && imageAtomicMax(image_cubeArray, ivec3(0), 2.0f) == 1
+ && load_image_cubeArray() == 2
+ && imageAtomicMax(image_2dMultiSampleArray, ivec3(0), 1, 2.0f) == 1
+ && load_image_2dMultiSampleArray() == 2
+ ;
+}
+#endif // #ifdef TEST_when_shader_atomic_float2_is_available
+
+// CHECK_GLSL: void main(
+// CHECK_SPV: OpEntryPoint
+void computeMain()
+{
+ outputBuffer.data[0] = true
+ && checkAllImageSize()
+ && checkAllImageLoad()
+ && checkAllImageStore()
+ && checkAllImageSamples()
+ && checkAllImageAtomicAdd()
+ && checkAllImageAtomicExchange()
+#ifdef TEST_when_shader_atomic_float2_is_available
+ && checkAllImageAtomicMin()
+ && checkAllImageAtomicMax()
+#endif // #ifdef TEST_when_shader_atomic_float2_is_available
+ ;
+ // BUF: 1
+} \ No newline at end of file
diff --git a/tests/glsl-intrinsic/image/nonImageAsParamWithMemoryQualifierError.slang b/tests/glsl-intrinsic/image/nonImageAsParamWithMemoryQualifierError.slang
new file mode 100644
index 000000000..1248020d4
--- /dev/null
+++ b/tests/glsl-intrinsic/image/nonImageAsParamWithMemoryQualifierError.slang
@@ -0,0 +1,26 @@
+//TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target glsl
+//TEST:SIMPLE(filecheck=CHECK): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
+
+// restrict modifier is allowed to be dropped as a parameter
+buffer MyBlockName2
+{
+ restrict uint data[1];
+} outputBuffer;
+
+layout(local_size_x = 4) in;
+
+// CHECK: error 31206
+bool checkAllImageSizes(writeonly uint val)
+{
+ return true
+ && val == 0
+ ;
+}
+
+void computeMain()
+{
+ outputBuffer.data[0] = true
+ && checkAllImageSizes(outputBuffer.data[0])
+ ;
+} \ No newline at end of file
diff --git a/tests/glsl-intrinsic/image/u64imageDim.slang b/tests/glsl-intrinsic/image/u64imageDim.slang
new file mode 100644
index 000000000..ebcfd0796
--- /dev/null
+++ b/tests/glsl-intrinsic/image/u64imageDim.slang
@@ -0,0 +1,476 @@
+//TEST:SIMPLE(filecheck=CHECK_GLSL): -allow-glsl -stage compute -entry computeMain -target glsl
+//TEST:SIMPLE(filecheck=CHECK_SPV): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly
+
+// As per vulkan specification: https://registry.khronos.org/vulkan/specs/1.3/html/chap34.html#formats-definition
+// i64/u64 images do not require sampled image support; support is currently unlikley on hardware
+//#define test_when_hardware_supports_i64_and_u64_sampled_textures
+// i64/u64 images do not require texel buffers support; support is currently unlikley on hardware
+//#define TEST_when_hardware_supports_i64_and_u64_buffers
+
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
+buffer MyBlockName2
+{
+ uint data[1];
+} outputBuffer;
+
+layout(local_size_x = 1) in;
+
+//TEST_INPUT: set image_1d = RWTexture1D(format=R64_UINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=0,r64ui) u64image1D image_1d;
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+//COM:TEST_INPUT: set image_buffer = RWTextureBuffer(format=R64_UINT, stride=8, data=[0 1 0 1 0 1 0 1])
+uniform layout(binding=1,r64ui) u64imageBuffer image_buffer;
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+//TEST_INPUT: set image_1dArray = RWTexture1D(format=R64_UINT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=2,r64ui) u64image1DArray image_1dArray;
+//TEST_INPUT: set image_2d = RWTexture2D(format=R64_UINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=3,r64ui) u64image2D image_2d;
+//TEST_INPUT: set image_2dRect = RWTexture2D(format=R64_UINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=4,r64ui) u64image2DRect image_2dRect;
+//TEST_INPUT: set image_2dArray = RWTexture2D(format=R64_UINT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=6,r64ui) u64image2DArray image_2dArray;
+//TEST_INPUT: set image_3d = RWTexture3D(format=R64_UINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=7,r64ui) u64image3D image_3d;
+//TEST_INPUT: set image_cube = RWTextureCube(format=R64_UINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=8,r64ui) u64imageCube image_cube;
+//TEST_INPUT: set image_cubeArray = RWTextureCube(format=R64_UINT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=9,r64ui) u64imageCubeArray image_cubeArray;
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+//COM:TEST_INPUT: set image_2dMultiSample = RWTexture2D(format=R64_UINT, size=4, content=one, mipMaps = 1, sampleCount = two)
+uniform layout(binding=5,r64ui) u64image2DMS image_2dMultiSample;
+//COM:TEST_INPUT: set image_2dMultiSampleArray = RWTexture2D(format=R64_UINT, size=4, content=one, mipMaps = 1, arrayLength=2, sampleCount = two)
+uniform layout(binding=10,r64ui) u64image2DMSArray image_2dMultiSampleArray;
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+
+bool checkAllImageSize()
+{
+ return true
+ && imageSize(image_1d) == int(4)
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageSize(image_buffer) == int(4)
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageSize(image_1dArray) == ivec2(4, 2)
+ && imageSize(image_2d) == ivec2(4)
+ && imageSize(image_2dArray) == ivec3(4, 4, 2)
+ && imageSize(image_2dRect) == ivec2(4)
+ && imageSize(image_3d) == ivec3(4)
+ && imageSize(image_cube) == ivec2(4)
+ && imageSize(image_cubeArray) == ivec3(4, 4, 2)
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageSize(image_2dMultiSample) == ivec2(4)
+ && imageSize(image_2dMultiSampleArray) == ivec3(4, 4, 2)
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageLoad()
+{
+ return true
+ && imageLoad(image_1d, 0).x == 1
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageLoad(image_buffer, 0).x == 1
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageLoad(image_1dArray, ivec2(0)).x == 1
+ && imageLoad(image_2d, ivec2(0)).x == 1
+ && imageLoad(image_2dRect, ivec2(0)).x == 1
+ && imageLoad(image_2dArray, ivec3(0)).x == 1
+ && imageLoad(image_3d, ivec3(0)).x == 1
+ && imageLoad(image_cube, ivec3(0)).x == 1
+ && imageLoad(image_cubeArray, ivec3(0)).x == 1
+ && imageLoad(image_cubeArray, ivec3(0)).x == 1
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageLoad(image_2dMultiSample, ivec2(0), 1).x == 1
+ && imageLoad(image_2dMultiSampleArray, ivec3(0), 1).x == 1
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool resetAllImageValues()
+{
+ imageStore(image_1d, 0,u64vec4(1));
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ imageStore(image_buffer, 0,u64vec4(1));
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ imageStore(image_1dArray, ivec2(0),u64vec4(1));
+ imageStore(image_2d, ivec2(0),u64vec4(1));
+ imageStore(image_2dRect, ivec2(0),u64vec4(1));
+ imageStore(image_2dArray, ivec3(0),u64vec4(1));
+ imageStore(image_3d, ivec3(0),u64vec4(1));
+ imageStore(image_cube, ivec3(0),u64vec4(1));
+ imageStore(image_cubeArray, ivec3(0),u64vec4(1));
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ imageStore(image_2dMultiSample, ivec2(0), 1, u64vec4(1));
+ imageStore(image_2dMultiSampleArray, ivec3(0), 1,u64vec4(1));
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ return true;
+}
+uint64_t load_image_1d()
+{
+ return imageLoad(image_1d, 0).x;
+}
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+uint64_t load_image_buffer()
+{
+ return imageLoad(image_buffer, 0).x;
+}
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+uint64_t load_image_1dArray()
+{
+ return imageLoad(image_1dArray, ivec2(0)).x;
+}
+uint64_t load_image_2d()
+{
+ return imageLoad(image_2d, ivec2(0)).x;
+}
+uint64_t load_image_2dRect()
+{
+ return imageLoad(image_2dRect, ivec2(0)).x;
+}
+uint64_t load_image_2dArray()
+{
+ return imageLoad(image_2dArray, ivec3(0)).x;
+}
+uint64_t load_image_3d()
+{
+ return imageLoad(image_3d, ivec3(0)).x;
+}
+uint64_t load_image_cube()
+{
+ return imageLoad(image_cube, ivec3(0)).x;
+}
+uint64_t load_image_cubeArray()
+{
+ return imageLoad(image_cubeArray, ivec3(0)).x;
+}
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+uint64_t load_image_2dMultiSample()
+{
+ return imageLoad(image_2dMultiSample, ivec2(0), 1).x;
+}
+uint64_t load_image_2dMultiSampleArray()
+{
+ return imageLoad(image_2dMultiSampleArray, ivec3(0), 1).x;
+}
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+
+// requires ImageLoad test to pass
+bool checkAllImageStore()
+{
+ bool loadCheck = true;
+
+ imageStore(image_1d, 0,u64vec4(0));
+ loadCheck = loadCheck && load_image_1d() == 0;
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ imageStore(image_buffer, 0,u64vec4(0));
+ loadCheck = loadCheck && load_image_buffer() == 0;
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ imageStore(image_1dArray, ivec2(0),u64vec4(0));
+ loadCheck = loadCheck && load_image_1dArray() == 0;
+ imageStore(image_2d, ivec2(0),u64vec4(0));
+ loadCheck = loadCheck && load_image_2d() == 0;
+ imageStore(image_2dRect, ivec2(0),u64vec4(0));
+ loadCheck = loadCheck && load_image_2dRect() == 0;
+ imageStore(image_2dArray, ivec3(0),u64vec4(0));
+ loadCheck = loadCheck && load_image_2dArray() == 0;
+ imageStore(image_3d, ivec3(0),u64vec4(0));
+ loadCheck = loadCheck && load_image_3d() == 0;
+ imageStore(image_cube, ivec3(0),u64vec4(0));
+ loadCheck = loadCheck && load_image_cube() == 0;
+ imageStore(image_cubeArray, ivec3(0),u64vec4(0));
+ loadCheck = loadCheck && load_image_cubeArray() == 0;
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ imageStore(image_2dMultiSample, ivec2(0), 1, u64vec4(0));
+ loadCheck = loadCheck && load_image_2dMultiSample() == 0;
+ imageStore(image_2dMultiSampleArray, ivec3(0), 1,u64vec4(0));
+ loadCheck = loadCheck && load_image_2dMultiSampleArray() == 0;
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ resetAllImageValues();
+ return loadCheck;
+}
+bool checkAllImageSamples()
+{
+ resetAllImageValues();
+ return true
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageSamples(image_2dMultiSample) == 2
+ && imageSamples(image_2dMultiSampleArray) == 2
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicAdd()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicAdd(image_1d, 0, 0) == 1
+ && load_image_1d() == 1
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicAdd(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 3
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicAdd(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicAdd(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 3
+ && imageAtomicAdd(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 3
+ && imageAtomicAdd(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicAdd(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 3
+ && imageAtomicAdd(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 3
+ && imageAtomicAdd(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 3
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicAdd(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 3
+ && imageAtomicAdd(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 3
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicExchange()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicExchange(image_1d, 0, 0) == 1
+ && load_image_1d() == 0
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicExchange(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 2
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicExchange(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicExchange(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 2
+ && imageAtomicExchange(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicExchange(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicExchange(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 2
+ && imageAtomicExchange(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 2
+ && imageAtomicExchange(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 2
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicExchange(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicExchange(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 2
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicMin()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicMin(image_1d, 0, 0) == 1
+ && load_image_1d() == 0
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicMin(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 1
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicMin(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicMin(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 1
+ && imageAtomicMin(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 1
+ && imageAtomicMin(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicMin(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 1
+ && imageAtomicMin(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 1
+ && imageAtomicMin(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 1
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicMin(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 1
+ && imageAtomicMin(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 1
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicMax()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicMax(image_1d, 0, 0) == 1
+ && load_image_1d() == 1
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicMax(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 2
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicMax(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicMax(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 2
+ && imageAtomicMax(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicMax(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicMax(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 2
+ && imageAtomicMax(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 2
+ && imageAtomicMax(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 2
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicMax(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicMax(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 2
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicAnd()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicAnd(image_1d, 0, 1) == 1
+ && load_image_1d() == 1
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicAnd(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 0
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicAnd(image_1dArray, ivec2(0), 1) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicAnd(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 0
+ && imageAtomicAnd(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 0
+ && imageAtomicAnd(image_2dArray, ivec3(0), 1) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicAnd(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 0
+ && imageAtomicAnd(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 0
+ && imageAtomicAnd(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 0
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicAnd(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 0
+ && imageAtomicAnd(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 0
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicOr()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicOr(image_1d, 0, 1) == 1
+ && load_image_1d() == 1
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicOr(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 3
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicOr(image_1dArray, ivec2(0), 1) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicOr(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 3
+ && imageAtomicOr(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 3
+ && imageAtomicOr(image_2dArray, ivec3(0), 1) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicOr(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 3
+ && imageAtomicOr(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 3
+ && imageAtomicOr(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 3
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicOr(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 3
+ && imageAtomicOr(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 3
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicXor()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicXor(image_1d, 0, 1) == 1
+ && load_image_1d() == 0
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicXor(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 3
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicXor(image_1dArray, ivec2(0), 1) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicXor(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 3
+ && imageAtomicXor(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 3
+ && imageAtomicXor(image_2dArray, ivec3(0), 1) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicXor(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 3
+ && imageAtomicXor(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 3
+ && imageAtomicXor(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 3
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicXor(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 3
+ && imageAtomicXor(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 3
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+bool checkAllImageAtomicCompSwap()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicCompSwap(image_1d, 0, 0, 2) == 1
+ && load_image_1d() == 1
+#ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicCompSwap(image_buffer, 0, 1, 2) == 1
+ && load_image_buffer() == 2
+#endif // #ifdef TEST_when_hardware_supports_i64_and_u64_buffers
+ && imageAtomicCompSwap(image_1dArray, ivec2(0), 0, 2) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicCompSwap(image_2d, ivec2(0), 1, 2) == 1
+ && load_image_2d() == 2
+ && imageAtomicCompSwap(image_2dRect, ivec2(0), 1, 2) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicCompSwap(image_2dArray, ivec3(0), 0, 2) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicCompSwap(image_3d, ivec3(0), 1, 2) == 1
+ && load_image_3d() == 2
+ && imageAtomicCompSwap(image_cube, ivec3(0), 1, 2) == 1
+ && load_image_cube() == 2
+ && imageAtomicCompSwap(image_cubeArray, ivec3(0), 1, 2) == 1
+ && load_image_cubeArray() == 2
+#ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ && imageAtomicCompSwap(image_2dMultiSample, ivec2(0), 1, 1, 2) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicCompSwap(image_2dMultiSampleArray, ivec3(0), 1, 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 2
+#endif // #ifdef test_when_hardware_supports_i64_and_u64_sampled_textures
+ ;
+}
+
+// CHECK_GLSL: void main(
+// CHECK_SPV: OpEntryPoint
+void computeMain()
+{
+ outputBuffer.data[0] = true
+ && checkAllImageSize()
+ && checkAllImageLoad()
+ && checkAllImageStore()
+ && checkAllImageSamples()
+ && checkAllImageAtomicAdd()
+ && checkAllImageAtomicExchange()
+ && checkAllImageAtomicMin()
+ && checkAllImageAtomicMax()
+ && checkAllImageAtomicAnd()
+ && checkAllImageAtomicOr()
+ && checkAllImageAtomicXor()
+ && checkAllImageAtomicCompSwap()
+ ;
+ // BUF: 1
+} \ No newline at end of file
diff --git a/tests/glsl-intrinsic/image/uimageDim.slang b/tests/glsl-intrinsic/image/uimageDim.slang
new file mode 100644
index 000000000..538855b7d
--- /dev/null
+++ b/tests/glsl-intrinsic/image/uimageDim.slang
@@ -0,0 +1,410 @@
+//TEST:SIMPLE(filecheck=CHECK_GLSL): -allow-glsl -stage compute -entry computeMain -target glsl
+//TEST:SIMPLE(filecheck=CHECK_SPV): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly
+
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
+buffer MyBlockName2
+{
+ uint data[1];
+} outputBuffer;
+
+layout(local_size_x = 1) in;
+
+//TEST_INPUT: set image_1d = RWTexture1D(format=R32_UINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=0,r32ui) uimage1D image_1d;
+//TEST_INPUT: set image_buffer = RWTextureBuffer(format=R32_UINT, stride=8, data=[1 1 1 1])
+uniform layout(binding=1,r32ui) uimageBuffer image_buffer;
+//TEST_INPUT: set image_1dArray = RWTexture1D(format=R32_UINT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=2,r32ui) uimage1DArray image_1dArray;
+//TEST_INPUT: set image_2d = RWTexture2D(format=R32_UINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=3,r32ui) uimage2D image_2d;
+//TEST_INPUT: set image_2dRect = RWTexture2D(format=R32_UINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=4,r32ui) uimage2DRect image_2dRect;
+//TEST_INPUT: set image_2dMultiSample = RWTexture2D(format=R32_UINT, size=4, content=one, mipMaps = 1, sampleCount = two)
+uniform layout(binding=5,r32ui) uimage2DMS image_2dMultiSample;
+//TEST_INPUT: set image_2dArray = RWTexture2D(format=R32_UINT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=6,r32ui) uimage2DArray image_2dArray;
+//TEST_INPUT: set image_3d = RWTexture3D(format=R32_UINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=7,r32ui) uimage3D image_3d;
+//TEST_INPUT: set image_cube = RWTextureCube(format=R32_UINT, size=4, content=one, mipMaps = 1)
+uniform layout(binding=8,r32ui) uimageCube image_cube;
+//TEST_INPUT: set image_cubeArray = RWTextureCube(format=R32_UINT, size=4, content=one, mipMaps = 1, arrayLength=2)
+uniform layout(binding=9,r32ui) uimageCubeArray image_cubeArray;
+//TEST_INPUT: set image_2dMultiSampleArray = RWTexture2D(format=R32_UINT, size=4, content=one, mipMaps = 1, arrayLength=2, sampleCount = two)
+uniform layout(binding=10,r32ui) uimage2DMSArray image_2dMultiSampleArray;
+
+bool checkAllImageSize()
+{
+ return true
+ && imageSize(image_1d) == int(4)
+ && imageSize(image_buffer) == int(4)
+ && imageSize(image_1dArray) == ivec2(4, 2)
+ && imageSize(image_2d) == ivec2(4)
+ && imageSize(image_2dArray) == ivec3(4, 4, 2)
+ && imageSize(image_2dRect) == ivec2(4)
+ && imageSize(image_2dMultiSample) == ivec2(4)
+ && imageSize(image_3d) == ivec3(4)
+ && imageSize(image_cube) == ivec2(4)
+ && imageSize(image_cubeArray) == ivec3(4, 4, 2)
+ && imageSize(image_2dMultiSampleArray) == ivec3(4, 4, 2)
+ ;
+}
+bool checkAllImageLoad()
+{
+ return true
+ && imageLoad(image_1d, 0).x == 1
+ && imageLoad(image_buffer, 0).x == 1
+ && imageLoad(image_1dArray, ivec2(0)).x == 1
+ && imageLoad(image_2d, ivec2(0)).x == 1
+ && imageLoad(image_2dRect, ivec2(0)).x == 1
+ && imageLoad(image_2dMultiSample, ivec2(0), 1).x == 1
+ && imageLoad(image_2dArray, ivec3(0)).x == 1
+ && imageLoad(image_3d, ivec3(0)).x == 1
+ && imageLoad(image_cube, ivec3(0)).x == 1
+ && imageLoad(image_cubeArray, ivec3(0)).x == 1
+ && imageLoad(image_cubeArray, ivec3(0)).x == 1
+ && imageLoad(image_2dMultiSampleArray, ivec3(0), 1).x == 1
+ ;
+}
+bool resetAllImageValues()
+{
+ imageStore(image_1d, 0, uvec4(1));
+ imageStore(image_buffer, 0, uvec4(1));
+ imageStore(image_1dArray, ivec2(0), uvec4(1));
+ imageStore(image_2d, ivec2(0), uvec4(1));
+ imageStore(image_2dRect, ivec2(0), uvec4(1));
+ imageStore(image_2dMultiSample, ivec2(0), 1, uvec4(1));
+ imageStore(image_2dArray, ivec3(0), uvec4(1));
+ imageStore(image_3d, ivec3(0), uvec4(1));
+ imageStore(image_cube, ivec3(0), uvec4(1));
+ imageStore(image_cubeArray, ivec3(0), uvec4(1));
+ imageStore(image_2dMultiSampleArray, ivec3(0), 1, uvec4(1));
+ return true;
+}
+uint load_image_1d()
+{
+ return imageLoad(image_1d, 0).x;
+}
+uint load_image_buffer()
+{
+ return imageLoad(image_buffer, 0).x;
+}
+uint load_image_1dArray()
+{
+ return imageLoad(image_1dArray, ivec2(0)).x;
+}
+uint load_image_2d()
+{
+ return imageLoad(image_2d, ivec2(0)).x;
+}
+uint load_image_2dRect()
+{
+ return imageLoad(image_2dRect, ivec2(0)).x;
+}
+uint load_image_2dMultiSample()
+{
+ return imageLoad(image_2dMultiSample, ivec2(0), 1).x;
+}
+uint load_image_2dArray()
+{
+ return imageLoad(image_2dArray, ivec3(0)).x;
+}
+uint load_image_3d()
+{
+ return imageLoad(image_3d, ivec3(0)).x;
+}
+uint load_image_cube()
+{
+ return imageLoad(image_cube, ivec3(0)).x;
+}
+uint load_image_cubeArray()
+{
+ return imageLoad(image_cubeArray, ivec3(0)).x;
+}
+uint load_image_2dMultiSampleArray()
+{
+ return imageLoad(image_2dMultiSampleArray, ivec3(0), 1).x;
+}
+// requires ImageLoad test to pass
+bool checkAllImageStore()
+{
+ bool loadCheck = true;
+ imageStore(image_1d, 0, uvec4(0));
+ loadCheck = loadCheck && load_image_1d() == 0;
+ imageStore(image_buffer, 0, uvec4(0));
+ loadCheck = loadCheck && load_image_buffer() == 0;
+ imageStore(image_1dArray, ivec2(0), uvec4(0));
+ loadCheck = loadCheck && load_image_1dArray() == 0;
+ imageStore(image_2d, ivec2(0), uvec4(0));
+ loadCheck = loadCheck && load_image_2d() == 0;
+ imageStore(image_2dRect, ivec2(0), uvec4(0));
+ loadCheck = loadCheck && load_image_2dRect() == 0;
+ imageStore(image_2dMultiSample, ivec2(0), 1, uvec4(0));
+ loadCheck = loadCheck && load_image_2dMultiSample() == 0;
+ imageStore(image_2dArray, ivec3(0), uvec4(0));
+ loadCheck = loadCheck && load_image_2dArray() == 0;
+ imageStore(image_3d, ivec3(0), uvec4(0));
+ loadCheck = loadCheck && load_image_3d() == 0;
+ imageStore(image_cube, ivec3(0), uvec4(0));
+ loadCheck = loadCheck && load_image_cube() == 0;
+ imageStore(image_cubeArray, ivec3(0), uvec4(0));
+ loadCheck = loadCheck && load_image_cubeArray() == 0;
+ imageStore(image_2dMultiSampleArray, ivec3(0), 1, uvec4(0));
+ loadCheck = loadCheck && load_image_2dMultiSampleArray() == 0;
+ resetAllImageValues();
+ return loadCheck;
+}
+bool checkAllImageSamples()
+{
+ resetAllImageValues();
+ return true
+ && imageSamples(image_2dMultiSample) == 2
+ && imageSamples(image_2dMultiSampleArray) == 2
+ ;
+}
+bool checkAllImageAtomicAdd()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicAdd(image_1d, 0, 0) == 1
+ && load_image_1d() == 1
+ && imageAtomicAdd(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 3
+ && imageAtomicAdd(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicAdd(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 3
+ && imageAtomicAdd(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 3
+ && imageAtomicAdd(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 3
+ && imageAtomicAdd(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicAdd(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 3
+ && imageAtomicAdd(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 3
+ && imageAtomicAdd(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 3
+ && imageAtomicAdd(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 3
+ ;
+}
+bool checkAllImageAtomicExchange()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicExchange(image_1d, 0, 0) == 1
+ && load_image_1d() == 0
+ && imageAtomicExchange(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 2
+ && imageAtomicExchange(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicExchange(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 2
+ && imageAtomicExchange(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicExchange(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicExchange(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicExchange(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 2
+ && imageAtomicExchange(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 2
+ && imageAtomicExchange(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 2
+ && imageAtomicExchange(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 2
+ ;
+}
+bool checkAllImageAtomicMin()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicMin(image_1d, 0, 0) == 1
+ && load_image_1d() == 0
+ && imageAtomicMin(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 1
+ && imageAtomicMin(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicMin(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 1
+ && imageAtomicMin(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 1
+ && imageAtomicMin(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 1
+ && imageAtomicMin(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicMin(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 1
+ && imageAtomicMin(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 1
+ && imageAtomicMin(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 1
+ && imageAtomicMin(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 1
+ ;
+}
+bool checkAllImageAtomicMax()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicMax(image_1d, 0, 0) == 1
+ && load_image_1d() == 1
+ && imageAtomicMax(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 2
+ && imageAtomicMax(image_1dArray, ivec2(0), 0) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicMax(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 2
+ && imageAtomicMax(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicMax(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicMax(image_2dArray, ivec3(0), 0) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicMax(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 2
+ && imageAtomicMax(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 2
+ && imageAtomicMax(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 2
+ && imageAtomicMax(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 2
+ ;
+}
+bool checkAllImageAtomicAnd()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicAnd(image_1d, 0, 1) == 1
+ && load_image_1d() == 1
+ && imageAtomicAnd(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 0
+ && imageAtomicAnd(image_1dArray, ivec2(0), 1) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicAnd(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 0
+ && imageAtomicAnd(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 0
+ && imageAtomicAnd(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 0
+ && imageAtomicAnd(image_2dArray, ivec3(0), 1) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicAnd(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 0
+ && imageAtomicAnd(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 0
+ && imageAtomicAnd(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 0
+ && imageAtomicAnd(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 0
+ ;
+}
+bool checkAllImageAtomicOr()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicOr(image_1d, 0, 1) == 1
+ && load_image_1d() == 1
+ && imageAtomicOr(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 3
+ && imageAtomicOr(image_1dArray, ivec2(0), 1) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicOr(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 3
+ && imageAtomicOr(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 3
+ && imageAtomicOr(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 3
+ && imageAtomicOr(image_2dArray, ivec3(0), 1) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicOr(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 3
+ && imageAtomicOr(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 3
+ && imageAtomicOr(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 3
+ && imageAtomicOr(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 3
+ ;
+}
+bool checkAllImageAtomicXor()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicXor(image_1d, 0, 1) == 1
+ && load_image_1d() == 0
+ && imageAtomicXor(image_buffer, 0, 2) == 1
+ && load_image_buffer() == 3
+ && imageAtomicXor(image_1dArray, ivec2(0), 1) == 1
+ && load_image_1dArray() == 0
+ && imageAtomicXor(image_2d, ivec2(0), 2) == 1
+ && load_image_2d() == 3
+ && imageAtomicXor(image_2dRect, ivec2(0), 2) == 1
+ && load_image_2dRect() == 3
+ && imageAtomicXor(image_2dMultiSample, ivec2(0), 1, 2) == 1
+ && load_image_2dMultiSample() == 3
+ && imageAtomicXor(image_2dArray, ivec3(0), 1) == 1
+ && load_image_2dArray() == 0
+ && imageAtomicXor(image_3d, ivec3(0), 2) == 1
+ && load_image_3d() == 3
+ && imageAtomicXor(image_cube, ivec3(0), 2) == 1
+ && load_image_cube() == 3
+ && imageAtomicXor(image_cubeArray, ivec3(0), 2) == 1
+ && load_image_cubeArray() == 3
+ && imageAtomicXor(image_2dMultiSampleArray, ivec3(0), 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 3
+ ;
+}
+bool checkAllImageAtomicCompSwap()
+{
+ resetAllImageValues();
+ return true
+ && imageAtomicCompSwap(image_1d, 0, 0, 2) == 1
+ && load_image_1d() == 1
+ && imageAtomicCompSwap(image_buffer, 0, 1, 2) == 1
+ && load_image_buffer() == 2
+ && imageAtomicCompSwap(image_1dArray, ivec2(0), 0, 2) == 1
+ && load_image_1dArray() == 1
+ && imageAtomicCompSwap(image_2d, ivec2(0), 1, 2) == 1
+ && load_image_2d() == 2
+ && imageAtomicCompSwap(image_2dRect, ivec2(0), 1, 2) == 1
+ && load_image_2dRect() == 2
+ && imageAtomicCompSwap(image_2dMultiSample, ivec2(0), 1, 1, 2) == 1
+ && load_image_2dMultiSample() == 2
+ && imageAtomicCompSwap(image_2dArray, ivec3(0), 0, 2) == 1
+ && load_image_2dArray() == 1
+ && imageAtomicCompSwap(image_3d, ivec3(0), 1, 2) == 1
+ && load_image_3d() == 2
+ && imageAtomicCompSwap(image_cube, ivec3(0), 1, 2) == 1
+ && load_image_cube() == 2
+ && imageAtomicCompSwap(image_cubeArray, ivec3(0), 1, 2) == 1
+ && load_image_cubeArray() == 2
+ && imageAtomicCompSwap(image_2dMultiSampleArray, ivec3(0), 1, 1, 2) == 1
+ && load_image_2dMultiSampleArray() == 2
+ ;
+}
+
+// CHECK_GLSL: void main(
+// CHECK_SPV: OpEntryPoint
+void computeMain()
+{
+ outputBuffer.data[0] = true
+ && checkAllImageSize()
+ && checkAllImageLoad()
+ && checkAllImageStore()
+ && checkAllImageSamples()
+ && checkAllImageAtomicAdd()
+ && checkAllImageAtomicExchange()
+ && checkAllImageAtomicMin()
+ && checkAllImageAtomicMax()
+ && checkAllImageAtomicAnd()
+ && checkAllImageAtomicOr()
+ && checkAllImageAtomicXor()
+ && checkAllImageAtomicCompSwap()
+ ;
+ // BUF: 1
+} \ No newline at end of file
diff --git a/tests/glsl/ssboMemberMemoryQualifier.slang b/tests/glsl/ssboMemberMemoryQualifier.slang
new file mode 100644
index 000000000..78d029039
--- /dev/null
+++ b/tests/glsl/ssboMemberMemoryQualifier.slang
@@ -0,0 +1,54 @@
+//TEST:SIMPLE(filecheck=CHECK-GLSL): -stage compute -entry computeMain -allow-glsl -target glsl
+//TEST:SIMPLE(filecheck=CHECK-SPV): -stage compute -entry computeMain -allow-glsl -target spirv -emit-spirv-directly
+
+// due to implementation limitations (slang-check-expr.cpp, `void visitMemberExpr()`) we are unable to
+// implement and use .length with glsl vectors to test `readonly writeonly`
+//#define TEST_whenVectorLengthIsImplemented
+
+volatile buffer Block1
+{
+ restrict uint data1;
+ readonly uint data2;
+ readonly writeonly uint data3;
+ writeonly uint data4;
+ coherent uint data5;
+ volatile uint data6;
+} inputBuffer1;
+
+coherent buffer Block2 {
+ readonly vec4 member1;
+ vec4 member2;
+}inputBuffer2;
+
+buffer Block3 {
+ coherent readonly vec4 member1;
+ coherent vec4 member2;
+}inputBuffer3;
+
+buffer Block4 {
+ struct structTmp
+ {
+ int val;
+ };
+ readonly structTmp myStruct;
+ coherent readonly vec4 member1;
+ coherent vec4 member2;
+ readonly writeonly vec3 member3;
+}inputBuffer4;
+
+// CHECK-GLSL: main
+// CHECK-SPV: OpEntryPoint
+layout(local_size_x = 1) in;
+void computeMain()
+{
+ int v = inputBuffer1.data1;
+ v = inputBuffer1.data2;
+ inputBuffer1.data4 = 1;
+ inputBuffer1.data5 = 1;
+ inputBuffer1.data6 = 1;
+ inputBuffer2.member2 = inputBuffer2.member1;
+ inputBuffer3.member2 = inputBuffer3.member1;
+#ifdef TEST_whenVectorLengthIsImplemented
+ v = inputBuffer4.member3.length();
+#endif
+} \ No newline at end of file
diff --git a/tests/glsl/ssboMemberMemoryQualifierReadError.slang b/tests/glsl/ssboMemberMemoryQualifierReadError.slang
new file mode 100644
index 000000000..fe2ea1943
--- /dev/null
+++ b/tests/glsl/ssboMemberMemoryQualifierReadError.slang
@@ -0,0 +1,17 @@
+//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -allow-glsl -target glsl
+//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -allow-glsl -target spirv -emit-spirv-directly
+
+volatile buffer MyBlockName1
+{
+ readonly uint data2;
+ readonly writeonly uint data3;
+} inputBuffer1;
+
+layout(local_size_x = 1) in;
+void computeMain()
+{
+//CHECK: error 30011
+ inputBuffer1.data2 = 1;
+//CHECK: error 30011
+ inputBuffer1.data3 = 1;
+} \ No newline at end of file
diff --git a/tests/glsl/ssboMemberMemoryQualifierWriteError.slang b/tests/glsl/ssboMemberMemoryQualifierWriteError.slang
new file mode 100644
index 000000000..f4423be25
--- /dev/null
+++ b/tests/glsl/ssboMemberMemoryQualifierWriteError.slang
@@ -0,0 +1,24 @@
+//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -allow-glsl -target glsl
+//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -allow-glsl -target spirv -emit-spirv-directly
+
+volatile buffer MyBlockName1
+{
+ writeonly uint data2;
+ readonly writeonly uint data3;
+} inputBuffer1;
+
+buffer MyBlockName2
+{
+ uint data;
+} outputBuffer;
+
+layout(local_size_x = 1) in;
+void computeMain()
+{
+//CHECK: error 30101
+ int a = inputBuffer1.data2;
+//CHECK: error 30101
+ int b = inputBuffer1.data3;
+//CHECK: error 30101
+ outputBuffer.data = inputBuffer1.data2;
+} \ No newline at end of file
diff --git a/tests/glsl/ssboMemoryQualifier.slang b/tests/glsl/ssboMemoryQualifier.slang
new file mode 100644
index 000000000..67da12e9e
--- /dev/null
+++ b/tests/glsl/ssboMemoryQualifier.slang
@@ -0,0 +1,39 @@
+//TEST:SIMPLE(filecheck=CHECK-GLSL): -stage compute -entry computeMain -allow-glsl -target glsl
+//TEST:SIMPLE(filecheck=CHECK-SPV): -stage compute -entry computeMain -allow-glsl -target spirv -emit-spirv-directly
+
+volatile buffer MyBlockName1
+{
+ uint data1;
+} inputBuffer1;
+restrict buffer MyBlockName2
+{
+ uint data1;
+} inputBuffer2;
+readonly writeonly buffer MyBlockName3
+{
+ uint data1;
+} inputBuffer3;
+writeonly buffer MyBlockName4
+{
+ uint data1;
+} inputBuffer4;
+readonly buffer MyBlockName5
+{
+ uint data1;
+} inputBuffer5;
+coherent buffer MyBlockName6
+{
+ uint data1;
+} inputBuffer6;
+
+// CHECK-GLSL: main
+// CHECK-SPV: OpEntryPoint
+layout(local_size_x = 1) in;
+void computeMain()
+{
+ inputBuffer1.data1 = 1;
+ inputBuffer2.data1 = 1;
+ inputBuffer4.data1 = 1;
+ int v = inputBuffer5.data1;
+ inputBuffer6.data1 = 1;
+} \ No newline at end of file
diff --git a/tests/glsl/ssboMemoryQualifierReadError.slang b/tests/glsl/ssboMemoryQualifierReadError.slang
new file mode 100644
index 000000000..cdd47d5b2
--- /dev/null
+++ b/tests/glsl/ssboMemoryQualifierReadError.slang
@@ -0,0 +1,27 @@
+//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -allow-glsl -target glsl
+//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -allow-glsl -target spirv -emit-spirv-directly
+
+readonly writeonly buffer MyBlockName3
+{
+ uint data1;
+} inputBuffer1;
+
+readonly buffer MyBlockName5
+{
+ uint data1;
+} inputBuffer2;
+
+buffer dontOptimizeOutBlock
+{
+ uint data1;
+ uint data2;
+} optimizeBlock;
+
+layout(local_size_x = 1) in;
+void computeMain()
+{
+//CHECK: error 30011
+ inputBuffer1.data1 = optimizeBlock.data1;
+//CHECK: error 30011
+ inputBuffer2.data1 = optimizeBlock.data2;
+} \ No newline at end of file
diff --git a/tests/glsl/ssboMemoryQualifierWriteError.slang b/tests/glsl/ssboMemoryQualifierWriteError.slang
new file mode 100644
index 000000000..636641b3f
--- /dev/null
+++ b/tests/glsl/ssboMemoryQualifierWriteError.slang
@@ -0,0 +1,29 @@
+//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -allow-glsl -target glsl
+//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -allow-glsl -target spirv -emit-spirv-directly
+
+readonly writeonly buffer MyBlockName3
+{
+ uint data1;
+} inputBuffer1;
+
+writeonly buffer MyBlockName4
+{
+ uint data1;
+} inputBuffer2;
+
+buffer dontOptimizeOutBlock
+{
+ uint data1;
+ uint data2;
+} optimizeBlock;
+
+layout(local_size_x = 1) in;
+void computeMain()
+{
+//CHECK: error 30101
+ optimizeBlock.data1 = inputBuffer1.data1;
+//CHECK: error 30101
+ optimizeBlock.data2 = inputBuffer2.data1;
+//CHECK: error 30101
+ int a = inputBuffer2.data1;
+} \ No newline at end of file
diff --git a/tests/glsl/ssboStructInsideStructMemoryQualifierError.slang b/tests/glsl/ssboStructInsideStructMemoryQualifierError.slang
new file mode 100644
index 000000000..c5376b4a8
--- /dev/null
+++ b/tests/glsl/ssboStructInsideStructMemoryQualifierError.slang
@@ -0,0 +1,23 @@
+//TEST:SIMPLE(filecheck=CHECK-GLSL): -stage compute -entry computeMain -allow-glsl -target glsl
+//TEST:SIMPLE(filecheck=CHECK-SPV): -stage compute -entry computeMain -allow-glsl -target spirv -emit-spirv-directly
+
+// This code should error since memory qualifiers are only allowed inside:
+// Shader storage blocks, variables declared within shader storage blocks
+// and variables declared as image types. Named structs inside a Interface
+// block violates these rules
+// CHECK-GLSL: error
+// CHECK-SPV: error
+buffer Block4 {
+ struct StructTmp
+ {
+ readonly int val;
+ };
+ readonly structTmp myStruct;
+ coherent readonly vec4 member1;
+ coherent vec4 member2;
+}inputBuffer4;
+
+layout(local_size_x = 1) in;
+void computeMain()
+{
+} \ No newline at end of file
diff --git a/tests/nv-extensions/nv-ray-tracing-motion-blur.slang b/tests/nv-extensions/nv-ray-tracing-motion-blur.slang
index c66e69d14..753101d7e 100644
--- a/tests/nv-extensions/nv-ray-tracing-motion-blur.slang
+++ b/tests/nv-extensions/nv-ray-tracing-motion-blur.slang
@@ -20,7 +20,7 @@ struct Uniforms
};
ConstantBuffer<Uniforms> ubo;
-layout(rgba8)
+layout(rgba32f)
RWTexture2D<float4> outputImage;
RaytracingAccelerationStructure as;
diff --git a/tests/vkray/raygen.slang b/tests/vkray/raygen.slang
index 9ba88095d..18ac74d4b 100644
--- a/tests/vkray/raygen.slang
+++ b/tests/vkray/raygen.slang
@@ -22,7 +22,7 @@ struct Uniforms
ConstantBuffer<Uniforms> ubo;
-layout(rgba8)
+layout(rgba32f)
RWTexture2D<float4> outputImage;
RaytracingAccelerationStructure as;