Backed out changeset b462e7b742d8 (bug 1908261) for causing multiple reftest failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / extensions / webgl-debug-renderer-info.html
blob7901225db753401e67dd51fc74bd9f5a64cfc21b
1 <!--
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.
5 -->
7 <!DOCTYPE html>
8 <html>
9 <head>
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>
15 </head>
16 <body>
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 -->
22 <script>
23 "use strict";
24 description("This test verifies the functionality of the WEBGL_debug_renderer_info extension, if it is available.");
26 debug("");
28 var wtu = WebGLTestUtils;
29 var gl = wtu.create3DContext("canvas");
30 var ext = null;
31 var vao = null;
33 if (!gl) {
34 testFailed("WebGL context does not exist");
35 } else {
36 testPassed("WebGL context exists");
38 // Run tests with extension disabled
39 runTestDisabled();
41 // Query the extension and store globally so shouldBe can access it
42 ext = gl.getExtension("WEBGL_debug_renderer_info");
43 if (!ext) {
44 testPassed("No WEBGL_debug_renderer_info support -- this is legal");
46 runSupportedTest(false);
47 } else {
48 testPassed("Successfully enabled WEBGL_debug_renderer_info extension");
50 runSupportedTest(true);
51 runTestEnabled();
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");
60 } else {
61 testFailed("WEBGL_debug_renderer_info listed as supported but getExtension failed");
63 } else {
64 if (extensionEnabled) {
65 testFailed("WEBGL_debug_renderer_info not listed as supported but getExtension succeeded");
66 } else {
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");
98 debug("");
99 var successfullyParsed = true;
100 </script>
101 <script src="../../js/js-test-post.js"></script>
103 </body>
104 </html>