Commit 3cbeffb7 authored by Ian Romanick's avatar Ian Romanick

Add tests for illegal uses of the logical-not operator

Interestingly, only invalid-logic-not-06.vert reproduces Mesa bug #33314.
parent bba2c28b
// [config]
// expect_result: fail
// glsl_version: 1.10
// [end config]
#ifdef GL_ES
precision mediump float;
#endif
uniform int a;
void main() {
// a is not boolean, so the logical not operator cannot be applied
// to it.
if (!a)
gl_Position = vec4(0.0);
else
gl_Position = vec4(1.0);
}
// [config]
// expect_result: fail
// glsl_version: 1.10
// [end config]
#ifdef GL_ES
precision mediump float;
#endif
void main() {
// "0" is not boolean, so the logical not operator cannot be applied
// to it.
if (!0)
gl_Position = vec4(0.0);
else
gl_Position = vec4(1.0);
}
// [config]
// expect_result: fail
// glsl_version: 1.10
// [end config]
#ifdef GL_ES
precision mediump float;
#endif
uniform int a;
void main() {
// a is not boolean, so the logical-not operator cannot be applied
// to it. Further, the result of the logical-not operator is boolean,
// so it cannot be assigned to a variable of type int.
int x = !a;
gl_Position = vec4(x);
}
// [config]
// expect_result: fail
// glsl_version: 1.10
// [end config]
#ifdef GL_ES
precision mediump float;
#endif
void main() {
// "0" is not boolean, so the logical-not operator cannot be applied
// to it. Further, the result of the logical-not operator is boolean,
// so it cannot be assigned to a variable of type int.
int x = !0;
gl_Position = vec4(x);
}
// [config]
// expect_result: fail
// glsl_version: 1.10
// [end config]
#ifdef GL_ES
precision mediump float;
#endif
uniform int a;
void A(int x) { }
void main() {
// a is not boolean, so the logical-not operator cannot be applied
// to it.
A(!a);
gl_Position = vec4(0.0);
}
// [config]
// expect_result: fail
// glsl_version: 1.10
// [end config]
#ifdef GL_ES
precision mediump float;
#endif
void A(int x) { }
void main() {
// "0" is not boolean, so the logical-not operator cannot be applied
// to it.
A(!0);
gl_Position = vec4(0.0);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment