Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / glsl3 / array-complex-indexing.html
blob2ff9fa1c5ab9c4d0024a051246f8b8903f711f0c
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 Indexing complex array expressions</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 <!--
21 Array indexing is detailed in the ESSL 3.00 spec section 5.9
22 ESSL 3.00 revisions after 3.00.4 changed the definition from 'subscripted array names' to 'subscripted arrays'
23 -->
24 <script id="fshader-assignment" type="x-shader/x-fragment">#version 300 es
25 precision mediump float;
26 out vec4 color;
28 void main() {
29 float a[2] = float[2](0.0, 0.0);
30 float b[2] = float[2](2.0, 1.0);
31 float c = (a = b)[0];
32 color = (c == 2.0) ? vec4(0, 1.0, 0, 1.0) : vec4(1.0, 0, 0, 1.0);
34 </script>
35 <script id="fshader-function" type="x-shader/x-fragment">#version 300 es
36 precision mediump float;
37 out vec4 color;
38 bool hasRan = false;
40 float[2] functionReturnArray() {
41 hasRan = true;
42 return float[2](2.0, 1.0);
45 void main() {
46 float c = (functionReturnArray())[0];
47 color = ((c == 2.0) && hasRan) ? vec4(0, 1.0, 0, 1.0) : vec4(1.0, 0, 0, 1.0);
49 </script>
50 <script id="fshader-array-initialization" type="x-shader/x-fragment">#version 300 es
51 precision mediump float;
52 out vec4 color;
54 void main() {
55 float a = (float[3](2.0, 1.0, 0.0))[0];
56 color = (a == 2.0) ? vec4(0, 1.0, 0, 1.0) : vec4(1.0, 0, 0, 1.0);
58 </script>
59 <script type="application/javascript">
60 "use strict";
61 description("Indexing complex array expressions");
62 debug("");
64 GLSLConformanceTester.runRenderTests([
66 fShaderId: 'fshader-assignment',
67 fShaderSuccess: true,
68 linkSuccess: true,
69 passMsg: 'Test indexing a variable assignment: (a = b)[0]'
72 fShaderId: 'fshader-function',
73 fShaderSuccess: true,
74 linkSuccess: true,
75 passMsg: 'Test indexing a function return with a side-effect: (functionReturnArray())[0]'
78 fShaderId: 'fshader-array-initialization',
79 fShaderSuccess: true,
80 linkSuccess: true,
81 passMsg: 'Test indexing an array initialization: (float[3](2.0, 1.0, 0.0))[0]'
83 ], 2);
85 </script>
86 </body>
87 </html>