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.
30 <meta charset="utf-8">
31 <title>WebGL2 Methods Test</title>
32 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
33 <script src="../../resources/js-test-pre.js"></script>
34 <script src="../../conformance/resources/webgl-test-utils.js"></script>
37 <div id="description"></div>
38 <div id="console"></div>
39 <canvas id="canvas" style="width: 50px; height: 50px;"> </canvas>
42 description("This test ensures that the WebGL context has all the methods in the specification.");
45 "getContextAttributes",
55 "blendEquationSeparate",
60 "checkFramebufferStatus",
67 "compressedTexImage2D",
68 "compressedTexSubImage2D",
89 "disableVertexAttribArray",
93 "enableVertexAttribArray",
96 "framebufferRenderbuffer",
97 "framebufferTexture2D",
102 "getAttachedShaders",
105 "getBufferParameter",
108 "getFramebufferAttachmentParameter",
109 "getProgramParameter",
111 "getRenderbufferParameter",
112 "getShaderParameter",
114 "getShaderPrecisionFormat",
116 "getSupportedExtensions",
119 "getUniformLocation",
121 "getVertexAttribOffset",
136 "renderbufferStorage",
141 "stencilFuncSeparate",
143 "stencilMaskSeparate",
179 "vertexAttribPointer",
185 "framebufferTextureLayer",
186 "getInternalformatParameter",
187 "invalidateFramebuffer",
188 "invalidateSubFramebuffer",
190 "renderbufferStorageMultisample",
199 "compressedTexImage3D",
200 "compressedTexSubImage3D",
201 "getFragDataLocation",
210 "uniformMatrix2x3fv",
211 "uniformMatrix2x3fv",
212 "uniformMatrix3x2fv",
213 "uniformMatrix3x2fv",
214 "uniformMatrix2x4fv",
215 "uniformMatrix2x4fv",
216 "uniformMatrix4x2fv",
217 "uniformMatrix4x2fv",
218 "uniformMatrix3x4fv",
219 "uniformMatrix3x4fv",
220 "uniformMatrix4x3fv",
221 "uniformMatrix4x3fv",
226 "vertexAttribIPointer",
227 "vertexAttribDivisor",
228 "drawArraysInstanced",
229 "drawElementsInstanced",
250 "samplerParameteriv",
251 "samplerParameteriv",
253 "samplerParameterfv",
254 "samplerParameterfv",
255 "getSamplerParameter",
262 "createTransformFeedback",
263 "deleteTransformFeedback",
264 "isTransformFeedback",
265 "bindTransformFeedback",
266 "beginTransformFeedback",
267 "endTransformFeedback",
268 "transformFeedbackVaryings",
269 "getTransformFeedbackVarying",
270 "pauseTransformFeedback",
271 "resumeTransformFeedback",
274 "getIndexedParameter",
277 "getUniformBlockIndex",
278 "getActiveUniformBlockParameter",
279 "getActiveUniformBlockName",
280 "uniformBlockBinding",
287 // Properties to be ignored because they were added in versions of the
288 // spec that are backward-compatible with this version
289 var ignoredMethods = [
292 function assertFunction(v, f) {
294 if (typeof v[f] != "function") {
295 testFailed("Property either does not exist or is not a function: " + f);
301 testFailed("Trying to access the property '" + f + "' threw an error: "+e.toString());
306 debug("Canvas.getContext");
308 var wtu = WebGLTestUtils;
309 var canvas = document.getElementById("canvas");
310 var gl = wtu.create3DContext(canvas, null, 2);
312 for (var i=0; i<methods.length; i++) {
313 var r = assertFunction(gl, methods[i]);
314 passed = passed && r;
317 testPassed("All WebGL methods found.");
319 var extended = false;
321 if (typeof gl[i] == "function" && methods.indexOf(i) == -1 && ignoredMethods.indexOf(i) == -1) {
324 testFailed("Also found the following extra methods:");
331 testPassed("No extra methods found on WebGL context.");
335 var successfullyParsed = true;
337 <script src="../../resources/js-test-post.js"></script>