]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/matrix_from_elements.glsl
Fix GLSL matrix construction from individual elements
[libs/gl.git] / tests / glsl / matrix_from_elements.glsl
diff --git a/tests/glsl/matrix_from_elements.glsl b/tests/glsl/matrix_from_elements.glsl
new file mode 100644 (file)
index 0000000..42b1655
--- /dev/null
@@ -0,0 +1,31 @@
+uniform Transform
+{
+       vec3 translation;
+       float rotation;
+};
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec2 position;
+void main()
+{
+       float c = cos(rotation);
+       float s = sin(rotation);
+       mat3 m = mat3(c, s, 0.0, -s, c, 0.0, translation);
+       gl_Position = vec4((m*vec3(position, 1.0)).xy, 0.0, 1.0);
+}
+
+/* Expected output: vertex
+layout(binding=48) uniform Transform
+{
+       vec3 translation;
+       float rotation;
+};
+layout(location=0) in vec2 position;
+void main()
+{
+       float c = cos(rotation);
+       float s = sin(rotation);
+
+       gl_Position = vec4((mat3(vec3(c, s, 0.0), vec3(-s, c, 0.0), translation)*vec3(position, 1.0)).xy, 0.0, 1.0);
+}
+*/