2 Copyright (c) 2019 The Khronos Group Inc.
3 Use of this source code is governed by an MIT-style license that can be
4 found in the LICENSE.txt file.
10 <meta charset=
"utf-8">
11 <title>GLSL vector/scalar arithmetic inside a for loop (complex cases)
</title>
12 <link rel=
"stylesheet" href=
"../../../resources/js-test-style.css"/>
13 <script src=
"../../../js/js-test-pre.js"></script>
14 <script src=
"../../../js/webgl-test-utils.js"></script>
15 <script src=
"../../../js/glsl-conformance-test.js"></script>
18 <div id=
"description"></div>
19 <div id=
"console"></div>
20 <script id=
"fShaderVectorCompoundMulAndAddInSeparateStatementsInsideForLoop" type=
"x-shader/x-fragment">
21 precision mediump float;
24 gl_FragColor = vec4(
0.0,
0.0,
0.0,
0.0);
25 for (int i =
0; i <
2; i++)
27 float x = gl_FragCoord.x;
29 gl_FragColor = gl_FragColor + vec4(y, y, y, y);
31 if (gl_FragColor.g == gl_FragColor.r &&
32 gl_FragColor.b == gl_FragColor.r &&
33 gl_FragColor.a == gl_FragColor.r)
35 gl_FragColor = vec4(
0,
1,
0,
1);
39 <script id=
"fShaderVectorCompoundMulAndAddInSeparateStatementsInsideForLoop2" type=
"x-shader/x-fragment">
40 precision mediump float;
43 gl_FragColor = vec4(
0.0,
0.0,
0.0,
0.0);
44 for (int i =
0; i <
2; i++)
46 float x = gl_FragCoord.x;
48 gl_FragColor = gl_FragColor + vec4(x, y, x, y);
50 if (gl_FragColor.g == gl_FragColor.r &&
51 gl_FragColor.b == gl_FragColor.r &&
52 gl_FragColor.a == gl_FragColor.r)
54 gl_FragColor = vec4(
0,
1,
0,
1);
58 <script type=
"text/javascript">
62 // See http://crbug.com/772651
64 GLSLConformanceTester
.runRenderTests([
66 fShaderId
: 'fShaderVectorCompoundMulAndAddInSeparateStatementsInsideForLoop',
69 passMsg
: "Adding a vector that's just 4 copies of a scalar to another vector inside for loop should work."
72 fShaderId
: 'fShaderVectorCompoundMulAndAddInSeparateStatementsInsideForLoop2',
75 passMsg
: "Adding a vector that's just 4 copies of a scalar stored in two different variables to another vector inside for loop should work."