Skip to content

Commit

Permalink
Merge pull request #1186 from Oletus/global-ternary-test
Browse files Browse the repository at this point in the history
Add new tests for ternary operators in global initializers
  • Loading branch information
kenrussell committed Sep 4, 2015
2 parents 0134765 + 01289fb commit 7884b1c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions sdk/tests/conformance/glsl/misc/global-variable-init.html
Expand Up @@ -166,6 +166,26 @@
gl_Position = aPosition;
}
</script>
<script id="globalNonConstTernary" type="x-shader/x-fragment">
precision mediump float;
float green = 1.0;
float black = 0.0;
float f = true ? green : black;

void main() {
gl_FragColor = vec4(0.0, f, 0.0, 1.0);
}
</script>
<script id="globalUniformTernary" type="x-shader/x-fragment">
precision mediump float;
uniform float u_zero;
float green = 1.0 + u_zero;
float f = true ? green : u_zero;

void main() {
gl_FragColor = vec4(0.0, f, 0.0, 1.0);
}
</script>
<script type="application/javascript">
"use strict";
description();
Expand Down Expand Up @@ -231,6 +251,20 @@
vShaderSuccess: false,
linkSuccess: false,
passMsg: "Another global as an l-value (parameter of ++) in a global variable initializer should not be accepted by WebGL."
},
{
fShaderId: "globalNonConstTernary",
fShaderSuccess: true,
linkSuccess: true,
render: true,
passMsg: "Non-const global variables as operands for a ternary operator in a global variable initializer should be accepted by WebGL."
},
{
fShaderId: "globalUniformTernary",
fShaderSuccess: true,
linkSuccess: true,
render: true,
passMsg: "An uniform as an operand for a ternary operator in a global variable initializer should be accepted by WebGL."
}
]);
var successfullyParsed = true;
Expand Down

0 comments on commit 7884b1c

Please sign in to comment.