summaryrefslogtreecommitdiffstats
path: root/tests/spirv
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-02-10 23:48:07 -0800
committerGitHub <noreply@github.com>2025-02-11 15:48:07 +0800
commit0bc18d233966fc80cf2c482922d0b773d58394ca (patch)
tree5c18ca0f3d9bc81bed3bfb79f710c1536bd26f00 /tests/spirv
parent3c2d46aa1c8575dc046d7457793e77c7a4789093 (diff)
Emit missing atomic64 capability, fix int-typed builtin used in both vs and fs. (#6314)
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'tests/spirv')
-rw-r--r--tests/spirv/atomic-64bit.slang13
-rw-r--r--tests/spirv/view-id.slang19
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/spirv/atomic-64bit.slang b/tests/spirv/atomic-64bit.slang
new file mode 100644
index 000000000..2b8220dd0
--- /dev/null
+++ b/tests/spirv/atomic-64bit.slang
@@ -0,0 +1,13 @@
+//TEST:SIMPLE(filecheck=CHECK):-target spirv
+
+// CHECK: OpCapability Int64Atomics
+
+groupshared Atomic<uint64_t> atomicVariable;
+
+[shader("compute")]
+[numthreads(1, 1, 1)]
+void main(uint3 threadId : SV_DispatchThreadID)
+{
+ uint64_t value = 4ll;
+ atomicVariable.store(value);
+} \ No newline at end of file
diff --git a/tests/spirv/view-id.slang b/tests/spirv/view-id.slang
new file mode 100644
index 000000000..9df3168a4
--- /dev/null
+++ b/tests/spirv/view-id.slang
@@ -0,0 +1,19 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+
+// ViewIndex builtin should be declared twice, once for vertex and once for fragment shader.
+// Because the fragment shader builtin needs Flat, and vertex shader does not.
+
+// CHECK: OpDecorate %{{.*}} BuiltIn ViewIndex
+// CHECK: OpDecorate %{{.*}} BuiltIn ViewIndex
+
+[shader("vertex")]
+float4 vert(int _viewportIndex : SV_ViewID):SV_Position
+{
+ return float4(_viewportIndex);
+}
+
+[shader("fragment")]
+float4 frag(int _viewportIndex : SV_ViewID) : SV_Target
+{
+ return float4(_viewportIndex, 0, 0, 1);
+} \ No newline at end of file