OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 |
| 3 /* |
| 4 ** Copyright (c) 2012 The Khronos Group Inc. |
| 5 ** |
| 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: |
| 13 ** |
| 14 ** The above copyright notice and this permission notice shall be included |
| 15 ** in all copies or substantial portions of the Materials. |
| 16 ** |
| 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. |
| 24 */ |
| 25 |
| 26 --> |
| 27 |
| 28 <!DOCTYPE html> |
| 29 <html> |
| 30 <head> |
| 31 <meta charset="utf-8"> |
| 32 <title>WebGL WebGL_debug_renderer_info Conformance Tests</title> |
| 33 <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
| 34 <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></s
cript> |
| 35 <script src="../../resources/js-test-pre.js"></script> |
| 36 <script src="../resources/webgl-test.js"></script> |
| 37 <script src="../resources/webgl-test-utils.js"></script> |
| 38 </head> |
| 39 <body> |
| 40 <div id="description"></div> |
| 41 <canvas id="canvas" style="width: 1px; height: 1px;"> </canvas> |
| 42 <div id="console"></div> |
| 43 <!-- Shaders for testing standard derivatives --> |
| 44 |
| 45 <script> |
| 46 "use strict"; |
| 47 description("This test verifies the functionality of the WEBGL_debug_renderer_in
fo extension, if it is available."); |
| 48 |
| 49 debug(""); |
| 50 |
| 51 var wtu = WebGLTestUtils; |
| 52 var gl = wtu.create3DContext("canvas"); |
| 53 var ext = null; |
| 54 var vao = null; |
| 55 |
| 56 if (!gl) { |
| 57 testFailed("WebGL context does not exist"); |
| 58 } else { |
| 59 testPassed("WebGL context exists"); |
| 60 |
| 61 // Run tests with extension disabled |
| 62 runTestDisabled(); |
| 63 |
| 64 // Query the extension and store globally so shouldBe can access it |
| 65 ext = gl.getExtension("WEBGL_debug_renderer_info"); |
| 66 if (!ext) { |
| 67 testPassed("No WEBGL_debug_renderer_info support -- this is legal"); |
| 68 |
| 69 runSupportedTest(false); |
| 70 } else { |
| 71 testPassed("Successfully enabled WEBGL_debug_renderer_info extension"); |
| 72 |
| 73 runSupportedTest(true); |
| 74 runTestEnabled(); |
| 75 } |
| 76 } |
| 77 |
| 78 function runSupportedTest(extensionEnabled) { |
| 79 var supported = gl.getSupportedExtensions(); |
| 80 if (supported.indexOf("WEBGL_debug_renderer_info") >= 0) { |
| 81 if (extensionEnabled) { |
| 82 testPassed("WEBGL_debug_renderer_info listed as supported and getExt
ension succeeded"); |
| 83 } else { |
| 84 testFailed("WEBGL_debug_renderer_info listed as supported but getExt
ension failed"); |
| 85 } |
| 86 } else { |
| 87 if (extensionEnabled) { |
| 88 testFailed("WEBGL_debug_renderer_info not listed as supported but ge
tExtension succeeded"); |
| 89 } else { |
| 90 testPassed("WEBGL_debug_renderer_info not listed as supported and ge
tExtension failed -- this is legal"); |
| 91 } |
| 92 } |
| 93 } |
| 94 |
| 95 function runTestDisabled() { |
| 96 debug("Testing enums with extension disabled"); |
| 97 |
| 98 // Use the constants directly as we don't have the extension |
| 99 |
| 100 var UNMASKED_VENDOR_WEBGL = 0x9245; |
| 101 gl.getParameter(UNMASKED_VENDOR_WEBGL); |
| 102 glErrorShouldBe(gl, gl.INVALID_ENUM, "UNMASKED_VENDOR_WEBGL should not be qu
eryable if extension is disabled"); |
| 103 |
| 104 var UNMASKED_RENDERER_WEBGL = 0x9246; |
| 105 gl.getParameter(UNMASKED_RENDERER_WEBGL); |
| 106 glErrorShouldBe(gl, gl.INVALID_ENUM, "UNMASKED_RENDERER_WEBGL should not be
queryable if extension is disabled"); |
| 107 } |
| 108 |
| 109 function runTestEnabled() { |
| 110 debug("Testing enums with extension enabled"); |
| 111 |
| 112 shouldBe("ext.UNMASKED_VENDOR_WEBGL", "0x9245"); |
| 113 gl.getParameter(ext.UNMASKED_VENDOR_WEBGL); |
| 114 glErrorShouldBe(gl, gl.NO_ERROR, "UNMASKED_VENDOR_WEBGL query should succeed
if extension is enable"); |
| 115 |
| 116 shouldBe("ext.UNMASKED_RENDERER_WEBGL", "0x9246"); |
| 117 gl.getParameter(ext.UNMASKED_RENDERER_WEBGL); |
| 118 glErrorShouldBe(gl, gl.NO_ERROR, "UNMASKED_RENDERER_WEBGL query should succe
ed if extension is enable"); |
| 119 } |
| 120 |
| 121 debug(""); |
| 122 var successfullyParsed = true; |
| 123 </script> |
| 124 <script src="../../resources/js-test-post.js"></script> |
| 125 |
| 126 </body> |
| 127 </html> |
OLD | NEW |