content/canvas/test/webgl-conformance/conformance/extensions/webgl-debug-renderer-info.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!--
     2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
     3 Use of this source code is governed by a BSD-style license that can be
     4 found in the LICENSE file.
     5  -->
     6 <!DOCTYPE html>
     7 <html>
     8 <head>
     9 <meta charset="utf-8">
    10 <title>WebGL WebGL_debug_renderer_info Conformance Tests</title>
    11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
    12 <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
    13 <script src="../../resources/js-test-pre.js"></script>
    14 <script src="../resources/webgl-test.js"></script>
    15 <script src="../resources/webgl-test-utils.js"></script>
    16 </head>
    17 <body>
    18 <div id="description"></div>
    19 <canvas id="canvas" style="width: 1px; height: 1px;"> </canvas>
    20 <div id="console"></div>
    21 <!-- Shaders for testing standard derivatives -->
    23 <script>
    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();
    52     }
    53 }
    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");
    62         }
    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");
    68         }
    69     }
    70 }
    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     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     glErrorShouldBe(gl, gl.INVALID_ENUM, "UNMASKED_RENDERER_WEBGL should not be queryable if extension is disabled");
    84 }
    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     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     glErrorShouldBe(gl, gl.NO_ERROR, "UNMASKED_RENDERER_WEBGL query should succeed if extension is enable");
    96 }
    98 debug("");
    99 successfullyParsed = true;
   100 </script>
   101 <script>finishTest();</script>
   103 </body>
   104 </html>

mercurial