]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/unused_component_assignment.glsl
Track composite assignments and references in UnusedVariableRemover
[libs/gl.git] / tests / glsl / unused_component_assignment.glsl
diff --git a/tests/glsl/unused_component_assignment.glsl b/tests/glsl/unused_component_assignment.glsl
new file mode 100644 (file)
index 0000000..0febd56
--- /dev/null
@@ -0,0 +1,33 @@
+uniform mat4 mvp;
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+int main()
+{
+       vec4 c0 = mvp[0]*position;
+       vec4 c1 = mvp[1]*position;
+       vec4 c2 = mvp[2]*position;
+       vec4 c3 = mvp[3]*position;
+       vec4 clip_pos;
+       clip_pos.x = c0.x+c1.x+c2.x+c3.x;
+       clip_pos.y = c0.y+c1.y+c2.y+c3.y;
+       clip_pos.z = c0.z+c1.z+c2.z+c3.z;
+       clip_pos.w = c0.w+c1.w+c2.w+c3.w;
+       gl_Position = vec4(clip_pos.xy, 0.0, 1.0);
+}
+
+/* Expected output: vertex
+layout(location=0) uniform mat4 mvp;
+layout(location=0) in vec4 position;
+int main()
+{
+  vec4 c0 = mvp[0]*position;
+  vec4 c1 = mvp[1]*position;
+  vec4 c2 = mvp[2]*position;
+  vec4 c3 = mvp[3]*position;
+  vec4 clip_pos;
+  clip_pos.x = c0.x+c1.x+c2.x+c3.x;
+  clip_pos.y = c0.y+c1.y+c2.y+c3.y;
+  gl_Position = vec4(clip_pos.xy, 0.0, 1.0);
+}
+*/