Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / glsl3 / array-assign.html
blob94c1507b29fb24aba9d20000459f68517026f994
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 assignment 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 assignment independently of array constructors.
28 int a[3];
29 int b[3];
30 for (int i = 0; i < 3; ++i) {
31 a[i] = 0;
32 b[i] = i;
34 a = b;
35 bool fail = false;
36 for (int i = 0; i < 3; ++i) {
37 if (a[i] != i) {
38 fail = true;
41 my_FragColor = vec4(0.0, (fail ? 0.0 : 1.0), 0.0, 1.0);
43 </script>
44 <script id="fshaderArrayOfStructs" type="x-shader/x-fragment">#version 300 es
45 precision mediump float;
47 out vec4 my_FragColor;
49 struct S {
50 int foo;
53 void main() {
54 // This simple test uses the ESSL1 style array initialization in order
55 // to be able to test array assignment independently of array constructors.
56 S a[3];
57 S b[3];
58 for (int i = 0; i < 3; ++i) {
59 a[i].foo = 0;
60 b[i].foo = i;
62 a = b;
63 bool fail = false;
64 for (int i = 0; i < 3; ++i) {
65 if (a[i].foo != i) {
66 fail = true;
69 my_FragColor = vec4(0.0, (fail ? 0.0 : 1.0), 0.0, 1.0);
71 </script>
72 <script type="application/javascript">
73 "use strict";
74 description("Assigning arrays should work.");
76 GLSLConformanceTester.runRenderTests([
78 fShaderId: 'fshaderSimple',
79 fShaderSuccess: true,
80 linkSuccess: true,
81 passMsg: 'Arrays of integers'
84 fShaderId: 'fshaderArrayOfStructs',
85 fShaderSuccess: true,
86 linkSuccess: true,
87 passMsg: 'Arrays of structs'
89 ], 2);
90 </script>
91 </body>
92 </html>