summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/metal/texture.slang6
-rw-r--r--tests/spirv/array-resource.slang1
-rw-r--r--tests/spirv/discard.slang22
-rw-r--r--tests/spirv/spv-version.slang18
4 files changed, 43 insertions, 4 deletions
diff --git a/tests/metal/texture.slang b/tests/metal/texture.slang
index a23ca16dd..3c6237488 100644
--- a/tests/metal/texture.slang
+++ b/tests/metal/texture.slang
@@ -5,7 +5,7 @@
//TEST:SIMPLE(filecheck=SPIR): -stage compute -entry computeMain -target spirv -emit-spirv-directly -DEMIT_SOURCE
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=FUNCTIONAL):-slang -compute -dx12 -profile cs_6_6 -use-dxil -shaderobj -output-using-type
-//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=FUNCTIONAL):-vk -emit-spirv-directly -compute -shaderobj -output-using-type -render-feature hardware-device
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=FUNCTIONAL):-vk -emit-spirv-directly -compute -shaderobj -output-using-type -render-feature hardware-device -xslang -DEXCLUDE_DEPTH_TEXTURE
// METAL_CAPS_ERROR: error 36107
@@ -450,10 +450,10 @@ bool TEST_texture_float()
// METALLIB: call {{.*}}.sample_texture_2d_array.v4f32(
&& all(Tv(1) == t2DArray.SampleLevel(samplerState, float3(u, u, 0), 0, int2(1, 1)))
+#ifndef EXCLUDE_DEPTH_TEXTURE // Our vulkan backend don't support SampleCmp from a rgb texture.
// ==================
// float SampleCmp()
// ==================
-
// METAL: d2D{{.*}}.sample_compare(
// METALLIB: call {{.*}}.sample_compare_depth_2d.f32(
&& float(1) == d2D.SampleCmp(shadowSampler, float2(u, u), 0)
@@ -501,7 +501,7 @@ bool TEST_texture_float()
// METAL: d2D{{.*}}.sample_compare(
// METALLIB: call {{.*}}.sample_compare_depth_2d.f32(
&& float(1) == d2D.SampleCmpLevelZero(shadowSampler, float2(u2, u), 0, int2(0, 0))
-
+#endif
// ==================================
// vector<T,4> Gather()
// ==================================
diff --git a/tests/spirv/array-resource.slang b/tests/spirv/array-resource.slang
index b6edf9b27..69eafc98a 100644
--- a/tests/spirv/array-resource.slang
+++ b/tests/spirv/array-resource.slang
@@ -20,6 +20,5 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
uint threadId = dispatchThreadID.x;
resultBuffer[threadId] = inputBuffers[0][threadId] + inputBuffers[1][threadId];
// CHECK: OpCapability RuntimeDescriptorArray
- // CHECK: OpExtension "SPV_EXT_descriptor_indexing"
// BUFFER: 3
}
diff --git a/tests/spirv/discard.slang b/tests/spirv/discard.slang
new file mode 100644
index 000000000..e0859371e
--- /dev/null
+++ b/tests/spirv/discard.slang
@@ -0,0 +1,22 @@
+//TEST:SIMPLE(filecheck=SPV16): -target spirv -profile spirv_1_6
+//TEST:SIMPLE(filecheck=SPV15): -target spirv -profile spirv_1_5
+//TEST:SIMPLE(filecheck=SPV14): -target spirv -profile spirv_1_4+SPV_EXT_demote_to_helper_invocation
+
+uniform int a;
+
+// Test that we translate `discard` to OpDemoateToHelperInvocation
+// when targeting SPIRV 1.6, and to OpKill when targeting SPIRV 1.5.
+// If the user explicitly specified SPV_EXT_demote_to_helper_invocation
+// in the profile, we will also emit OpDemoteToHelperInvocation.
+
+//SPV16: OpDemoteToHelperInvocation
+//SPV15: OpKill
+//SPV14: OpDemoteToHelperInvocation
+
+[shader("fragment")]
+float4 frag() : SV_Target
+{
+ if (a == 0)
+ discard;
+ return 0;
+} \ No newline at end of file
diff --git a/tests/spirv/spv-version.slang b/tests/spirv/spv-version.slang
new file mode 100644
index 000000000..e9cc81929
--- /dev/null
+++ b/tests/spirv/spv-version.slang
@@ -0,0 +1,18 @@
+//TEST:SIMPLE(filecheck=SPIRV15): -target spirv
+
+//TEST:SIMPLE(filecheck=SPIRV14): -target spirv -profile spirv_1_4
+
+// Test that we can use -profile to control the resulting spirv version.
+
+// By default, we emit spirv 1.5
+
+// SPIRV15: Version: 1.5
+
+// If the user specified an explicit spirv version, we will use it.
+// SPIRV14: Version: 1.4
+
+[numthreads(1,1,1)]
+void main()
+{
+
+} \ No newline at end of file