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>Constant array initialization 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 <script src=
"../../js/glsl-conformance-test.js"></script>
18 <div id=
"description"></div>
19 <div id=
"console"></div>
20 <script id=
"fshaderGlobalConstArray" type=
"x-shader/x-fragment">#version
300 es
21 precision mediump float;
22 out vec4 my_FragColor;
24 const vec4 constants[
2] = vec4[] (
25 vec4(
0.6,
0.3,
0.0,
3.0),
26 vec4(-
0.6,
0.7,
0.0, -
2.0)
31 my_FragColor = constants[
0] + constants[
1];
35 <script id=
"fshaderGlobalConstArrayWithReferenceToConstArray" type=
"x-shader/x-fragment">#version
300 es
36 precision mediump float;
37 out vec4 my_FragColor;
39 const vec4 constants[
2] = vec4[] (
40 vec4(
0.6,
0.3,
0.0,
3.0),
41 vec4(-
0.6,
0.7,
0.0, -
2.0)
44 const vec4 constants2[
2] = vec4[] (
51 my_FragColor = constants2[
0] + constants2[
1];
55 <script id=
"fshaderGlobalConstArrayInitializedToConstArray" type=
"x-shader/x-fragment">#version
300 es
56 precision mediump float;
57 out vec4 my_FragColor;
59 const vec4 constants[
2] = vec4[] (
60 vec4(
0.6,
0.3,
0.0,
3.0),
61 vec4(-
0.6,
0.7,
0.0, -
2.0)
64 const vec4 constants2[
2] = constants;
68 my_FragColor = constants2[
0] + constants2[
1];
72 <script type=
"text/javascript">
74 description("Test initializing a constant global array");
76 GLSLConformanceTester
.runRenderTests([
78 fShaderId
: 'fshaderGlobalConstArray',
81 passMsg
: "Global constant array with vec4 constructors and literals in the initializer"
84 fShaderId
: 'fshaderGlobalConstArrayWithReferenceToConstArray',
87 passMsg
: "Global constant array which indexes another global constant array in the initializer"
90 fShaderId
: 'fshaderGlobalConstArrayInitializedToConstArray',
93 passMsg
: "Global constant array initialized to another global constant array"