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>WebGL GLSL Conformance Tests
</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>
19 <div id=
"description"></div>
20 <div id=
"console"></div>
21 <script id=
"vertexShaderStructSequence" type=
"text/something-not-javascript">
22 // Structures must have the same name, sequence of type names, and
23 // type definitions, and field names to be considered the same type.
25 precision mediump float;
34 gl_Position = uni.pos;
37 <script id=
"fragmentShaderStructSequence" type=
"text/something-not-javascript">
38 // Structures must have the same name, sequence of type names, and
39 // type definitions, and field names to be considered the same type.
41 precision mediump float;
50 gl_FragColor = uni.color;
53 <script id=
"vertexShaderStructName" type=
"text/something-not-javascript">
54 // Structures must have the same name, sequence of type names, and
55 // type definitions, and field names to be considered the same type.
57 precision mediump float;
66 gl_Position = uni.pos;
69 <script id=
"fragmentShaderStructNameFailure" type=
"text/something-not-javascript">
70 // Structures must have the same name, sequence of type names, and
71 // type definitions, and field names to be considered the same type.
73 precision mediump float;
82 gl_FragColor = uni.color;
85 <script id=
"fragmentShaderStructNameSuccess" type=
"text/something-not-javascript">
86 // Structures must have the same name, sequence of type names, and
87 // type definitions, and field names to be considered the same type.
89 precision mediump float;
91 // Add a struct before info to make sure the struct info here is assigned
92 // a different internal unique ID from the struct info in vertex shader.
110 <script id=
"vertexShaderStructFieldName" type=
"text/something-not-javascript">
111 // Structures must have the same name, sequence of type names, and
112 // type definitions, and field names to be considered the same type.
114 precision mediump float;
123 gl_Position = uni.pos;
126 <script id=
"fragmentShaderStructFieldName" type=
"text/something-not-javascript">
127 // Structures must have the same name, sequence of type names, and
128 // type definitions, and field names to be considered the same type.
130 precision mediump float;
139 gl_FragColor = uni.color;
142 <script id=
"vertexShaderStructFieldType" type=
"text/something-not-javascript">
143 // Structures must have the same name, sequence of type names, and
144 // type definitions, and field names to be considered the same type.
146 precision mediump float;
155 gl_Position = uni.pos;
158 <script id=
"fragmentShaderStructFieldType" type=
"text/something-not-javascript">
159 // Structures must have the same name, sequence of type names, and
160 // type definitions, and field names to be considered the same type.
162 precision mediump float;
171 gl_FragColor = uni.color;
174 <script id=
"vertexShaderStructFieldPrecision" type=
"text/something-not-javascript">
175 // Structures must have the same name, sequence of type names, and
176 // type definitions, and field names to be considered the same type.
186 gl_Position = uni.pos;
189 <script id=
"fragmentShaderStructFieldPrecision" type=
"text/something-not-javascript">
190 // Structures must have the same name, sequence of type names, and
191 // type definitions, and field names to be considered the same type.
193 precision mediump float;
202 gl_FragColor = uni.color;
205 <script id=
"vertexShaderUnnamedStruct" type=
"text/something-not-javascript">
206 // ANGLE regression on Windows, crbug.com/
401296
214 gl_Position = u_struct.f * u_struct.v;
217 <script id=
"fragmentShaderSimple" type=
"text/something-not-javascript">
220 gl_FragColor = vec4(
1.0);
225 var wtu
= WebGLTestUtils
;
229 vShaderSource
: wtu
.getScript("vertexShaderStructName"),
230 vShaderSuccess
: true,
231 fShaderSource
: wtu
.getScript("fragmentShaderStructNameSuccess"),
232 fShaderSuccess
: true,
234 passMsg
: "Structures with the same defination must be considered the same type.",
237 vShaderSource
: wtu
.getScript("vertexShaderStructName"),
238 vShaderSuccess
: true,
239 fShaderSource
: wtu
.getScript("fragmentShaderStructNameFailure"),
240 fShaderSuccess
: true,
242 passMsg
: "Structures must have the same name to be considered the same type.",
245 vShaderSource
: wtu
.getScript("vertexShaderStructSequence"),
246 vShaderSuccess
: true,
247 fShaderSource
: wtu
.getScript("fragmentShaderStructSequence"),
248 fShaderSuccess
: true,
250 passMsg
: "Structures must have the same sequence of type names to be considered the same type.",
253 vShaderSource
: wtu
.getScript("vertexShaderStructFieldName"),
254 vShaderSuccess
: true,
255 fShaderSource
: wtu
.getScript("fragmentShaderStructFieldName"),
256 fShaderSuccess
: true,
258 passMsg
: "Structures must have the same field names to be considered the same type.",
261 vShaderSource
: wtu
.getScript("vertexShaderStructFieldType"),
262 vShaderSuccess
: true,
263 fShaderSource
: wtu
.getScript("fragmentShaderStructFieldType"),
264 fShaderSuccess
: true,
266 passMsg
: "Structures must have the same type definitions to be considered the same type.",
269 vShaderSource
: wtu
.getScript("vertexShaderStructFieldPrecision"),
270 vShaderSuccess
: true,
271 fShaderSource
: wtu
.getScript("fragmentShaderStructFieldPrecision"),
272 fShaderSuccess
: true,
274 passMsg
: "Structures must have the same type definitions (including precision) to be considered the same type.",
277 vShaderSource
: wtu
.getScript("vertexShaderUnnamedStruct"),
278 vShaderSuccess
: true,
279 fShaderSource
: wtu
.getScript("fragmentShaderSimple"),
280 fShaderSuccess
: true,
282 passMsg
: "Shaders with uniforms of unnamed struct type should compile and link successfully.",
285 GLSLConformanceTester
.runTests(tests
);
286 var successfullyParsed
= true;