summaryrefslogtreecommitdiff
path: root/tests/glsl-intrinsic
diff options
context:
space:
mode:
authorDarren Wihandi <65404740+fairywreath@users.noreply.github.com>2024-12-20 01:00:20 -0500
committerGitHub <noreply@github.com>2024-12-19 22:00:20 -0800
commita00db74d1afa717dd90dfcf3170c63d0d1c0d3d7 (patch)
tree0e286826852990c9fb5b4e531a5b3eeb1da48f96 /tests/glsl-intrinsic
parent2e9605e79c64315ecad7ae8297d996ae2ed4687b (diff)
Add base vertex and base instance system values (#5918)
* Add base vertex and base instance system values * Fixed incorrect stage in tests
Diffstat (limited to 'tests/glsl-intrinsic')
-rw-r--r--tests/glsl-intrinsic/system-values-draw-parameters.slang19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/glsl-intrinsic/system-values-draw-parameters.slang b/tests/glsl-intrinsic/system-values-draw-parameters.slang
new file mode 100644
index 000000000..a58305c13
--- /dev/null
+++ b/tests/glsl-intrinsic/system-values-draw-parameters.slang
@@ -0,0 +1,19 @@
+//TEST:SIMPLE(filecheck=CHECK_SPIRV): -entry main -stage vertex -target spirv
+//TEST:SIMPLE(filecheck=CHECK_GLSL): -entry main -stage vertex -target glsl
+//TEST:SIMPLE(filecheck=CHECK_HLSL): -entry main -stage vertex -target hlsl
+//TEST:SIMPLE(filecheck=CHECK_METAL): -entry main -stage vertex -target metal
+
+#version 460
+
+void main()
+{
+ float x = float(gl_VertexIndex + gl_BaseVertex) * 0.1f;
+ float y = float(gl_InstanceIndex + gl_BaseInstance) * 0.2f;
+ gl_Position = vec4(x, y, 0.0f, 1.0f); // Output 2D position with z=0 and w=1.
+
+ // CHECK_SPIRV: BuiltIn BaseInstance
+ // CHECK_GLSL: gl_BaseInstance
+ // CHECK_HLSL: SV_StartInstanceLocation
+ // CHECK_METAL: base_instance
+}
+