Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / glsl3 / gradient-in-discontinuous-loop.html
blobdb13d61f6e546a7df66d478e0b1458d218a72a11
1 <!--
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.
5 -->
7 <!DOCTYPE html>
8 <html>
9 <head>
10 <meta charset="utf-8">
11 <title>Short circuit in loop condition test</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 </head>
16 <body>
17 <div id="description"></div>
18 <div id="console"></div>
19 <script id="vertex-shader" type="x-shader/x-vertex">#version 300 es
20 precision highp float;
21 in vec4 aPosition;
23 void main() {
24 gl_Position = aPosition;
26 </script>
27 <script id="fragment-shader" type="x-shader/x-fragment">#version 300 es
28 precision highp float;
29 precision highp int;
31 uniform vec4 iMouse;
32 uniform sampler2D iChannel0;
34 float map(float p)
36 return texture(iChannel0, vec2(p, p), 0.0).y;
39 out vec4 outColor;
41 void main(void)
43 float sum = 0.0;
45 for(int i=0; i<1000; i++)
47 if( sum > 0.99 ) break;
48 float p = iMouse.x + gl_FragCoord.x;
49 sum = map(p);
52 outColor = vec4(sum);
54 </script>
55 <script type="text/javascript">
56 "use strict";
57 description("Test an HLSL compiler freeze on a gradient inside a discontinuous loop.");
59 var wtu = WebGLTestUtils;
60 var gl = wtu.create3DContext(undefined, undefined, 2);
61 wtu.setupUnitQuad(gl);
63 if (!gl) {
64 testFailed("context does not exist");
65 } else {
66 var program = wtu.setupProgram(gl, ["vertex-shader", "fragment-shader"], ['aPosition'], undefined, true);
67 if (!program) {
68 testFailed('Program compilation failed');
71 var successfullyParsed = true;
72 finishTest();
73 </script>
74 </body>
75 </html>