4 ** Copyright (c) 2012 The Khronos Group Inc.
6 ** Permission is hereby granted, free of charge, to any person obtaining a
7 ** copy of this software and/or associated documentation files (the
8 ** "Materials"), to deal in the Materials without restriction, including
9 ** without limitation the rights to use, copy, modify, merge, publish,
10 ** distribute, sublicense, and/or sell copies of the Materials, and to
11 ** permit persons to whom the Materials are furnished to do so, subject to
12 ** the following conditions:
14 ** The above copyright notice and this permission notice shall be included
15 ** in all copies or substantial portions of the Materials.
17 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
31 <meta charset="utf-8">
32 <title>WebGL GLSL Conformance Tests</title>
33 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
34 <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
35 <script src="../../../resources/js-test-pre.js"></script>
36 <script src="../../resources/webgl-test-utils.js"></script>
37 <script src="../../resources/glsl-conformance-test.js"></script>
40 <div id="description"></div>
41 <div id="console"></div>
42 <script id="vertexShader" type="text/something-not-javascript">
43 // Shaders with mis-matching uniform types should fail
45 uniform $(type) u_uniform;
49 gl_Position = $(code);
52 <script id="fragmentShader" type="text/something-not-javascript">
53 // Shaders with mis-matching uniform types should fail
55 precision mediump float;
57 uniform $(type) u_uniform;
61 gl_FragColor = $(code);
66 var wtu = WebGLTestUtils;
68 { type: "bool", code: "vec4(u_uniform, 0, 0, 0)", },
69 { type: "float", code: "vec4(u_uniform, 0, 0, 0)", },
70 { type: "int", code: "vec4(u_uniform, 0, 0, 0)", },
71 { type: "vec2", code: "vec4(u_uniform, 0, 0)", },
72 { type: "ivec2", code: "vec4(u_uniform, 0, 0)", },
73 { type: "bvec2", code: "vec4(u_uniform, 0, 0)", },
74 { type: "vec3", code: "vec4(u_uniform, 0)", },
75 { type: "ivec3", code: "vec4(u_uniform, 0)", },
76 { type: "bvec3", code: "vec4(u_uniform, 0)", },
77 { type: "vec4", code: "vec4(u_uniform)", },
78 { type: "ivec4", code: "vec4(u_uniform)", },
79 { type: "bvec4", code: "vec4(u_uniform)", },
80 { type: "mat2", code: "vec4(u_uniform[0][0], 0, 0, 0)", },
81 { type: "mat3", code: "vec4(u_uniform[0][0], 0, 0, 0)", },
82 { type: "mat4", code: "vec4(u_uniform[0][0], 0, 0, 0)", },
84 var vSource = wtu.getScript("vertexShader");
85 var fSource = wtu.getScript("fragmentShader");
87 for (var ii = 0; ii < uniformTypes.length; ++ii) {
88 var u1 = uniformTypes[ii];
89 var vs = wtu.replaceParams(vSource, u1);
90 for (var jj = ii + 1; jj < uniformTypes.length; ++jj) {
91 var u2 = uniformTypes[jj];
92 var fs = wtu.replaceParams(fSource, u2);
99 passMsg: "vertex shader with uniform " + u1.type + " and fragment shader with uniform " + u2.type + " with the same name should fail to link",
104 GLSLConformanceTester.runTests(tests);
105 var successfullyParsed = true;