Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / glsl3 / fragment-shader-loop-crash.html
bloba171b94e26a10b2f4a32a67573c9a66cb45310c4
1 <!--
2 Copyright (c) 2021 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>Fragment shader containing loop should not crash</title>
12 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
13 <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
14 <script src="../../js/js-test-pre.js"></script>
15 <script src="../../js/webgl-test-utils.js"></script>
16 <script src="../../js/glsl-conformance-test.js"></script>
17 </head>
18 <body>
19 <div id="description"></div>
20 <div id="console"></div>
21 <script id="vshader" type="x-shader/x-vertex">#version 300 es
22 precision highp float;
23 out vec2 v_tex_coord;
24 uniform mat4 matrix;
26 void main() {
27 v_tex_coord = vec2(0.0, 0.0);
28 gl_Position = vec4(0.0, 0.0, 0.0, 0.0);
30 </script>
31 <script id="fshader" type="x-shader/x-fragment">#version 300 es
32 precision highp float;
34 in vec2 v_tex_coord;
35 out vec4 out_color;
37 uniform sampler2D texture_1;
38 uniform vec2 resolution;
40 vec4 do_loops(vec4 z)
42 vec4 v[16];
43 for (int i = 0; i < 16; i++)
45 v[i] = z;
47 return v[1];
50 void main() {
51 out_color = do_loops(vec4(0.2, 0.4, 0.6, 1.0)) - texture(texture_1, v_tex_coord);
53 </script>
54 <script type="application/javascript">
55 "use strict";
56 description();
57 const wtu = WebGLTestUtils;
58 const tests = [
60 vShaderSource: wtu.getScript('vshader'),
61 fShaderSource: wtu.getScript('fshader'),
62 vShaderSuccess: true,
63 fShaderSuccess: true,
64 linkSuccess: true,
65 passMsg: 'Fragment shader containing a simple loop should compile and link'
69 GLSLConformanceTester.runTests(tests, 2);
70 </script>
71 </body>
72 </html>