From ebfbe5886f273e0492321c5ff0c9c2671583a648 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 9 Dec 2024 04:48:28 -0800 Subject: Add SV_DrawIndex. (#5787) Co-authored-by: Ellie Hermaszewska --- tests/spirv/draw-index.slang | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/spirv/draw-index.slang (limited to 'tests') 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); +} -- cgit v1.2.3