summaryrefslogtreecommitdiffstats
path: root/tests/spirv
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-12-09 04:48:28 -0800
committerGitHub <noreply@github.com>2024-12-09 20:48:28 +0800
commitebfbe5886f273e0492321c5ff0c9c2671583a648 (patch)
treeb8d0665e5b97587d19a458f9d4284aa4818dc717 /tests/spirv
parentef81bde5e5f7d52abb7b3f851d9a5f48b79359ad (diff)
Add SV_DrawIndex. (#5787)
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'tests/spirv')
-rw-r--r--tests/spirv/draw-index.slang18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/spirv/draw-index.slang b/tests/spirv/draw-index.slang
new file mode 100644
index 000000000..9020eb8b4
--- /dev/null
+++ b/tests/spirv/draw-index.slang
@@ -0,0 +1,18 @@
+//TEST:SIMPLE(filecheck=SPIRV): -target spirv
+//TEST:SIMPLE(filecheck=SPIRV): -target spirv -entry vsMain -stage vertex -emit-spirv-via-glsl
+//TEST:SIMPLE(filecheck=GLSL): -target glsl -entry vsMain -stage vertex
+
+// SPIRV: OpDecorate %{{.*}} BuiltIn DrawIndex
+// GLSL: gl_DrawID
+
+struct VertexIn
+{
+ float3 position;
+ int drawIndex : SV_DrawIndex;
+}
+
+[shader("vertex")]
+float4 vsMain(VertexIn vin) : SV_Position
+{
+ return float4(vin.position, vin.drawIndex);
+}