Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / glsl3 / array-assign-constructor.html
blobc47f3d7123129e5e4dba2cbf802663a4f9307056
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 constructor 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="fshaderNonConstantConstructorParameter" type="x-shader/x-fragment">#version 300 es
21 precision mediump float;
22 uniform int u;
24 out vec4 my_FragColor;
26 void main() {
27 // Test assigning a constructor result as opposed to initializing with a
28 // constructor result.
29 int a[3];
30 a = int[3](0, 1, u);
31 bool fail = false;
32 for (int i = 0; i < 2; ++i) {
33 if (a[i] != i) {
34 fail = true;
37 if (a[2] != u) {
38 fail = true;
40 my_FragColor = vec4(0.0, (fail ? 0.0 : 1.0), 0.0, 1.0);
42 </script>
43 <script id="fshaderArrayOfStructs" type="x-shader/x-fragment">#version 300 es
44 precision mediump float;
46 out vec4 my_FragColor;
48 struct S {
49 int foo;
52 void main() {
53 // Test assigning a constructor result as opposed to initializing with a
54 // constructor result.
55 S a[3];
56 a = S[3](S(0), S(1), S(2));
57 bool fail = false;
58 for (int i = 0; i < 3; ++i) {
59 if (a[i].foo != i) {
60 fail = true;
63 my_FragColor = vec4(0.0, (fail ? 0.0 : 1.0), 0.0, 1.0);
65 </script>
66 <script type="application/javascript">
67 "use strict";
68 description("Assigning return values of array constructors should work.");
69 debug("");
71 // This test only covers cases which are not covered by the dEQP tests.
73 GLSLConformanceTester.runRenderTests([
75 fShaderId: 'fshaderNonConstantConstructorParameter',
76 fShaderSuccess: true,
77 linkSuccess: true,
78 passMsg: 'Assigning a constructor result',
79 uniforms: [{name: "u", functionName: "uniform1i", value: 5}]
82 fShaderId: 'fshaderArrayOfStructs',
83 fShaderSuccess: true,
84 linkSuccess: true,
85 passMsg: 'Assigning an array of structs'
87 ], 2);
88 </script>
89 </body>
90 </html>