Backed out changeset 8fc3326bce7f (bug 1943032) for causing failures at browser_tab_g...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / glsl3 / uninitialized-local-global-variables.html
blob0d5be3da220975be1c3b746b3e977ab7a519ff66
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>Uninitialized local/global variables should be initialized (ESSL 3.00 cases)</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>
17 <!--
18 This test covers cases that can't be tested with ESSL 1.00 due to Appendix A limitations.
19 The ESSL 1.00 cases are covered in conformance/glsl/misc/uninitialized-local-global-variables.html
20 -->
22 <script id="vs_uninit_in_frag" type="x-shader/x-vertex">#version 300 es
23 precision highp float;
24 in vec4 a_position;
25 void main() {
26 gl_Position = a_position;
28 </script>
30 <!-- Uninitialized variables in a for loop initializer in fragment shader -->
31 <script id="fs_uninit_variables_in_loop_in_frag" type="x-shader/x-fragment">#version 300 es
32 precision highp float;
33 out vec4 my_FragColor;
34 void main() {
35 int i = 0;
36 for (vec4 uninit, uninit2[2] = vec4[2](uninit, uninit); i < 1; ++i) {
37 my_FragColor = uninit2[0];
40 </script>
42 <!-- Uninitialized nameless struct in a for loop initializer in fragment shader -->
43 <script id="fs_uninit_nameless_struct_in_loop_in_frag" type="x-shader/x-fragment">#version 300 es
44 precision highp float;
45 out vec4 my_FragColor;
46 void main() {
47 int i = 0;
48 for (struct { vec4 v; } uninit; i < 1; ++i) {
49 my_FragColor = uninit.v;
52 </script>
54 </head>
55 <body>
56 <canvas id="canvas" width="50" height="50"></canvas>
57 <div id="description"></div>
58 <div id="console"></div>
59 <script>
60 "use strict";
61 description('Uninitialized local/global variables should be initialized: http://anglebug.com/1966');
63 var wtu = WebGLTestUtils;
64 var gl = wtu.create3DContext("canvas", undefined, 2);
65 wtu.setupUnitQuad(gl);
67 var cases = [
69 name: "Uninitialized variables in a for loop initializer in fragment shader",
70 prog: ["vs_uninit_in_frag", "fs_uninit_variables_in_loop_in_frag"],
73 name: "Uninitialized nameless struct in a for loop initializer in fragment shader",
74 prog: ["vs_uninit_in_frag", "fs_uninit_nameless_struct_in_loop_in_frag"],
78 function runTest() {
79 for (var i = 0; i < cases.length; ++i) {
80 debug("");
81 debug(cases[i].name);
82 var program = wtu.setupProgram(gl, cases[i].prog, ["a_position"], undefined, true);
83 gl.clearColor(1.0, 0.0, 0.0, 1.0);
84 wtu.clearAndDrawUnitQuad(gl);
85 wtu.checkCanvas(gl, [0, 0, 0, 0]);
88 debug("");
89 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors");
92 runTest();
94 var successfullyParsed = true;
95 </script>
96 <script src="../../js/js-test-post.js"></script>
97 </body>
98 </html>