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=
"vertexShader" type=
"text/something-not-javascript">
25 gl_Position = vec4(
0,
0,
0,
0);
28 <script id=
"fragmentShader" type=
"text/something-not-javascript">
30 precision mediump float;
32 varying $(type) v_varying;
36 gl_FragColor = $(code);
41 var wtu
= WebGLTestUtils
;
43 { type
: "float", code
: "vec4(v_varying, 0, 0, 0)", },
44 { type
: "vec2", code
: "vec4(v_varying, 0, 0)", },
45 { type
: "vec3", code
: "vec4(v_varying, 0)", },
46 { type
: "vec4", code
: "vec4(v_varying)", },
47 { type
: "mat2", code
: "vec4(v_varying[0][0], 0, 0, 0)", },
48 { type
: "mat3", code
: "vec4(v_varying[0][0], 0, 0, 0)", },
49 { type
: "mat4", code
: "vec4(v_varying[0][0], 0, 0, 0)", },
51 var vSource
= wtu
.getScript("vertexShader");
52 var fSource
= wtu
.getScript("fragmentShader");
54 for (var ii
= 0; ii
< varyingTypes
.length
; ++ii
) {
55 var u1
= varyingTypes
[ii
];
56 var vs
= wtu
.replaceParams(vSource
, u1
);
57 for (var jj
= ii
+ 1; jj
< varyingTypes
.length
; ++jj
) {
58 var u2
= varyingTypes
[jj
];
59 var fs
= wtu
.replaceParams(fSource
, u2
);
66 passMsg
: "vertex shader no varyings and fragment shader with varying " + u2
.type
+ " should fail to link",
70 GLSLConformanceTester
.runTests(tests
);
71 var successfullyParsed
= true;