Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / glsl3 / array-equality.html
blobdcffa2c0a3277c1c78a895a2509f4a898ab84dd4
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>GLSL array equality 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>
16 </head>
17 <body>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script id="fshaderSimple" type="x-shader/x-fragment">#version 300 es
21 precision mediump float;
23 out vec4 my_FragColor;
25 void main() {
26 // This simple test uses the ESSL1 style array initialization in order
27 // to be able to test array equality independently of array constructors.
28 int a[3];
29 int b[3];
30 int c[3];
31 for (int i = 0; i < 3; ++i) {
32 a[i] = i;
33 b[i] = i;
34 c[i] = i + 1;
36 bool success = (a == b) && (a != c);
37 my_FragColor = vec4(0.0, (success ? 1.0 : 0.0), 0.0, 1.0);
39 </script>
40 <script id="fshaderArrayOfStructs" type="x-shader/x-fragment">#version 300 es
41 precision mediump float;
43 out vec4 my_FragColor;
45 struct S {
46 int foo;
49 void main() {
50 // This simple test uses the ESSL1 style array initialization in order
51 // to be able to test array equality independently of array constructors.
52 S a[3];
53 S b[3];
54 S c[3];
55 for (int i = 0; i < 3; ++i) {
56 a[i].foo = i;
57 b[i].foo = i;
58 c[i].foo = i + 1;
60 bool success = (a == b) && (a != c);
61 my_FragColor = vec4(0.0, (success ? 1.0 : 0.0), 0.0, 1.0);
63 </script>
64 <script id="simple-float-array-fs" type="x-shader/x-fragment">#version 300 es
65 precision mediump float;
67 uniform float a[3];
68 uniform float b[3];
70 out vec4 fragColor;
72 void main(void) {
73 fragColor = vec4(0.0, 0.0, 0.0, 1.0);
75 if (a == b) {
76 fragColor.g = 1.0;
79 </script>
80 <script id="simple-vec-array-fs" type="x-shader/x-fragment">#version 300 es
81 precision mediump float;
83 uniform vec3 a[3];
84 uniform vec3 b[3];
86 out vec4 fragColor;
88 void main(void) {
89 fragColor = vec4(0.0, 0.0, 0.0, 1.0);
91 if (a == b) {
92 fragColor.g = 1.0;
95 </script>
96 <script id="simple-mat-array-fs" type="x-shader/x-fragment">#version 300 es
97 precision mediump float;
99 uniform mat3 a[3];
100 uniform mat3 b[3];
102 out vec4 fragColor;
104 void main(void) {
105 fragColor = vec4(0.0, 0.0, 0.0, 1.0);
107 if (a == b) {
108 fragColor.g = 1.0;
111 </script>
112 <script type="application/javascript">
113 "use strict";
114 description("Comparing arrays should work.");
116 GLSLConformanceTester.runRenderTests([
118 fShaderId: 'fshaderSimple',
119 fShaderSuccess: true,
120 linkSuccess: true,
121 passMsg: 'Arrays of integers'
124 fShaderId: 'fshaderArrayOfStructs',
125 fShaderSuccess: true,
126 linkSuccess: true,
127 passMsg: 'Arrays of structs'
130 fShaderId: "simple-float-array-fs",
131 fShaderSuccess: true,
132 linkSuccess: true,
133 render: true,
134 passMsg: "Simple float array with default values",
137 fShaderId: "simple-float-array-fs",
138 fShaderSuccess: true,
139 linkSuccess: true,
140 render: true,
141 renderColor: [0, 0, 0, 255],
142 uniforms: [
143 { name: 'a', functionName: 'uniform1fv', value: [1, 2, 3]},
144 { name: 'b', functionName: 'uniform1fv', value: [1, 2, 4]},
146 passMsg: "Simple float array with different values",
149 fShaderId: "simple-float-array-fs",
150 fShaderSuccess: true,
151 linkSuccess: true,
152 render: true,
153 uniforms: [
154 { name: 'a', functionName: 'uniform1fv', value: [1, 2, 3]},
155 { name: 'b', functionName: 'uniform1fv', value: [1, 2, 3]},
157 passMsg: "Simple float array with same values",
160 fShaderId: "simple-vec-array-fs",
161 fShaderSuccess: true,
162 linkSuccess: true,
163 render: true,
164 passMsg: "Simple vec array with default values",
167 fShaderId: "simple-vec-array-fs",
168 fShaderSuccess: true,
169 linkSuccess: true,
170 render: true,
171 renderColor: [0, 0, 0, 255],
172 uniforms: [
173 { name: 'a', functionName: 'uniform3fv', value: [1, 2, 3, 4, 5, 6, 7, 8, 9]},
174 { name: 'b', functionName: 'uniform3fv', value: [1, 2, 3, 4, 5, 6, 7, 8, 10]},
176 passMsg: "Simple vec array with different values",
179 fShaderId: "simple-vec-array-fs",
180 fShaderSuccess: true,
181 linkSuccess: true,
182 render: true,
183 uniforms: [
184 { name: 'a', functionName: 'uniform3fv', value: [1, 2, 3, 4, 5, 6, 7, 8, 9]},
185 { name: 'b', functionName: 'uniform3fv', value: [1, 2, 3, 4, 5, 6, 7, 8, 9]},
187 passMsg: "Simple vec array with same values",
190 // "simple-mat-array-fs"
191 fShaderId: "simple-mat-array-fs",
192 fShaderSuccess: true,
193 linkSuccess: true,
194 render: true,
195 passMsg: "Simple mat array with default values",
198 fShaderId: "simple-mat-array-fs",
199 fShaderSuccess: true,
200 linkSuccess: true,
201 render: true,
202 renderColor: [0, 0, 0, 255],
203 uniforms: [
204 { name: 'a', functionName: 'uniformMatrix3fv', value: [
205 11, 12, 13, 14, 15, 16, 17, 18, 19,
206 21, 22, 23, 24, 25, 26, 27, 28, 29,
207 31, 32, 33, 34, 35, 36, 37, 38, 39,
209 { name: 'b', functionName: 'uniformMatrix3fv', value: [
210 11, 12, 13, 14, 15, 16, 17, 18, 19,
211 21, 22, 23, 24, 25, 26, 27, 28, 29,
212 31, 32, 33, 34, 35, 36, 37, 30, 39,
215 passMsg: "Simple vec array with different values",
218 fShaderId: "simple-mat-array-fs",
219 fShaderSuccess: true,
220 linkSuccess: true,
221 render: true,
222 uniforms: [
223 { name: 'a', functionName: 'uniformMatrix3fv', value: [
224 11, 12, 13, 14, 15, 16, 17, 18, 19,
225 21, 22, 23, 24, 25, 26, 27, 28, 29,
226 31, 32, 33, 34, 35, 36, 37, 38, 39,
228 { name: 'b', functionName: 'uniformMatrix3fv', value: [
229 11, 12, 13, 14, 15, 16, 17, 18, 19,
230 21, 22, 23, 24, 25, 26, 27, 28, 29,
231 31, 32, 33, 34, 35, 36, 37, 38, 39,
234 passMsg: "Simple vec array with same values",
236 ], 2);
237 </script>
238 </body>
239 </html>