diff options
Diffstat (limited to 'tests')
4 files changed, 130 insertions, 0 deletions
diff --git a/tests/language-feature/capability/capability7.slang b/tests/language-feature/capability/capability7.slang new file mode 100644 index 000000000..21f3d68e4 --- /dev/null +++ b/tests/language-feature/capability/capability7.slang @@ -0,0 +1,52 @@ +//TEST:SIMPLE(filecheck=CHECK): -target glsl -entry computeMain -stage compute -profile sm_5_0 +//TEST:SIMPLE(filecheck=CHECK_IGNORE_CAPS): -target glsl -emit-spirv-directly -entry computeMain -stage compute -profile sm_5_0 -ignore-capabilities + +// Test that we diagnose simplified capabilities +// CHECK_IGNORE_CAPS-NOT: error 36104 +// CHECK-NOT: sm_4_0 +// CHECK-NOT: sm_5_0 +// CHECK-NOT: sm_5_1 +// CHECK: error 36104: 'processDataBad' uses undeclared capability 'sm_6_0' +// CHECK: capability7.slang(28): note: see using of 'processDataBadNested' +// CHECK: capability7.slang(20): note: see definition of 'processDataBadNested' + + +[require(glsl_hlsl_metal_spirv)] +void processDataGood() +{ +} + +[require(hlsl, sm_6_0)] +void processDataBadNested() +{ + AllMemoryBarrier(); +} + +[require(hlsl)] +void processDataBad() +{ + processDataBadNested(); +} + +void myNestedNestedSafeCall() +{ + processDataGood(); +} + +void myNestedNestedBadCall() +{ + processDataGood(); + processDataBad(); +} + +void myNestedCall() +{ + myNestedNestedSafeCall(); + myNestedNestedBadCall(); +} + +[numthreads(1,1,1)] +void computeMain() +{ + myNestedCall(); +} diff --git a/tests/language-feature/capability/capabilitySimplification1.slang b/tests/language-feature/capability/capabilitySimplification1.slang new file mode 100644 index 000000000..b694673e9 --- /dev/null +++ b/tests/language-feature/capability/capabilitySimplification1.slang @@ -0,0 +1,34 @@ +//TEST:SIMPLE(filecheck=CHECK): -target glsl -entry computeMain -stage compute -profile sm_5_0 +//TEST:SIMPLE(filecheck=CHECK_IGNORE_CAPS): -target glsl -emit-spirv-directly -entry computeMain -stage compute -profile sm_5_0 -ignore-capabilities + + +// CHECK_IGNORE_CAPS-NOT: error 36107 + +// CHECK: error 36107 +// CHECK-SAME: entrypoint 'computeMain' does not support compilation target 'glsl' with stage 'compute' +// CHECK: capabilitySimplification1.slang(21): note: see using of 'WaveMultiPrefixProduct' +// CHECK-NOT: see using of 'WaveMultiPrefixProduct' +// CHECK: {{.*}}.meta.slang({{.*}}): note: see definition of 'WaveMultiPrefixProduct' +// CHECK: {{.*}}.meta.slang({{.*}}): note: see declaration of 'require' + +void nestedSafeCall() +{ + AllMemoryBarrier(); +} + +void nestedBadCall() +{ + WaveMultiPrefixProduct(1, 0); +} + +void nestedCall() +{ + nestedSafeCall(); + nestedBadCall(); +} + +[numthreads(1,1,1)] +void computeMain() +{ + nestedCall(); +} diff --git a/tests/language-feature/capability/capabilitySimplification2.slang b/tests/language-feature/capability/capabilitySimplification2.slang new file mode 100644 index 000000000..8d96884ce --- /dev/null +++ b/tests/language-feature/capability/capabilitySimplification2.slang @@ -0,0 +1,27 @@ +//TEST:SIMPLE(filecheck=SPIRV): -target spirv -emit-spirv-directly -entry computeMain -stage compute -profile sm_5_0 +//TEST:SIMPLE(filecheck=GLSL): -target glsl -entry computeMain -stage compute -profile sm_5_0 +//TEST:SIMPLE(filecheck=HLSL): -target hlsl -entry computeMain -stage compute -profile sm_5_0 +//TEST:SIMPLE(filecheck=CHECK_IGNORE_CAPS): -target spirv -emit-spirv-directly -entry computeMain -stage compute -profile sm_5_0 -ignore-capabilities + + +// CHECK_IGNORE_CAPS-NOT: warning 41012 + +// SPIRV: warning 41012 +// SPIRV-NOT: spirv_1_2 +// SPIRV-NOT: spirv_1_3 +// SPIRV-SAME: spvGroupNonUniformBallot + +// GLSL: warning 41012 +// GLSL-NOT: GLSL_400 +// GLSL-NOT: GLSL_430 +// GLSL-SAME: GL_KHR_shader_subgroup_ballot + +// HLSL: warning 41012 +// HLSL-NOT: sm_5_1 +// HLSL-SAME: sm_6_0 + +[require(sm_6_0)] +[numthreads(1,1,1)] +void computeMain() +{ +} diff --git a/tests/language-feature/capability/capabilitySimplification3.slang b/tests/language-feature/capability/capabilitySimplification3.slang new file mode 100644 index 000000000..faf161d15 --- /dev/null +++ b/tests/language-feature/capability/capabilitySimplification3.slang @@ -0,0 +1,17 @@ +//TEST:SIMPLE(filecheck=CHECK): -target glsl -entry computeMain -stage compute -profile sm_5_0 +//TEST:SIMPLE(filecheck=CHECK_IGNORE_CAPS): -target glsl -emit-spirv-directly -entry computeMain -stage compute -profile sm_5_0 -ignore-capabilities + + +// CHECK_IGNORE_CAPS-NOT: error 36107 + +// CHECK: error 36107: entrypoint 'computeMain' does not support compilation target 'glsl' with stage 'compute' +// CHECK: capabilitySimplification3.slang(16): note: see using of 'WaveMultiPrefixProduct' +// CHECK-NOT: see using of 'WaveMultiPrefixProduct' +// CHECK: {{.*}}.meta.slang({{.*}}): note: see definition of 'WaveMultiPrefixProduct' +// CHECK: {{.*}}.meta.slang({{.*}}): note: see declaration of 'require' + +[numthreads(1,1,1)] +void computeMain() +{ + WaveMultiPrefixProduct(1, 0); +} |
