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 WebGL_debug_renderer_info Conformance Tests
</title>
12 <link rel=
"stylesheet" href=
"../../resources/js-test-style.css"/>
13 <script src=
"../../js/js-test-pre.js"></script>
14 <script src=
"../../js/webgl-test-utils.js"></script>
17 <div id=
"description"></div>
18 <canvas id=
"canvas" style=
"width: 1px; height: 1px;"> </canvas>
19 <div id=
"console"></div>
20 <!-- Shaders for testing standard derivatives -->
24 description("This test verifies the functionality of the WEBGL_debug_renderer_info extension, if it is available.");
28 var wtu
= WebGLTestUtils
;
29 var gl
= wtu
.create3DContext("canvas");
34 testFailed("WebGL context does not exist");
36 testPassed("WebGL context exists");
38 // Run tests with extension disabled
41 // Query the extension and store globally so shouldBe can access it
42 ext
= gl
.getExtension("WEBGL_debug_renderer_info");
44 testPassed("No WEBGL_debug_renderer_info support -- this is legal");
46 runSupportedTest(false);
48 testPassed("Successfully enabled WEBGL_debug_renderer_info extension");
50 runSupportedTest(true);
55 function runSupportedTest(extensionEnabled
) {
56 var supported
= gl
.getSupportedExtensions();
57 if (supported
.indexOf("WEBGL_debug_renderer_info") >= 0) {
58 if (extensionEnabled
) {
59 testPassed("WEBGL_debug_renderer_info listed as supported and getExtension succeeded");
61 testFailed("WEBGL_debug_renderer_info listed as supported but getExtension failed");
64 if (extensionEnabled
) {
65 testFailed("WEBGL_debug_renderer_info not listed as supported but getExtension succeeded");
67 testPassed("WEBGL_debug_renderer_info not listed as supported and getExtension failed -- this is legal");
72 function runTestDisabled() {
73 debug("Testing enums with extension disabled");
75 // Use the constants directly as we don't have the extension
77 var UNMASKED_VENDOR_WEBGL
= 0x9245;
78 gl
.getParameter(UNMASKED_VENDOR_WEBGL
);
79 wtu
.glErrorShouldBe(gl
, gl
.INVALID_ENUM
, "UNMASKED_VENDOR_WEBGL should not be queryable if extension is disabled");
81 var UNMASKED_RENDERER_WEBGL
= 0x9246;
82 gl
.getParameter(UNMASKED_RENDERER_WEBGL
);
83 wtu
.glErrorShouldBe(gl
, gl
.INVALID_ENUM
, "UNMASKED_RENDERER_WEBGL should not be queryable if extension is disabled");
86 function runTestEnabled() {
87 debug("Testing enums with extension enabled");
89 shouldBe("ext.UNMASKED_VENDOR_WEBGL", "0x9245");
90 gl
.getParameter(ext
.UNMASKED_VENDOR_WEBGL
);
91 wtu
.glErrorShouldBe(gl
, gl
.NO_ERROR
, "UNMASKED_VENDOR_WEBGL query should succeed if extension is enable");
93 shouldBe("ext.UNMASKED_RENDERER_WEBGL", "0x9246");
94 gl
.getParameter(ext
.UNMASKED_RENDERER_WEBGL
);
95 wtu
.glErrorShouldBe(gl
, gl
.NO_ERROR
, "UNMASKED_RENDERER_WEBGL query should succeed if extension is enable");
99 var successfullyParsed
= true;
101 <script src=
"../../js/js-test-post.js"></script>