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 <link rel=
"stylesheet" href=
"../../resources/js-test-style.css"/>
12 <script src=
"../../js/js-test-pre.js"></script>
13 <script src=
"../../js/webgl-test-utils.js"></script>
16 <div id=
"description"></div>
17 <div id=
"console"></div>
21 var wtu
= WebGLTestUtils
;
22 description("Tests calling WebGL 2 APIs without providing the necessary objects");
24 var gl
= wtu
.create3DContext(undefined, undefined, 2);
25 var shouldGenerateGLError
= wtu
.shouldGenerateGLError
;
28 for (let nullOrUndefined
of [null, undefined]) {
29 shouldGenerateGLError(gl
, gl
.NO_ERROR
, `gl.deleteQuery(${nullOrUndefined})`);
30 shouldGenerateGLError(gl
, gl
.NO_ERROR
, `gl.isQuery(${nullOrUndefined})`);
31 shouldGenerateGLError(gl
, gl
.NO_ERROR
, `gl.deleteSync(${nullOrUndefined})`);
32 shouldGenerateGLError(gl
, gl
.NO_ERROR
, `gl.isSync(${nullOrUndefined})`);
33 shouldGenerateGLError(gl
, gl
.NO_ERROR
, `gl.deleteTransformFeedback(${nullOrUndefined})`);
34 shouldGenerateGLError(gl
, gl
.NO_ERROR
, `gl.isTransformFeedback(${nullOrUndefined})`);
35 shouldGenerateGLError(gl
, gl
.NO_ERROR
, `gl.deleteSampler(${nullOrUndefined})`);
36 shouldGenerateGLError(gl
, gl
.NO_ERROR
, `gl.isSampler(${nullOrUndefined})`);
37 shouldGenerateGLError(gl
, gl
.NO_ERROR
, `gl.deleteVertexArray(${nullOrUndefined})`);
38 shouldGenerateGLError(gl
, gl
.NO_ERROR
, `gl.isVertexArray(${nullOrUndefined})`);
40 shouldGenerateGLError(gl
, gl
.NO_ERROR
, `gl.bindSampler(0, ${nullOrUndefined})`);
41 shouldThrow(`gl.samplerParameteri(${nullOrUndefined}, gl.TEXTURE_MAG_FILTER, gl.NEAREST)`);
42 shouldThrow(`gl.samplerParameterf(${nullOrUndefined}, gl.TEXTURE_MAX_LOD, 1)`);
43 shouldThrow(`gl.getSamplerParameter(${nullOrUndefined}, gl.TEXTURE_MAX_LOD)`);
45 shouldThrow(`gl.waitSync(${nullOrUndefined}, 0, 0)`);
46 shouldThrow(`gl.clientWaitSync(${nullOrUndefined}, 0, 0)`);
47 shouldThrow(`gl.getSyncParameter(${nullOrUndefined}, gl.OBJECT_TYPE)`);
49 shouldGenerateGLError(gl
, gl
.NO_ERROR
, `gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, ${nullOrUndefined})`);
50 shouldThrow(`gl.transformFeedbackVaryings(${nullOrUndefined}, [], gl.SEPARATE_ATTRIBS)`);
52 shouldGenerateGLError(gl
, gl
.NO_ERROR
, `gl.bindVertexArray(${nullOrUndefined})`);
56 var successfullyParsed
= true;
59 <script src=
"../../js/js-test-post.js"></script>