]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/invalid_constructors.glsl
Resolve and validate the parameters of constructors in GLSL
[libs/gl.git] / tests / glsl / invalid_constructors.glsl
diff --git a/tests/glsl/invalid_constructors.glsl b/tests/glsl/invalid_constructors.glsl
new file mode 100644 (file)
index 0000000..f9d7a04
--- /dev/null
@@ -0,0 +1,21 @@
+#pragma MSP stage(vertex)
+void main()
+{
+       float f = float();
+       vec3 v = vec3(f, f);
+       vec3 u = vec3(v, 1.0);
+       vec3 w = vec3(v.xy, vec2(3.0, 4.0));
+       mat3 m = mat3(v, u);
+       mat3 m2 = mat3(v, v, u, u);
+       mat2 m3 = mat2(v, 1.0);
+}
+
+/* Expected error:
+<test>:4: No matching constructor found for 'float()'
+<test>:5: No matching constructor found for 'vec3(float, float)'
+<test>:6: No matching constructor found for 'vec3(vec3, float)'
+<test>:7: No matching constructor found for 'vec3(vec2, vec2)'
+<test>:8: No matching constructor found for 'mat3(vec3, vec3)'
+<test>:9: No matching constructor found for 'mat3(vec3, vec3, vec3, vec3)'
+<test>:10: No matching constructor found for 'mat2(vec3, float)'
+*/