summaryrefslogtreecommitdiffstats
path: root/tests/glsl
diff options
context:
space:
mode:
authorDarren Wihandi <65404740+fairywreath@users.noreply.github.com>2025-04-04 21:02:16 -0400
committerGitHub <noreply@github.com>2025-04-05 01:02:16 +0000
commit680fb0b4e9cbb65d46677183a3f68630be1f6179 (patch)
treef6168b68bfa4e4e0e9fcd10bbb1e137cefac67b3 /tests/glsl
parente3e84a1682c9e2d371f3f50f6425374c8b04828d (diff)
Fix crash when using GLSL global uniforms and varying inputs/ouputs together (#6651)
* Fix incorrect assert on mixed global uniform and varyings * add test * remove unnecessary include * fix incorrect logic * fix comment grammar * address review comments and improve test * minimize diff * fix more issues for cuda build * remove unnecessary line for diff
Diffstat (limited to 'tests/glsl')
-rw-r--r--tests/glsl/global-uniform-with-varyings.slang30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/glsl/global-uniform-with-varyings.slang b/tests/glsl/global-uniform-with-varyings.slang
new file mode 100644
index 000000000..678855dbf
--- /dev/null
+++ b/tests/glsl/global-uniform-with-varyings.slang
@@ -0,0 +1,30 @@
+//TEST:SIMPLE(filecheck=CHECK_SPIRV): -target spirv -entry main -stage vertex
+//TEST:SIMPLE(filecheck=CHECK_GLSL): -target glsl -entry main -stage vertex
+
+// CHECK_SPIRV: OpEntryPoint
+// CHECK_SPIRV: OpVariable {{.*}} Input {{.*}} Location 0
+// CHECK_SPIRV: OpVariable {{.*}} Uniform
+// CHECK_SPIRV: OpVariable {{.*}} Input {{.*}} Location 1
+// CHECK_SPIRV: OpVariable {{.*}} Output {{.*}} Location 0
+
+// CHECK_GLSL: layout(location = 0)
+// CHECK_GLSL-NEXT: in
+// CHECK_GLSL: layout(location = 1)
+// CHECK_GLSL-NEXT: in
+// CHECK_GLSL: layout(std140) uniform
+// CHECK_GLSL: layout(location = 0)
+// CHECK_GLSL-NEXT: out
+// CHECK_GLSL: void main
+
+#version 330 core
+layout(location=0) in float3 a_position;
+layout(location=1) in float4 a_color;
+
+out float4 v_color;
+
+uniform matrix<float,4,4> u_transform;
+
+void main() {
+ gl_Position = u_transform * vec4(a_position, 1.0);
+ v_color = a_color;
+}