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