diff options
Diffstat (limited to 'dom/canvas/test/webgl-conf/checkout/conformance/manual')
5 files changed, 520 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/manual/angle-instanced-arrays-state-leakage.html b/dom/canvas/test/webgl-conf/checkout/conformance/manual/angle-instanced-arrays-state-leakage.html new file mode 100644 index 000000000..4b5707e70 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/manual/angle-instanced-arrays-state-leakage.html @@ -0,0 +1,99 @@ +<!-- + +/* +** Copyright (c) 2013 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +--> + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Check that ANGLE_instanced_arrays state does not leak to browser</title> +<link rel="stylesheet" href="../../resources/js-test-style.css"/> +<script src="../../js/js-test-pre.js"></script> +<script src="../../js/webgl-test-utils.js"></script> +<style> +canvas { + border: 1px solid black; +} +.correct { + border: 1px solid black; + background-color: #00ff00; +} +</style> +</head> +<body> +<pre> +This test must be run manually. + +This test tests that leaving state for ANGLE_instanced_arrays with non-default values at the +end of rendering does not interfere with proper compositing of results. +Failures seen on Linux and Mac with Chrome 32. +See http://crbug.com/304927 for more info. + +You should see a <span class="correct">green rectangle</span> +with black a outline on success. Briefly flashing red is normal. +</pre> +<canvas id='c'></canvas> +<div id="console"></div> +<script> +"use strict"; +var wtu = WebGLTestUtils; +var c = document.getElementById("c"); +// The bug has only been seen with preserveDrawingBuffer=true. +var gl = wtu.create3DContext(c, { preserveDrawingBuffer: true }); +var ext = wtu.getExtensionWithKnownPrefixes(gl, "ANGLE_instanced_arrays"); +var frame = 0; +function render() { + var RED_FRAMES = 3; + if (frame < RED_FRAMES) { + // Draw N frames red, leaving the vertex divisor to 0 after each call. + gl.clearColor(1,0,0,1); + gl.clear(gl.COLOR_BUFFER_BIT); + wtu.requestAnimFrame(render); + } else { + // Draw 2 more times in green, setting the divisor to 1 afterward. + gl.clearColor(0,1,0,1); + gl.clear(gl.COLOR_BUFFER_BIT); + if (frame - RED_FRAMES < 2) { + wtu.requestAnimFrame(render); + } else { + finishTest(); + } + // Leave attrib 0 set with a divisor of 1 before returning to browser. + if (ext) { + ext.vertexAttribDivisorANGLE(0, 1); + } + } + frame++; +} + +if (!ext) { + testPassed("No ANGLE_instanced_arrays support -- this is legal"); +} +wtu.requestAnimFrame(render); +var successfullyParsed = true; +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/manual/canvas-clear-on-zero-count-draw.html b/dom/canvas/test/webgl-conf/checkout/conformance/manual/canvas-clear-on-zero-count-draw.html new file mode 100644 index 000000000..bf888ffae --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/manual/canvas-clear-on-zero-count-draw.html @@ -0,0 +1,111 @@ +<!-- + +/* +** Copyright (c) 2012 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +--> + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Check that the canvas is NOT recomposited after unsucessful draw call</title> +<link rel="stylesheet" href="../../resources/js-test-style.css"/> +<script src="../../js/js-test-pre.js"></script> +<script src="../../js/webgl-test-utils.js"></script> +<style> +canvas { + border: 1px solid black; +} +.correct { + border: 1px solid black; + background-color: #ffffff; +} +</style> +</head> +<body> +<pre> +This test must be run manually. + +This test tests that a canvas is cleared +even when a draw call has a zero count. + +You should see three <span class="correct">white rectangles</span> +with black outlines on success. +</pre> +<canvas id='c1'></canvas> +<canvas id='c2'></canvas> +<canvas id='c3'></canvas> +<div id="console"></div> +<script id="vshader" type="x-shader/x-vertex"> +void main() { + gl_Position = vec4(0,0,0,1); +} +</script> +<script id="fshader" type="x-shader/x-fragment"> +precision mediump float; +void main() { + discard; +} +</script> +<script> +"use strict"; +var wtu = WebGLTestUtils; +var c1 = document.getElementById("c1"); +var c2 = document.getElementById("c2"); +var c3 = document.getElementById("c2"); +var gl1 = wtu.create3DContext(c1); +var gl2 = wtu.create3DContext(c2); +var gl3 = wtu.create3DContext(c2); +gl1.clearColor(0,1,0,1); +gl1.clear(gl1.COLOR_BUFFER_BIT); +gl2.clearColor(0,1,0,1); +gl2.clear(gl2.COLOR_BUFFER_BIT); +gl3.clearColor(0,1,0,1); +gl3.clear(gl2.COLOR_BUFFER_BIT); + +wtu.waitForComposite(function() { + // test drawArrays + gl1.drawArrays(gl1.TRIANGLES, 0, 0); + wtu.glErrorShouldBe(gl1, gl1.NO_ERROR, "no errors"); +}); + +wtu.waitForComposite(function() { + // test drawElements + var buf = gl2.createBuffer(); + gl2.bindBuffer(gl2.ELEMENT_ARRAY_BUFFER, buf); + gl2.bufferData(gl2.ELEMENT_ARRAY_BUFFER, new Uint8Array(1), gl2.STATIC_DRAW); + gl2.drawElements(gl2.TRIANGLES, 0, gl2.UNSIGNED_SHORT, 0); + wtu.glErrorShouldBe(gl2, gl2.NO_ERROR, "no errors"); +}); + +wtu.waitForComposite(function() { + // test draw with program. + wtu.setupProgram(gl3, ["vshader", "fshader"]); + gl1.drawArrays(gl3.TRIANGLES, 0, 0); + wtu.glErrorShouldBe(gl3, gl2.NO_ERROR, "no errors"); +}); + +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/manual/canvas-no-clear-on-readpixels.html b/dom/canvas/test/webgl-conf/checkout/conformance/manual/canvas-no-clear-on-readpixels.html new file mode 100644 index 000000000..d1329b464 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/manual/canvas-no-clear-on-readpixels.html @@ -0,0 +1,71 @@ +<!-- + +/* +** Copyright (c) 2012 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +--> + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Check that the canvas is NOT recomposited after calling readPixels</title> +<link rel="stylesheet" href="../../resources/js-test-style.css"/> +<script src="../../js/js-test-pre.js"></script> +<script src="../../js/webgl-test-utils.js"></script> +<style> +canvas { + border: 1px solid black; +} +.correct { + border: 1px solid black; + background-color: #00ff00; +} +</style> +</head> +<body> +<pre> +This test must be run manually. + +This test tests that a canvas is NOT cleared +and recomposited after calling readPixels. + +You should see a <span class="correct">green rectangle</span> +with black a outline on success. +</pre> +<canvas id='c'></canvas> +<div id="console"></div> +<script> +"use strict"; +var wtu = WebGLTestUtils; +var c = document.getElementById("c"); +var gl = wtu.create3DContext(c); +gl.clearColor(0,1,0,1); +gl.clear(gl.COLOR_BUFFER_BIT); +wtu.waitForComposite(function() { + gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4)); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "no errors"); +}); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/manual/canvas-no-clear-on-unsuccessful-draw.html b/dom/canvas/test/webgl-conf/checkout/conformance/manual/canvas-no-clear-on-unsuccessful-draw.html new file mode 100644 index 000000000..611e928a6 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/manual/canvas-no-clear-on-unsuccessful-draw.html @@ -0,0 +1,84 @@ +<!-- + +/* +** Copyright (c) 2012 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +--> + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Check that the canvas is NOT recomposited after unsucessful draw call</title> +<link rel="stylesheet" href="../../resources/js-test-style.css"/> +<script src="../../js/js-test-pre.js"></script> +<script src="../../js/webgl-test-utils.js"></script> +<style> +canvas { + border: 1px solid black; +} +.correct { + border: 1px solid black; + background-color: #00ff00; +} +</style> +</head> +<body> +<pre> +This test must be run manually. + +This test tests that a canvas is NOT cleared +when a draw call fails. + +You should see two <span class="correct">green rectangles</span> +with black outlines on success. +</pre> +<canvas id='c1'></canvas> +<canvas id='c2'></canvas> +<div id="console"></div> +<script> +"use strict"; +var wtu = WebGLTestUtils; +var c1 = document.getElementById("c1"); +var c2 = document.getElementById("c2"); +var gl1 = wtu.create3DContext(c1); +var gl2 = wtu.create3DContext(c2); +gl1.clearColor(0,1,0,1); +gl1.clear(gl1.COLOR_BUFFER_BIT); +gl2.clearColor(0,1,0,1); +gl2.clear(gl2.COLOR_BUFFER_BIT); +wtu.waitForComposite(function() { + gl1.drawArrays(gl1.BLEND, 0, 0); + wtu.glErrorShouldBe(gl1, gl1.INVALID_ENUM, "no errors"); +}); + +wtu.waitForComposite(function() { + var buf = gl2.createBuffer(); + gl2.bindBuffer(gl2.ELEMENT_ARRAY_BUFFER, buf); + gl2.bufferData(gl2.ELEMENT_ARRAY_BUFFER, new Uint8Array(1), gl2.STATIC_DRAW); + gl2.drawElements(gl2.BLEND, 0, gl2.UNSIGNED_SHORT, 0); + wtu.glErrorShouldBe(gl2, gl2.INVALID_ENUM, "no errors"); +}); +</script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/manual/framebuffers-keep-contents-exiting-fullscreen-mode.html b/dom/canvas/test/webgl-conf/checkout/conformance/manual/framebuffers-keep-contents-exiting-fullscreen-mode.html new file mode 100644 index 000000000..3b6d78fad --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/manual/framebuffers-keep-contents-exiting-fullscreen-mode.html @@ -0,0 +1,155 @@ +<!-- + +/* +** Copyright (c) 2013 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +--> + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Check that framebuffers keep contents exiting fullscreen mode.</title> +<link rel="stylesheet" href="../../resources/js-test-style.css"/> +<script src="../../js/js-test-pre.js"></script> +<script src="../../js/webgl-test-utils.js"></script> +<style> +canvas { + width: 100%; + height: 50px; + border: 1px solid black; +} +#f { + left: 0px; + top: 0px; +} +#inner { +} +input.button { + font-size: 36pt; +} +.redbox { + border: 1px solid black; + background-color: red; +} +#canvasholder { + position: relative; +} +#clabel { + position: absolute; + width: 100%; + top: 0px; + left: 0px; + font-size: 40px; + z-index: 10; + text-align: center; +} +</style> +</head> +<body> +<pre> +This test must be run manually. + +Checks that framebuffers keep their contents going into and out of fullscreen mode. + +Through the entire test you should see a <span class="redbox">red rectangle</span>. If it is not <span class="redbox">red</span> in all cases the test has failed. +</pre> +<div id="f"> + <div id="inner"> + <div id="buttonHolder"> + <div><input id="button" class="button" type="button" value="Click this button to continue the test"/></div> + <div id="canvasholder"> + <canvas id='c'></canvas> + <div id='clabel'> + should be red + </div> + </div> + </div> + </div> +</div> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +var wtu = WebGLTestUtils; +var testedFullScreen = false; +var c = document.getElementById("c"); +var button = document.getElementById("button"); +var buttonHolder = document.getElementById("buttonHolder"); +var gl = wtu.create3DContext(c); +if (!gl) { + testFailed("can't init WebGL"); +} + +var checkState = function() { + debug(""); + wtu.checkCanvasRect(gl, 0, 0, 1, 1, [0, 255, 0, 255]); + shouldBeNonNull("gl.getParameter(gl.FRAMEBUFFER_BINDING)"); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors"); +} + +var checkFramebufferState = function(fullscreen) { + checkState(); + + debug("fullscreen:" + fullscreen); + + if (fullscreen) { + // Not sure if this is needed but need to make sure + // we at least went fullscreen once. + testedFullScreen = true; + } else { + if (testedFullScreen) { + finishTest(); + } + } +}; + +var test = function() { + if (!wtu.setupFullscreen("button", "f", checkFramebufferState)) { + testPassed("Browser does not support fullscreen mode. This is OK"); + finishTest(); + return; + } + + var fb = gl.createFramebuffer(); + var tex = gl.createTexture(); + + gl.clearColor(1,0,0,1); + gl.clear(gl.COLOR_BUFFER_BIT); + + gl.bindFramebuffer(gl.FRAMEBUFFER, fb); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0); + shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE"); + + gl.clearColor(0, 1, 0, 1); + gl.clear(gl.COLOR_BUFFER_BIT); + + checkState(); +}; +test(); + +</script> +</body> +</html> |