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>GLSL initialized array element increment/decrement 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=
"fshaderFloatArrayIncrement" type=
"x-shader/x-fragment">#version
300 es
21 precision mediump float;
23 out vec4 my_FragColor;
26 float A[
2] = float[
2](
0.0,
1.0);
28 my_FragColor = vec4(
1.0 - A[
0], A[
0],
0.0,
1.0);
31 <script id=
"fshaderVectorArrayIncrement" type=
"x-shader/x-fragment">#version
300 es
32 precision mediump float;
34 out vec4 my_FragColor;
37 vec4 V[
2] = vec4[
2](vec4(
0.0,
2.0,
3.0,
4.0), vec4(
5.0,
6.0,
7.0,
8.0));
39 my_FragColor = vec4(
1.0 - V[
0][
0], V[
0][
0],
0.0,
1.0);
42 <script id=
"fshaderVectorElementIncrement" type=
"x-shader/x-fragment">#version
300 es
43 precision mediump float;
45 out vec4 my_FragColor;
48 vec4 v = vec4(
0.0,
2.0,
3.0,
4.0);
50 my_FragColor = vec4(
1.0 - v[
0], v[
0],
0.0,
1.0);
53 <script id=
"fshaderFloatArrayDecrement" type=
"x-shader/x-fragment">#version
300 es
54 precision mediump float;
56 out vec4 my_FragColor;
59 float A[
2] = float[
2](
2.0,
1.0);
61 my_FragColor = vec4(
1.0 - A[
0], A[
0],
0.0,
1.0);
64 <script id=
"fshaderVectorArrayDecrement" type=
"x-shader/x-fragment">#version
300 es
65 precision mediump float;
67 out vec4 my_FragColor;
70 vec4 V[
2] = vec4[
2](vec4(
2.0,
2.0,
3.0,
4.0), vec4(
5.0,
6.0,
7.0,
8.0));
72 my_FragColor = vec4(
1.0 - V[
0][
0], V[
0][
0],
0.0,
1.0);
75 <script id=
"fshaderVectorElementDecrement" type=
"x-shader/x-fragment">#version
300 es
76 precision mediump float;
78 out vec4 my_FragColor;
81 vec4 v = vec4(
2.0,
2.0,
3.0,
4.0);
83 my_FragColor = vec4(
1.0 - v[
0], v[
0],
0.0,
1.0);
86 <script type=
"application/javascript">
88 description(
"Incrementing or decrementing elements of arrays with initializers should work.");
90 GLSLConformanceTester.runRenderTests([
92 fShaderId: 'fshaderFloatArrayIncrement',
95 passMsg: 'Increment an element of a vector array'
98 fShaderId: 'fshaderVectorArrayIncrement',
101 passMsg: 'Increment an element of a vector array'
104 fShaderId: 'fshaderVectorElementIncrement',
105 fShaderSuccess: true,
107 passMsg: 'Increment an element of a vector'
110 fShaderId: 'fshaderFloatArrayDecrement',
111 fShaderSuccess: true,
113 passMsg: 'Decrement an element of a vector array'
116 fShaderId: 'fshaderVectorArrayDecrement',
117 fShaderSuccess: true,
119 passMsg: 'Decrement an element of a vector array'
122 fShaderId: 'fshaderVectorElementDecrement',
123 fShaderSuccess: true,
125 passMsg: 'Decrement an element of a vector'