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.
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;
21 gl_Position = a_position;
24 <script id=
"simple-struct-fs" type=
"x-shader/x-fragment">
25 precision mediump float;
30 my_struct a = my_struct(
1.0);
31 my_struct b = my_struct(
1.0);
34 gl_FragColor = vec4(
0.0,
0.0,
0.0,
1.0);
41 <script id=
"vec-struct-fs" type=
"x-shader/x-fragment">
42 precision mediump float;
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));
51 gl_FragColor = vec4(
0.0,
0.0,
0.0,
1.0);
58 <script id=
"nested-struct-fs" type=
"x-shader/x-fragment">
59 precision mediump float;
75 gl_FragColor = vec4(
0.0,
0.0,
0.0,
1.0);
82 <script id=
"nested-vec-struct-fs" type=
"x-shader/x-fragment">
83 precision mediump float;
95 s2 a = s2(s1(vec3(
1.0,
2.0,
3.0)));
96 s2 b = s2(s1(vec3(
1.0,
2.0,
3.0)));
99 gl_FragColor = vec4(
0.0,
0.0,
0.0,
1.0);
102 gl_FragColor.y =
1.0;
106 <script id=
"array-struct-fs" type=
"x-shader/x-fragment">
107 precision mediump float;
115 gl_FragColor = vec4(
0.0,
0.0,
0.0,
1.0);
118 for (int i =
0; i <
3; ++i) {
124 gl_FragColor.x =
1.0;
128 <script id=
"sampler-struct-fs" type=
"x-shader/x-fragment">
129 precision mediump float;
140 gl_FragColor = vec4(
0.0,
0.0,
0.0,
1.0);
143 gl_FragColor.x =
1.0;
149 <canvas id=
"canvas" width=
"50" height=
"50"></canvas>
150 <div id=
"description"></div>
151 <div id=
"console"></div>
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,
165 passMsg
: "Simple struct with one float",
168 vShaderId
: "simple-vs",
169 vShaderSuccess
: true,
170 fShaderId
: "vec-struct-fs",
171 fShaderSuccess
: true,
174 passMsg
: "Simple struct with a vector",
177 vShaderId
: "simple-vs",
178 vShaderSuccess
: true,
179 fShaderId
: "nested-struct-fs",
180 fShaderSuccess
: true,
183 passMsg
: "Nested struct with a float",
186 vShaderId
: "simple-vs",
187 vShaderSuccess
: true,
188 fShaderId
: "nested-vec-struct-fs",
189 fShaderSuccess
: true,
192 passMsg
: "Nested struct with a vector",
195 vShaderId
: "simple-vs",
196 vShaderSuccess
: true,
197 fShaderId
: "array-struct-fs",
198 fShaderSuccess
: 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,
208 passMsg
: "Comparing a struct containing a sampler should not compile",
213 var successfullyParsed
= true;