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>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>
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
22 <script id=
"vs_uninit_in_frag" type=
"x-shader/x-vertex">#version
300 es
23 precision highp float;
26 gl_Position = a_position;
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;
36 for (vec4 uninit, uninit2[
2] = vec4[
2](uninit, uninit); i <
1; ++i) {
37 my_FragColor = uninit2[
0];
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;
48 for (struct { vec4 v; } uninit; i <
1; ++i) {
49 my_FragColor = uninit.v;
56 <canvas id=
"canvas" width=
"50" height=
"50"></canvas>
57 <div id=
"description"></div>
58 <div id=
"console"></div>
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
);
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"],
79 for (var i
= 0; i
< cases
.length
; ++i
) {
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]);
89 wtu
.glErrorShouldBe(gl
, gl
.NO_ERROR
, "there should be no errors");
94 var successfullyParsed
= true;
96 <script src=
"../../js/js-test-post.js"></script>