4 ** Copyright (c) 2014 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>
43 <script id="vsVec4Mat2Add" type="text/something-not-javascript">
46 mat2 m1 = mat2(1.0, 2.0, 3.0, 4.0);
48 vec4 v = vec4(m1 + m2);
52 <script id="fsVec4Mat3Add" type="text/something-not-javascript">
53 precision mediump float;
56 mat3 m1 = mat3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);
58 vec4 v = vec4(m1 + m2);
63 <script id="vsMat2Vec4Sub" type="text/something-not-javascript">
66 vec4 v1 = vec4(1.0, 2.0, 3.0, 4.0);
68 mat2 m = mat2(v1 - v2);
69 gl_Position = vec4(1.0, m);
72 <script id="fsMat3Vec4AddSub" type="text/something-not-javascript">
73 precision mediump float;
76 vec4 v1 = vec4(1.0, 2.0, 3.0, 4.0);
78 mat3 m = mat3(v1 + v2, 5.0, v1 - v2);
79 gl_FragColor = vec4(m);
83 <script id="vsVec4Mat2Func" type="text/something-not-javascript">
90 mat2 m = mat2(1.0, 2.0, 3.0, 4.0);
92 gl_Position = vec4(1.0, v);
95 <script id="fsVec4Mat3Func" type="text/something-not-javascript">
96 precision mediump float;
109 <script id="vsMat2Vec4Func" type="text/something-not-javascript">
116 vec4 v = vec4(1.0, 2.0, 3.0, 4.0);
118 gl_Position = vec4(1.0, m);
121 <script id="fsMat3Vec4Func" type="text/something-not-javascript">
122 precision mediump float;
129 vec4 v1 = vec4(1.0, 2.0, 3.0, 4.0);
131 mat3 m = mat3(f(v1), 5.0, f(v2));
132 gl_FragColor = vec4(m);
136 <script id="vsMat4VecMultiple" type="text/something-not-javascript">
143 vec2 v2 = vec2(1.0, 2.0);
144 vec3 v3 = vec3(1.0, 2.0, 3.0);
145 vec4 v4 = vec4(1.0, 2.0, 3.0, 4.0);
146 mat4 m = mat4(0.0, v2, 1.0, v3 + vec3(1), 2.0, vec4(0), f(v4));
147 gl_Position = vec4(1.0, m);
150 <script id="fsMat4VecMultiple" type="text/something-not-javascript">
151 precision mediump float;
158 vec2 v2 = vec2(1.0, 2.0);
159 vec3 v3 = vec3(1.0, 2.0, 3.0);
160 vec4 v4 = vec4(1.0, 2.0, 3.0, 4.0);
161 mat4 m = mat4(0.0, v2, 1.0, v3 + vec3(1), 2.0, vec4(0), f(v4));
162 gl_FragColor = vec4(m);
168 var wtu = WebGLTestUtils;
172 vShaderSource: wtu.getScript("vsVec4Mat2Add"),
173 vShaderSuccess: true,
174 fShaderSource: wtu.getScript("fsVec4Mat3Add"),
175 fShaderSuccess: true,
177 passMsg: "vec(mat +/- mat) works ok",
180 vShaderSource: wtu.getScript("vsMat2Vec4Sub"),
181 vShaderSuccess: true,
182 fShaderSource: wtu.getScript("fsMat3Vec4AddSub"),
183 fShaderSuccess: true,
185 passMsg: "mat(vec +/- vec) works ok",
188 vShaderSource: wtu.getScript("vsVec4Mat2Func"),
189 vShaderSuccess: true,
190 fShaderSource: wtu.getScript("fsVec4Mat3Func"),
191 fShaderSuccess: true,
193 passMsg: "vec(func(mat)) works ok",
196 vShaderSource: wtu.getScript("vsMat2Vec4Func"),
197 vShaderSuccess: true,
198 fShaderSource: wtu.getScript("fsMat3Vec4Func"),
199 fShaderSuccess: true,
201 passMsg: "mat(func(vec)) works ok",
204 vShaderSource: wtu.getScript("vsMat4VecMultiple"),
205 vShaderSuccess: true,
206 fShaderSource: wtu.getScript("fsMat4VecMultiple"),
207 fShaderSuccess: true,
209 passMsg: "mat4(float, vec2, float, vec3+vec3, float, vec4, f(vec4)) works ok",
212 GLSLConformanceTester.runTests(tests);
213 var successfullyParsed = true;