Bug 1945965 – remove new tab April Fools logo. r=home-newtab-reviewers,reemhamz
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / glsl / misc / struct-equals.html
blob50ac40e5c6949f2775f7b13cf4c11792c4881e89
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 Structure Equals Test</title>
12 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
13 <link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
14 <script src="../../../js/js-test-pre.js"></script>
15 <script src="../../../js/webgl-test-utils.js"> </script>
16 <script src="../../../js/glsl-conformance-test.js"></script>
18 <script id="simple-vs" type="x-shader/x-vertex">
19 attribute vec4 a_position;
20 void main(void) {
21 gl_Position = a_position;
23 </script>
24 <script id="simple-struct-fs" type="x-shader/x-fragment">
25 precision mediump float;
26 struct my_struct {
27 float f;
30 my_struct a = my_struct(1.0);
31 my_struct b = my_struct(1.0);
33 void main(void) {
34 gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
36 if (a == b) {
37 gl_FragColor.y = 1.0;
40 </script>
41 <script id="vec-struct-fs" type="x-shader/x-fragment">
42 precision mediump float;
43 struct my_struct {
44 vec3 v;
47 my_struct a = my_struct(vec3(1.0, 2.0, 3.0));
48 my_struct b = my_struct(vec3(1.0, 2.0, 3.0));
50 void main(void) {
51 gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
53 if (a == b) {
54 gl_FragColor.y = 1.0;
57 </script>
58 <script id="nested-struct-fs" type="x-shader/x-fragment">
59 precision mediump float;
61 struct s1
63 float f;
66 struct s2
68 s1 s;
71 s2 a = s2(s1(1.0));
72 s2 b = s2(s1(1.0));
74 void main(void) {
75 gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
77 if (a == b) {
78 gl_FragColor.y = 1.0;
81 </script>
82 <script id="nested-vec-struct-fs" type="x-shader/x-fragment">
83 precision mediump float;
85 struct s1
87 vec3 v;
90 struct s2
92 s1 s;
95 s2 a = s2(s1(vec3(1.0, 2.0, 3.0)));
96 s2 b = s2(s1(vec3(1.0, 2.0, 3.0)));
98 void main(void) {
99 gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
101 if (a == b) {
102 gl_FragColor.y = 1.0;
105 </script>
106 <script id="array-struct-fs" type="x-shader/x-fragment">
107 precision mediump float;
109 struct my_struct
111 float f[3];
114 void main(void) {
115 gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
116 my_struct a;
117 my_struct b;
118 for (int i = 0; i < 3; ++i) {
119 a.f[i] = 0.0;
120 b.f[i] = 1.0;
123 if (a == b) {
124 gl_FragColor.x = 1.0;
127 </script>
128 <script id="sampler-struct-fs" type="x-shader/x-fragment">
129 precision mediump float;
131 struct my_struct
133 sampler2D s;
136 uniform my_struct a;
137 uniform my_struct b;
139 void main(void) {
140 gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
142 if (a == b) {
143 gl_FragColor.x = 1.0;
146 </script>
147 </head>
148 <body>
149 <canvas id="canvas" width="50" height="50"></canvas>
150 <div id="description"></div>
151 <div id="console"></div>
152 <script>
153 "use strict";
154 description("Testing struct equals");
156 var wtu = WebGLTestUtils;
157 GLSLConformanceTester.runTests([
159 vShaderId: "simple-vs",
160 vShaderSuccess: true,
161 fShaderId: "simple-struct-fs",
162 fShaderSuccess: true,
163 linkSuccess: true,
164 render: true,
165 passMsg: "Simple struct with one float",
168 vShaderId: "simple-vs",
169 vShaderSuccess: true,
170 fShaderId: "vec-struct-fs",
171 fShaderSuccess: true,
172 linkSuccess: true,
173 render: true,
174 passMsg: "Simple struct with a vector",
177 vShaderId: "simple-vs",
178 vShaderSuccess: true,
179 fShaderId: "nested-struct-fs",
180 fShaderSuccess: true,
181 linkSuccess: true,
182 render: true,
183 passMsg: "Nested struct with a float",
186 vShaderId: "simple-vs",
187 vShaderSuccess: true,
188 fShaderId: "nested-vec-struct-fs",
189 fShaderSuccess: true,
190 linkSuccess: true,
191 render: true,
192 passMsg: "Nested struct with a vector",
195 vShaderId: "simple-vs",
196 vShaderSuccess: true,
197 fShaderId: "array-struct-fs",
198 fShaderSuccess: false,
199 linkSuccess: false,
200 passMsg: "Comparing a struct containing an array should not compile",
203 vShaderId: "simple-vs",
204 vShaderSuccess: true,
205 fShaderId: "sampler-struct-fs",
206 fShaderSuccess: false,
207 linkSuccess: false,
208 passMsg: "Comparing a struct containing a sampler should not compile",
211 debug("");
213 var successfullyParsed = true;
214 </script>
215 </body>
216 </html>