From 6f2ce72b038b34e84819ddfc5d658166ed879eaa Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 27 Feb 2025 16:57:52 -0800 Subject: Map `SV_InstanceID` to `gl_InstanceIndex-gl_BaseInstance` (#6468) * Map `SV_InstanceID` to `gl_InstanceIndex-gl_BaseInstance` * Fix ci. --- tests/spirv/sv_instance.slang | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/spirv/sv_instance.slang (limited to 'tests/spirv') diff --git a/tests/spirv/sv_instance.slang b/tests/spirv/sv_instance.slang new file mode 100644 index 000000000..e71c6c7fa --- /dev/null +++ b/tests/spirv/sv_instance.slang @@ -0,0 +1,14 @@ +//TEST:SIMPLE(filecheck=GLSL): -target glsl -entry vertMain -stage vertex +//TEST:SIMPLE(filecheck=CHECK): -target spirv + +// CHECK-DAG: %[[REG1:[0-9a-zA-Z_]+]] = OpLoad %int %gl_BaseInstance +// CHECK-DAG: %[[REG2:[0-9a-zA-Z_]+]] = OpLoad %int %gl_InstanceIndex +// CHECK-DAG: OpISub %int %[[REG2]] %[[REG1]] + +// GLSL: gl_InstanceIndex - gl_BaseInstance + +[shader("vertex")] +float4 vertMain(int i : SV_InstanceID) : SV_Position +{ + return i; +} \ No newline at end of file -- cgit v1.2.3