1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
<!--
Copyright (C) 2011 Apple Computer, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL gl calls Conformance Tests</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<canvas id="canvas" width="2" height="2"> </canvas>
<script>
description("This test ensures basic functionality of the underlying graphics library");
debug("");
debug("Canvas.getContext");
var minimumRequiredStencilMask = 0;
var context = create3DContext(document.getElementById("canvas"));
if (!context)
testFailed("context does not exist");
else {
testPassed("context exists");
debug("");
debug("Context contains getError");
if ("getError" in context)
testPassed("context contains getError");
else
testFailed("context does not contains getError");
debug("");
debug("Check default values");
shouldBe('context.getParameter(context.ACTIVE_TEXTURE)', 'context.TEXTURE0');
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');
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');
shouldBe('context.getParameter(context.ARRAY_BUFFER_BINDING)', 'null');
shouldBe('context.getParameter(context.BLEND)', 'false');
shouldBe('context.getParameter(context.BLEND_COLOR)', '[0, 0, 0, 0]');
shouldBe('context.getParameter(context.BLEND_DST_ALPHA)', '0');
shouldBe('context.getParameter(context.BLEND_DST_RGB)', '0');
shouldBe('context.getParameter(context.BLEND_EQUATION_ALPHA)', 'context.FUNC_ADD');
shouldBe('context.getParameter(context.BLEND_EQUATION_RGB)', 'context.FUNC_ADD');
shouldBe('context.getParameter(context.BLEND_SRC_ALPHA)', '1');
shouldBe('context.getParameter(context.BLEND_SRC_RGB)', '1');
shouldBe('context.getParameter(context.COLOR_CLEAR_VALUE)', '[0, 0, 0, 0]');
shouldBe('context.getParameter(context.COLOR_WRITEMASK)', '[true, true, true, true]');
shouldBe('context.getParameter(context.CULL_FACE)', 'false');
shouldBe('context.getParameter(context.CULL_FACE_MODE)', 'context.BACK');
shouldBe('context.getParameter(context.CURRENT_PROGRAM)', 'null');
shouldBe('context.getParameter(context.DEPTH_CLEAR_VALUE)', '1');
shouldBe('context.getParameter(context.DEPTH_FUNC)', 'context.LESS');
shouldBe('context.getParameter(context.DEPTH_RANGE)', '[0, 1]');
shouldBe('context.getParameter(context.DEPTH_TEST)', 'false');
shouldBe('context.getParameter(context.DEPTH_WRITEMASK)', 'true');
shouldBe('context.getParameter(context.DITHER)', 'true');
shouldBe('context.getParameter(context.ELEMENT_ARRAY_BUFFER_BINDING)', 'null');
shouldBe('context.getParameter(context.FRONT_FACE)', 'context.CCW');
shouldBe('context.getParameter(context.GENERATE_MIPMAP_HINT)', 'context.DONT_CARE');
shouldBe('context.getParameter(context.LINE_WIDTH)', '1');
shouldBe('context.getParameter(context.POLYGON_OFFSET_FACTOR)', '0');
shouldBe('context.getParameter(context.POLYGON_OFFSET_FILL)', 'false');
shouldBe('context.getParameter(context.POLYGON_OFFSET_UNITS)', '0');
shouldBe('context.getParameter(context.RENDERBUFFER_BINDING)', 'null');
shouldBe('context.getParameter(context.SAMPLE_COVERAGE_INVERT)', 'false');
shouldBe('context.getParameter(context.SAMPLE_COVERAGE_VALUE)', '1');
shouldBe('context.getParameter(context.SCISSOR_BOX)[0]', '0');
shouldBe('context.getParameter(context.SCISSOR_BOX)[1]', '0');
shouldBe('context.getParameter(context.SCISSOR_TEST)', 'false');
shouldBe('context.getParameter(context.STENCIL_BACK_FAIL)', 'context.KEEP');
shouldBe('context.getParameter(context.STENCIL_BACK_FUNC)', 'context.ALWAYS');
shouldBe('context.getParameter(context.STENCIL_BACK_PASS_DEPTH_FAIL)', 'context.KEEP');
shouldBe('context.getParameter(context.STENCIL_BACK_PASS_DEPTH_PASS)', 'context.KEEP');
shouldBe('context.getParameter(context.STENCIL_BACK_REF)', '0');
var stencilBits = context.getParameter(context.STENCIL_BITS);
minimumRequiredStencilMask = (1 << stencilBits) - 1;
shouldBe('context.getParameter(context.STENCIL_BACK_VALUE_MASK) & minimumRequiredStencilMask', 'minimumRequiredStencilMask');
shouldBe('context.getParameter(context.STENCIL_BACK_WRITEMASK) & minimumRequiredStencilMask', 'minimumRequiredStencilMask');
// If EXT_packed_depth_stencil is supported, STENCIL_BITS > 0; otherwise, STENCIL_BITS == 0.
shouldBe('context.getParameter(context.STENCIL_BITS) >= 0', 'true');
shouldBe('context.getParameter(context.STENCIL_CLEAR_VALUE)', '0');
shouldBe('context.getParameter(context.STENCIL_FAIL)', 'context.KEEP');
shouldBe('context.getParameter(context.STENCIL_FUNC)', 'context.ALWAYS');
shouldBe('context.getParameter(context.STENCIL_PASS_DEPTH_FAIL)', 'context.KEEP');
shouldBe('context.getParameter(context.STENCIL_PASS_DEPTH_PASS)', 'context.KEEP');
shouldBe('context.getParameter(context.STENCIL_REF)', '0');
shouldBe('context.getParameter(context.STENCIL_TEST)', 'false');
shouldBe('context.getParameter(context.STENCIL_VALUE_MASK) & minimumRequiredStencilMask', 'minimumRequiredStencilMask');
shouldBe('context.getParameter(context.STENCIL_WRITEMASK) & minimumRequiredStencilMask', 'minimumRequiredStencilMask');
shouldBe('context.getParameter(context.TEXTURE_BINDING_2D)', 'null');
shouldBe('context.getParameter(context.TEXTURE_BINDING_CUBE_MAP)', 'null');
shouldBe('context.getParameter(context.UNPACK_ALIGNMENT)', '4');
shouldBe('context.getParameter(context.UNPACK_FLIP_Y_WEBGL)', 'false');
shouldBe('context.getParameter(context.UNPACK_PREMULTIPLY_ALPHA_WEBGL)', 'false');
shouldBe('context.getParameter(context.VIEWPORT)', '[0, 0, 2, 2]');
shouldBeNonNull('context.getParameter(context.COMPRESSED_TEXTURE_FORMATS)');
shouldBeTrue('context.getParameter(context.MAX_COMBINED_TEXTURE_IMAGE_UNITS) >= 8');
shouldBeTrue('context.getParameter(context.MAX_CUBE_MAP_TEXTURE_SIZE) >= 16');
shouldBeTrue('context.getParameter(context.MAX_FRAGMENT_UNIFORM_VECTORS) >= 16');
shouldBeTrue('context.getParameter(context.MAX_RENDERBUFFER_SIZE) >= 1');
shouldBeTrue('context.getParameter(context.MAX_TEXTURE_IMAGE_UNITS) >= 8');
shouldBeTrue('context.getParameter(context.MAX_TEXTURE_SIZE) >= 64');
shouldBeTrue('context.getParameter(context.MAX_VARYING_VECTORS) >= 8');
shouldBeTrue('context.getParameter(context.MAX_VERTEX_ATTRIBS) >= 8');
shouldBeTrue('context.getParameter(context.MAX_VERTEX_TEXTURE_IMAGE_UNITS) >= 0');
shouldBeTrue('context.getParameter(context.MAX_VERTEX_UNIFORM_VECTORS) >= 128');
// Note: This requirement should be removed from the spec IMO. Many impelementations
// will be based on FBOs and FBOs might have a restriction smaller than the current screen size.
// especially if there are multiple screens.
shouldBeTrue('context.getParameter(context.MAX_VIEWPORT_DIMS)[0] >= window.screen.width');
shouldBeTrue('context.getParameter(context.MAX_VIEWPORT_DIMS)[1] >= window.screen.height');
}
debug("");
successfullyParsed = true;
</script>
<script>finishTest();</script>
</body>
</html>
|