summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/glsl-intrinsic/intrinsic-basic.slang2
-rw-r--r--tests/metal/barrier.slang18
-rw-r--r--tests/metal/discard.slang22
3 files changed, 40 insertions, 2 deletions
diff --git a/tests/glsl-intrinsic/intrinsic-basic.slang b/tests/glsl-intrinsic/intrinsic-basic.slang
index d374f0f84..6bd4e7fe0 100644
--- a/tests/glsl-intrinsic/intrinsic-basic.slang
+++ b/tests/glsl-intrinsic/intrinsic-basic.slang
@@ -2,8 +2,6 @@
//TEST:SIMPLE(filecheck=CHECK_GLSL_SPIRV): -allow-glsl -stage compute -entry computeMain -target spirv
//TEST:SIMPLE(filecheck=CHECK_SPIR): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly
//TEST:SIMPLE(filecheck=CHECK_HLSL): -allow-glsl -stage compute -entry computeMain -target hlsl
-//TEST:SIMPLE(filecheck=CHECK_CUDA): -allow-glsl -stage compute -entry computeMain -target cuda -DTARGET_CUDA
-//TEST:SIMPLE(filecheck=CHECK_CPP): -allow-glsl -stage compute -entry computeMain -target cpp
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -output-using-type -emit-spirv-via-glsl
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -output-using-type -emit-spirv-directly
diff --git a/tests/metal/barrier.slang b/tests/metal/barrier.slang
new file mode 100644
index 000000000..86e4265be
--- /dev/null
+++ b/tests/metal/barrier.slang
@@ -0,0 +1,18 @@
+//TEST:SIMPLE(filecheck=CHECK): -target metal
+//TEST:SIMPLE(filecheck=CHECK-ASM): -target metallib
+
+// CHECK: threadgroup_barrier
+
+// CHECK-ASM: define void @computeMain
+
+RWStructuredBuffer<float> outputBuffer;
+
+[numthreads(1,1,1)]
+void computeMain()
+{
+ outputBuffer[0] = 1;
+ GroupMemoryBarrierWithGroupSync();
+ outputBuffer[1] = 2;
+ AllMemoryBarrierWithGroupSync();
+ outputBuffer[2] = 3;
+} \ No newline at end of file
diff --git a/tests/metal/discard.slang b/tests/metal/discard.slang
new file mode 100644
index 000000000..7c2622561
--- /dev/null
+++ b/tests/metal/discard.slang
@@ -0,0 +1,22 @@
+//TEST:SIMPLE(filecheck=CHECK): -target metal
+//TEST:SIMPLE(filecheck=CHECK-ASM): -target metallib
+
+// CHECK: discard_fragment();
+
+// CHECK-ASM: define {{.*}} @main_fragment1
+
+struct VOut
+{
+ float4 position : SV_Position;
+ float4 vertexColor;
+ float2 vertexUV;
+ float3 vertexNormal : NORMAL;
+}
+
+[shader("fragment")]
+float4 main_fragment1(VOut fragmentIn)
+{
+ if (fragmentIn.vertexColor.x == 0.0)
+ discard;
+ return fragmentIn.vertexColor;
+} \ No newline at end of file