Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: conformance/extensions/webgl-debug-shaders.html

Issue 8342021: Add webgl conformance tests r15841. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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_shaders 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_shaders ext ension, 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 shader = null;
33
34 if (!gl) {
35 testFailed("WebGL context does not exist");
36 } else {
37 testPassed("WebGL context exists");
38
39 // Query the extension and store globally so shouldBe can access it
40 ext = gl.getExtension("WEBGL_debug_shaders");
41 if (!ext) {
42 testPassed("No WEBGL_debug_shaders support -- this is legal");
43
44 runSupportedTest(false);
45 } else {
46 testPassed("Successfully enabled WEBGL_debug_shaders extension");
47
48 runSupportedTest(true);
49 runTestEnabled();
50 }
51 }
52
53 function runSupportedTest(extensionEnabled) {
54 var supported = gl.getSupportedExtensions();
55 if (supported.indexOf("WEBGL_debug_shaders") >= 0) {
56 if (extensionEnabled) {
57 testPassed("WEBGL_debug_shaders listed as supported and getExtension succeeded");
58 } else {
59 testFailed("WEBGL_debug_shaders listed as supported but getExtension failed");
60 }
61 } else {
62 if (extensionEnabled) {
63 testFailed("WEBGL_debug_shaders not listed as supported but getExten sion succeeded");
64 } else {
65 testPassed("WEBGL_debug_shaders not listed as supported and getExten sion failed -- this is legal");
66 }
67 }
68 }
69
70 function runTestEnabled() {
71 debug("Testing function with extension enabled");
72
73 var source = "void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); }";
74
75 shader = gl.createShader(gl.FRAGMENT_SHADER);
76
77 // if no source has been defined or compileShader() has not been called,
78 // getTranslatedShaderSource() should return an empty string.
79 shouldBeNull("ext.getTranslatedShaderSource(shader)");
80 gl.shaderSource(shader, source);
81 shouldBeNull("ext.getTranslatedShaderSource(shader)");
82 gl.compileShader(shader);
83 shouldBeTrue("gl.getShaderParameter(shader, gl.COMPILE_STATUS)");
84 var translatedSource = ext.getTranslatedShaderSource(shader);
85 glErrorShouldBe(gl, gl.NO_ERROR, "No gl error should occur");
86 if (translatedSource.length > 0)
87 testPassed("Successfully called getTranslatedShaderSource()");
88 else
89 testFailed("Calling getTranslatedShaderSource() failed");
90 }
91
92 debug("");
93 successfullyParsed = true;
94 </script>
95 <script src="../../resources/js-test-post.js"></script>
96
97 </body>
98 </html>
OLDNEW
« no previous file with comments | « conformance/extensions/webgl-debug-renderer-info.html ('k') | conformance/glsl/00_test_list.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698