OLD | NEW |
| (Empty) |
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"></s
cript> | |
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 --> | |
22 | |
23 <script> | |
24 description("This test verifies the functionality of the WEBGL_debug_renderer_in
fo extension, if it is available."); | |
25 | |
26 debug(""); | |
27 | |
28 var wtu = WebGLTestUtils; | |
29 var canvas = document.getElementById("canvas"); | |
30 var gl = create3DContext(canvas); | |
31 var ext = null; | |
32 var vao = null; | |
33 | |
34 if (!gl) { | |
35 testFailed("WebGL context does not exist"); | |
36 } else { | |
37 testPassed("WebGL context exists"); | |
38 | |
39 // Run tests with extension disabled | |
40 runTestDisabled(); | |
41 | |
42 // Query the extension and store globally so shouldBe can access it | |
43 ext = gl.getExtension("WEBGL_debug_renderer_info"); | |
44 if (!ext) { | |
45 testPassed("No WEBGL_debug_renderer_info support -- this is legal"); | |
46 | |
47 runSupportedTest(false); | |
48 } else { | |
49 testPassed("Successfully enabled WEBGL_debug_renderer_info extension"); | |
50 | |
51 runSupportedTest(true); | |
52 runTestEnabled(); | |
53 } | |
54 } | |
55 | |
56 function runSupportedTest(extensionEnabled) { | |
57 var supported = gl.getSupportedExtensions(); | |
58 if (supported.indexOf("WEBGL_debug_renderer_info") >= 0) { | |
59 if (extensionEnabled) { | |
60 testPassed("WEBGL_debug_renderer_info listed as supported and getExt
ension succeeded"); | |
61 } else { | |
62 testFailed("WEBGL_debug_renderer_info listed as supported but getExt
ension failed"); | |
63 } | |
64 } else { | |
65 if (extensionEnabled) { | |
66 testFailed("WEBGL_debug_renderer_info not listed as supported but ge
tExtension succeeded"); | |
67 } else { | |
68 testPassed("WEBGL_debug_renderer_info not listed as supported and ge
tExtension failed -- this is legal"); | |
69 } | |
70 } | |
71 } | |
72 | |
73 function runTestDisabled() { | |
74 debug("Testing enums with extension disabled"); | |
75 | |
76 // Use the constants directly as we don't have the extension | |
77 | |
78 var UNMASKED_VENDOR_WEBGL = 0x9245; | |
79 gl.getParameter(UNMASKED_VENDOR_WEBGL); | |
80 glErrorShouldBe(gl, gl.INVALID_ENUM, "UNMASKED_VENDOR_WEBGL should not be qu
eryable if extension is disabled"); | |
81 | |
82 var UNMASKED_RENDERER_WEBGL = 0x9246; | |
83 gl.getParameter(UNMASKED_RENDERER_WEBGL); | |
84 glErrorShouldBe(gl, gl.INVALID_ENUM, "UNMASKED_RENDERER_WEBGL should not be
queryable if extension is disabled"); | |
85 } | |
86 | |
87 function runTestEnabled() { | |
88 debug("Testing enums with extension enabled"); | |
89 | |
90 shouldBe("ext.UNMASKED_VENDOR_WEBGL", "0x9245"); | |
91 gl.getParameter(ext.UNMASKED_VENDOR_WEBGL); | |
92 glErrorShouldBe(gl, gl.NO_ERROR, "UNMASKED_VENDOR_WEBGL query should succeed
if extension is enable"); | |
93 | |
94 shouldBe("ext.UNMASKED_RENDERER_WEBGL", "0x9246"); | |
95 gl.getParameter(ext.UNMASKED_RENDERER_WEBGL); | |
96 glErrorShouldBe(gl, gl.NO_ERROR, "UNMASKED_RENDERER_WEBGL query should succe
ed if extension is enable"); | |
97 } | |
98 | |
99 debug(""); | |
100 successfullyParsed = true; | |
101 </script> | |
102 <script src="../../resources/js-test-post.js"></script> | |
103 | |
104 </body> | |
105 </html> | |
OLD | NEW |