]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/ternary_operand_type_mismatch.glsl
Implement the ternary operator in GLSL
[libs/gl.git] / tests / glsl / ternary_operand_type_mismatch.glsl
diff --git a/tests/glsl/ternary_operand_type_mismatch.glsl b/tests/glsl/ternary_operand_type_mismatch.glsl
new file mode 100644 (file)
index 0000000..5eae47d
--- /dev/null
@@ -0,0 +1,30 @@
+uniform Colors
+{
+       vec4 color;
+       float gray;
+};
+uniform sampler2D mask;
+uniform Transform
+{
+       mat4 mvp;
+} transform;
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+layout(location=1) in vec2 texcoord;
+void main()
+{
+       passthrough;
+       gl_Position = transform.mvp*position;
+}
+
+#pragma MSP stage(fragment)
+layout(location=0) out vec4 frag_color;
+void main()
+{
+       frag_color = texture(mask, texcoord).r > 0.5 ? color : gray;
+}
+
+/* Expected error:
+<test>:25: Ternary operator has incompatible types 'vec4' and 'float'
+*/