1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/canvas/test/webgl-conformance/conformance/state/gl-get-calls.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,156 @@ 1.4 +<!-- 1.5 +Copyright (C) 2011 Apple Computer, Inc. All rights reserved. 1.6 + 1.7 +Redistribution and use in source and binary forms, with or without 1.8 +modification, are permitted provided that the following conditions 1.9 +are met: 1.10 +1. Redistributions of source code must retain the above copyright 1.11 + notice, this list of conditions and the following disclaimer. 1.12 +2. Redistributions in binary form must reproduce the above copyright 1.13 + notice, this list of conditions and the following disclaimer in the 1.14 + documentation and/or other materials provided with the distribution. 1.15 + 1.16 +THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 1.17 +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1.18 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1.19 +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 1.20 +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 1.21 +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 1.22 +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 1.23 +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 1.24 +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1.25 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 1.26 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.27 +--> 1.28 + 1.29 +<!DOCTYPE html> 1.30 +<html> 1.31 +<head> 1.32 +<meta charset="utf-8"> 1.33 +<title>WebGL gl calls Conformance Tests</title> 1.34 +<link rel="stylesheet" href="../../resources/js-test-style.css"/> 1.35 +<script src="../../resources/js-test-pre.js"></script> 1.36 +<script src="../resources/webgl-test.js"></script> 1.37 +</head> 1.38 +<body> 1.39 +<div id="description"></div> 1.40 +<div id="console"></div> 1.41 +<canvas id="canvas" width="2" height="2"> </canvas> 1.42 + 1.43 +<script> 1.44 + 1.45 +description("This test ensures basic functionality of the underlying graphics library"); 1.46 + 1.47 +debug(""); 1.48 +debug("Canvas.getContext"); 1.49 + 1.50 +var minimumRequiredStencilMask = 0; 1.51 +var context = create3DContext(document.getElementById("canvas")); 1.52 +if (!context) 1.53 + testFailed("context does not exist"); 1.54 +else { 1.55 + testPassed("context exists"); 1.56 + 1.57 + debug(""); 1.58 + debug("Context contains getError"); 1.59 + if ("getError" in context) 1.60 + testPassed("context contains getError"); 1.61 + else 1.62 + testFailed("context does not contains getError"); 1.63 + 1.64 + debug(""); 1.65 + debug("Check default values"); 1.66 + shouldBe('context.getParameter(context.ACTIVE_TEXTURE)', 'context.TEXTURE0'); 1.67 + shouldBe('(context.getParameter(context.ALIASED_LINE_WIDTH_RANGE)[0] <= 1) && (context.getParameter(context.ALIASED_LINE_WIDTH_RANGE)[0] > 0) && (context.getParameter(context.ALIASED_LINE_WIDTH_RANGE)[1] >= 1)', 'true'); 1.68 + shouldBe('(context.getParameter(context.ALIASED_POINT_SIZE_RANGE)[0] <= 1) && (context.getParameter(context.ALIASED_POINT_SIZE_RANGE)[0] > 0) && (context.getParameter(context.ALIASED_POINT_SIZE_RANGE)[1] >= 1)', 'true'); 1.69 + shouldBe('context.getParameter(context.ARRAY_BUFFER_BINDING)', 'null'); 1.70 + shouldBe('context.getParameter(context.BLEND)', 'false'); 1.71 + shouldBe('context.getParameter(context.BLEND_COLOR)', '[0, 0, 0, 0]'); 1.72 + shouldBe('context.getParameter(context.BLEND_DST_ALPHA)', '0'); 1.73 + shouldBe('context.getParameter(context.BLEND_DST_RGB)', '0'); 1.74 + shouldBe('context.getParameter(context.BLEND_EQUATION_ALPHA)', 'context.FUNC_ADD'); 1.75 + shouldBe('context.getParameter(context.BLEND_EQUATION_RGB)', 'context.FUNC_ADD'); 1.76 + shouldBe('context.getParameter(context.BLEND_SRC_ALPHA)', '1'); 1.77 + shouldBe('context.getParameter(context.BLEND_SRC_RGB)', '1'); 1.78 + shouldBe('context.getParameter(context.COLOR_CLEAR_VALUE)', '[0, 0, 0, 0]'); 1.79 + shouldBe('context.getParameter(context.COLOR_WRITEMASK)', '[true, true, true, true]'); 1.80 + shouldBe('context.getParameter(context.CULL_FACE)', 'false'); 1.81 + shouldBe('context.getParameter(context.CULL_FACE_MODE)', 'context.BACK'); 1.82 + shouldBe('context.getParameter(context.CURRENT_PROGRAM)', 'null'); 1.83 + shouldBe('context.getParameter(context.DEPTH_CLEAR_VALUE)', '1'); 1.84 + shouldBe('context.getParameter(context.DEPTH_FUNC)', 'context.LESS'); 1.85 + shouldBe('context.getParameter(context.DEPTH_RANGE)', '[0, 1]'); 1.86 + shouldBe('context.getParameter(context.DEPTH_TEST)', 'false'); 1.87 + shouldBe('context.getParameter(context.DEPTH_WRITEMASK)', 'true'); 1.88 + shouldBe('context.getParameter(context.DITHER)', 'true'); 1.89 + shouldBe('context.getParameter(context.ELEMENT_ARRAY_BUFFER_BINDING)', 'null'); 1.90 + shouldBe('context.getParameter(context.FRONT_FACE)', 'context.CCW'); 1.91 + shouldBe('context.getParameter(context.GENERATE_MIPMAP_HINT)', 'context.DONT_CARE'); 1.92 + shouldBe('context.getParameter(context.LINE_WIDTH)', '1'); 1.93 + shouldBe('context.getParameter(context.POLYGON_OFFSET_FACTOR)', '0'); 1.94 + shouldBe('context.getParameter(context.POLYGON_OFFSET_FILL)', 'false'); 1.95 + shouldBe('context.getParameter(context.POLYGON_OFFSET_UNITS)', '0'); 1.96 + shouldBe('context.getParameter(context.RENDERBUFFER_BINDING)', 'null'); 1.97 + shouldBe('context.getParameter(context.SAMPLE_COVERAGE_INVERT)', 'false'); 1.98 + shouldBe('context.getParameter(context.SAMPLE_COVERAGE_VALUE)', '1'); 1.99 + shouldBe('context.getParameter(context.SCISSOR_BOX)[0]', '0'); 1.100 + shouldBe('context.getParameter(context.SCISSOR_BOX)[1]', '0'); 1.101 + shouldBe('context.getParameter(context.SCISSOR_TEST)', 'false'); 1.102 + shouldBe('context.getParameter(context.STENCIL_BACK_FAIL)', 'context.KEEP'); 1.103 + shouldBe('context.getParameter(context.STENCIL_BACK_FUNC)', 'context.ALWAYS'); 1.104 + shouldBe('context.getParameter(context.STENCIL_BACK_PASS_DEPTH_FAIL)', 'context.KEEP'); 1.105 + shouldBe('context.getParameter(context.STENCIL_BACK_PASS_DEPTH_PASS)', 'context.KEEP'); 1.106 + shouldBe('context.getParameter(context.STENCIL_BACK_REF)', '0'); 1.107 + 1.108 + var stencilBits = context.getParameter(context.STENCIL_BITS); 1.109 + minimumRequiredStencilMask = (1 << stencilBits) - 1; 1.110 + 1.111 + shouldBe('context.getParameter(context.STENCIL_BACK_VALUE_MASK) & minimumRequiredStencilMask', 'minimumRequiredStencilMask'); 1.112 + shouldBe('context.getParameter(context.STENCIL_BACK_WRITEMASK) & minimumRequiredStencilMask', 'minimumRequiredStencilMask'); 1.113 + 1.114 + // If EXT_packed_depth_stencil is supported, STENCIL_BITS > 0; otherwise, STENCIL_BITS == 0. 1.115 + shouldBe('context.getParameter(context.STENCIL_BITS) >= 0', 'true'); 1.116 + shouldBe('context.getParameter(context.STENCIL_CLEAR_VALUE)', '0'); 1.117 + shouldBe('context.getParameter(context.STENCIL_FAIL)', 'context.KEEP'); 1.118 + shouldBe('context.getParameter(context.STENCIL_FUNC)', 'context.ALWAYS'); 1.119 + shouldBe('context.getParameter(context.STENCIL_PASS_DEPTH_FAIL)', 'context.KEEP'); 1.120 + shouldBe('context.getParameter(context.STENCIL_PASS_DEPTH_PASS)', 'context.KEEP'); 1.121 + shouldBe('context.getParameter(context.STENCIL_REF)', '0'); 1.122 + shouldBe('context.getParameter(context.STENCIL_TEST)', 'false'); 1.123 + 1.124 + shouldBe('context.getParameter(context.STENCIL_VALUE_MASK) & minimumRequiredStencilMask', 'minimumRequiredStencilMask'); 1.125 + shouldBe('context.getParameter(context.STENCIL_WRITEMASK) & minimumRequiredStencilMask', 'minimumRequiredStencilMask'); 1.126 + 1.127 + shouldBe('context.getParameter(context.TEXTURE_BINDING_2D)', 'null'); 1.128 + shouldBe('context.getParameter(context.TEXTURE_BINDING_CUBE_MAP)', 'null'); 1.129 + shouldBe('context.getParameter(context.UNPACK_ALIGNMENT)', '4'); 1.130 + shouldBe('context.getParameter(context.UNPACK_FLIP_Y_WEBGL)', 'false'); 1.131 + shouldBe('context.getParameter(context.UNPACK_PREMULTIPLY_ALPHA_WEBGL)', 'false'); 1.132 + shouldBe('context.getParameter(context.VIEWPORT)', '[0, 0, 2, 2]'); 1.133 + shouldBeNonNull('context.getParameter(context.COMPRESSED_TEXTURE_FORMATS)'); 1.134 + 1.135 + shouldBeTrue('context.getParameter(context.MAX_COMBINED_TEXTURE_IMAGE_UNITS) >= 8'); 1.136 + shouldBeTrue('context.getParameter(context.MAX_CUBE_MAP_TEXTURE_SIZE) >= 16'); 1.137 + shouldBeTrue('context.getParameter(context.MAX_FRAGMENT_UNIFORM_VECTORS) >= 16'); 1.138 + shouldBeTrue('context.getParameter(context.MAX_RENDERBUFFER_SIZE) >= 1'); 1.139 + shouldBeTrue('context.getParameter(context.MAX_TEXTURE_IMAGE_UNITS) >= 8'); 1.140 + shouldBeTrue('context.getParameter(context.MAX_TEXTURE_SIZE) >= 64'); 1.141 + shouldBeTrue('context.getParameter(context.MAX_VARYING_VECTORS) >= 8'); 1.142 + shouldBeTrue('context.getParameter(context.MAX_VERTEX_ATTRIBS) >= 8'); 1.143 + shouldBeTrue('context.getParameter(context.MAX_VERTEX_TEXTURE_IMAGE_UNITS) >= 0'); 1.144 + shouldBeTrue('context.getParameter(context.MAX_VERTEX_UNIFORM_VECTORS) >= 128'); 1.145 + // Note: This requirement should be removed from the spec IMO. Many impelementations 1.146 + // will be based on FBOs and FBOs might have a restriction smaller than the current screen size. 1.147 + // especially if there are multiple screens. 1.148 + shouldBeTrue('context.getParameter(context.MAX_VIEWPORT_DIMS)[0] >= window.screen.width'); 1.149 + shouldBeTrue('context.getParameter(context.MAX_VIEWPORT_DIMS)[1] >= window.screen.height'); 1.150 +} 1.151 + 1.152 +debug(""); 1.153 +successfullyParsed = true; 1.154 + 1.155 +</script> 1.156 +<script>finishTest();</script> 1.157 + 1.158 +</body> 1.159 +</html>