diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/canvas/test/webgl-conf/checkout/conformance/state | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/canvas/test/webgl-conf/checkout/conformance/state')
10 files changed, 920 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/state/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/state/00_test_list.txt new file mode 100644 index 000000000..a76c2f09f --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/00_test_list.txt @@ -0,0 +1,8 @@ +gl-enable-enum-test.html +--max-version 1.9.9 gl-enum-tests.html +gl-get-calls.html +gl-geterror.html +--max-version 1.9.9 gl-getstring.html +--min-version 1.0.4 gl-initial-state.html +--max-version 1.9.9 gl-object-get-calls.html +--min-version 1.0.3 state-uneffected-after-compositing.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/state/diffs.txt b/dom/canvas/test/webgl-conf/checkout/conformance/state/diffs.txt new file mode 100644 index 000000000..24a17204f --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/diffs.txt @@ -0,0 +1,69 @@ +4c4 +< ** Copyright (c) 2012 The Khronos Group Inc. +--- +> ** Copyright (c) 2015 The Khronos Group Inc. +34c34 +< <script src="../resources/webgl-test-utils.js"></script> +--- +> <script src="../../conformance/resources/webgl-test-utils.js"></script> +45,62c45 +< function sizeInBytes(type) { +< switch (type) { +< case gl.BYTE: +< case gl.UNSIGNED_BYTE: +< return 1; +< case gl.SHORT: +< case gl.UNSIGNED_SHORT: +< return 2; +< case gl.INT: +< case gl.UNSIGNED_INT: +< case gl.FLOAT: +< return 4; +< default: +< throw "unknown type"; +< } +< } +< +< var gl = wtu.create3DContext(); +--- +> var gl = wtu.create3DContext(null, null, 2); +191a175,178 +> var validArray = new Array(gl.COLOR_ATTACHMENT0, gl.DEPTH_ATTACHMENT, gl.STENCIL_ATTACHMENT, gl.DEPTH_STENCIL_ATTACHMENT); +> for (var ii = 1; ii < gl.getParameter(gl.MAX_COLOR_ATTACHMENTS); ++ii) { +> validArray[validArray.length] = gl.COLOR_ATTACHMENT0 + ii; +> } +195,199c182 +< [ gl.COLOR_ATTACHMENT0, +< gl.DEPTH_ATTACHMENT, +< gl.STENCIL_ATTACHMENT, +< gl.DEPTH_STENCIL_ATTACHMENT +< ], +--- +> validArray, +257a241 +> gl.RENDERBUFFER_SAMPLES, +325c309 +< var boolProgram = wtu.loadProgramFromFile(gl, "../resources/boolUniformShader.vert", "../resources/noopUniformShader.frag"); +--- +> var boolProgram = wtu.loadProgramFromFile(gl, "../../conformance/resources/boolUniformShader.vert", "../../conformance/resources/noopUniformShader.frag"); +342c326 +< var intProgram = wtu.loadProgramFromFile(gl, "../resources/intUniformShader.vert", "../resources/noopUniformShader.frag"); +--- +> var intProgram = wtu.loadProgramFromFile(gl, "../../conformance/resources/intUniformShader.vert", "../../conformance/resources/noopUniformShader.frag"); +359c343 +< var floatProgram = wtu.loadProgramFromFile(gl, "../resources/floatUniformShader.vert", "../resources/noopUniformShader.frag"); +--- +> var floatProgram = wtu.loadProgramFromFile(gl, "../../conformance/resources/floatUniformShader.vert", "../../conformance/resources/noopUniformShader.frag"); +376c360 +< var samplerProgram = wtu.loadProgramFromFile(gl, "../resources/noopUniformShader.vert", "../resources/samplerUniformShader.frag"); +--- +> var samplerProgram = wtu.loadProgramFromFile(gl, "../../conformance/resources/noopUniformShader.vert", "../../conformance/resources/samplerUniformShader.frag"); +387c371 +< var matProgram = wtu.loadProgramFromFile(gl, "../resources/matUniformShader.vert", "../resources/noopUniformShader.frag"); +--- +> var matProgram = wtu.loadProgramFromFile(gl, "../../conformance/resources/matUniformShader.vert", "../../conformance/resources/noopUniformShader.frag"); +438c422,423 +< gl.CURRENT_VERTEX_ATTRIB +--- +> gl.CURRENT_VERTEX_ATTRIB, +> gl.VERTEX_ATTRIB_ARRAY_DIVISOR diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enable-enum-test.html b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enable-enum-test.html new file mode 100644 index 000000000..c58b26e15 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enable-enum-test.html @@ -0,0 +1,161 @@ +<!-- + +/* +** 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>WebGL gl.ENABLE enums Conformance Tests</title> +<link rel="stylesheet" href="../../resources/js-test-style.css"/> +<script src="../../js/desktop-gl-constants.js"></script> +<script src="../../js/js-test-pre.js"></script> +<script src="../../js/webgl-test-utils.js"></script> +</head> +<body> +<div id="description"></div> +<div id="console"></div> +<canvas id="canvas" width="2" height="2"> </canvas> +<script> +"use strict"; +description("This test ensures WebGL implementations allow OpenGL ES 2.0 features to be turned on but not non OpenGL ES 2.0 features."); + +debug(""); +debug("Canvas.getContext"); + +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("canvas"); +if (!gl) { + testFailed("context does not exist"); +} else { + testPassed("context exists"); + + debug(""); + debug("Checking gl.ENABLE enums."); + + var invalidEnums = [ + 'ALPHA_TEST', + 'AUTO_NORMAL', + 'CLIP_PLANE0', + 'CLIP_PLANE1', + 'COLOR_LOGIC_OP', + 'COLOR_MATERIAL', + 'COLOR_SUM', + 'COLOR_TABLE', + // 'CONVOLUTION_1D', + // 'CONVOLUTION_2D', + 'FOG', + 'HISTOGRAM', + 'INDEX_LOGIC_OP', + 'LIGHT0', + 'LIGHT1', + 'LIGHTING', + 'LINE_SMOOTH', + 'LINE_STIPPLE', + 'MAP1_COLOR_4', + 'MAP1_INDEX', + 'MAP1_NORMAL', + 'MAP1_TEXTURE_COORD_1', + 'MAP1_TEXTURE_COORD_2', + 'MAP1_TEXTURE_COORD_3', + 'MAP1_TEXTURE_COORD_4', + 'MAP1_VERTEX_3', + 'MAP1_VERTEX_4', + 'MAP2_COLOR_4', + 'MAP2_INDEX', + 'MAP2_NORMAL', + 'MAP2_TEXTURE_COORD_1', + 'MAP2_TEXTURE_COORD_2', + 'MAP2_TEXTURE_COORD_3', + 'MAP2_TEXTURE_COORD_4', + 'MAP2_VERTEX_3', + 'MAP2_VERTEX_4', + 'MINMAX', + 'MULTISAMPLE', + 'NORMALIZE', + 'POINT_SMOOTH', + 'POINT_SPRITE', + 'POLYGON_OFFSET_LINE', + 'POLYGON_OFFSET_POINT', + 'POLYGON_SMOOTH', + 'POLYGON_STIPPLE', + 'POST_COLOR_MATRIX_COLOR_TABLE', + 'POST_CONVOLUTION_COLOR_TABLE', + 'RESCALE_NORMAL', + 'SAMPLE_ALPHA_TO_ONE', + // 'SEPARABLE_2D', + 'TEXTURE_1D', + 'TEXTURE_2D', + 'TEXTURE_3D', + 'TEXTURE_CUBE_MAP', + 'TEXTURE_GEN_Q', + 'TEXTURE_GEN_R', + 'TEXTURE_GEN_S', + 'TEXTURE_GEN_T', + 'VERTEX_PROGRAM_POINT_SIZE', + 'VERTEX_PROGRAM_TWO_SIDE' + ]; + + for (var ii = 0; ii < invalidEnums.length; ++ii) { + var name = invalidEnums[ii]; + gl.enable(desktopGL[name]); + wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, + "gl.enable must set INVALID_ENUM when passed GL_" + name ); + } + + var validEnums = [ + 'BLEND', + 'CULL_FACE', + 'DEPTH_TEST', + 'DITHER', + 'POLYGON_OFFSET_FILL', + 'SAMPLE_ALPHA_TO_COVERAGE', + 'SAMPLE_COVERAGE', + 'SCISSOR_TEST', + 'STENCIL_TEST' + ]; + + for (var ii = 0; ii < validEnums.length; ++ii) { + var name = validEnums[ii]; + gl.enable(gl[name]); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, + "gl.enable must succeed when passed gl." + name ); + shouldBe('gl.isEnabled(gl.' + name + ')', 'true'); + gl.disable(gl[name]); + shouldBe('gl.isEnabled(gl.' + name + ')', 'false'); + } + + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors"); +} + +debug(""); +var successfullyParsed = true; + +</script> +<script src="../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enum-tests.html b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enum-tests.html new file mode 100644 index 000000000..96fac1276 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enum-tests.html @@ -0,0 +1,50 @@ +<!-- + +/* +** 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>WebGL gl enums Conformance Tests</title> +<link rel="stylesheet" href="../../resources/js-test-style.css"/> +<script src="../../js/desktop-gl-constants.js"></script> +<script src="../../js/js-test-pre.js"></script> +<script src="../../js/webgl-test-utils.js"></script> +<script src="../../js/test-eval.js"></script> +</head> +<body> +<div id="description"></div> +<div id="console"></div> +<canvas id="canvas" width="2" height="2"> </canvas> +<script> +var contextVersion = 1; +</script> +<script src="../../js/tests/gl-enum-tests.js"></script> +<script src="../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-get-calls.html b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-get-calls.html new file mode 100644 index 000000000..46677de1f --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-get-calls.html @@ -0,0 +1,219 @@ +<!-- + +/* +** 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>WebGL gl calls Conformance Tests</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> +</head> +<body> +<div id="description"></div> +<div id="console"></div> +<canvas id="canvas" width="2" height="2"> </canvas> +<script> +"use strict"; +description("This test ensures basic functionality of the underlying graphics library"); + +debug(""); +debug("Canvas.getContext"); + +var minimumRequiredStencilMask = 0; +var wtu = WebGLTestUtils; +var context = wtu.create3DContext("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'); + shouldBeType('context.getParameter(context.ALIASED_LINE_WIDTH_RANGE)', 'Float32Array'); + shouldBeType('context.getParameter(context.ALIASED_POINT_SIZE_RANGE)', 'Float32Array'); + shouldBe('context.getParameter(context.ARRAY_BUFFER_BINDING)', 'null'); + shouldBe('context.getParameter(context.BLEND)', 'false'); + shouldBe('context.getParameter(context.BLEND_COLOR)', '[0, 0, 0, 0]'); + shouldBeType('context.getParameter(context.BLEND_COLOR)', 'Float32Array'); + 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]'); + shouldBeType('context.getParameter(context.COLOR_CLEAR_VALUE)', 'Float32Array'); + shouldBe('context.getParameter(context.COLOR_WRITEMASK)', '[true, true, true, true]'); + shouldBeType('context.getParameter(context.COMPRESSED_TEXTURE_FORMATS)', 'Uint32Array'); + 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]'); + shouldBeType('context.getParameter(context.DEPTH_RANGE)', 'Float32Array'); + 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.PACK_ALIGNMENT)', '4'); + 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_BOX)[2]', 'context.getParameter(context.VIEWPORT)[2]'); + shouldBe('context.getParameter(context.SCISSOR_BOX)[3]', 'context.getParameter(context.VIEWPORT)[3]'); + shouldBeType('context.getParameter(context.SCISSOR_BOX)', Int32Array); + 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'); + + // WebGL 1.0.2 - 5.14.3 types / ES 2.0.25 - 6.2 State tables - 6.18 page 152 + shouldBeType('context.getParameter(context.SUBPIXEL_BITS)', 'Number'); + shouldBeGreaterThanOrEqual('context.getParameter(context.SUBPIXEL_BITS)', '4'); + + shouldBeType('context.getParameter(context.SAMPLE_BUFFERS)', 'Number'); + shouldBeGreaterThanOrEqual('context.getParameter(context.SAMPLE_BUFFERS)', '0'); + + shouldBeType('context.getParameter(context.SAMPLES)', 'Number'); + shouldBeGreaterThanOrEqual('context.getParameter(context.SAMPLES)', '0'); + + shouldBeType('context.getParameter(context.DEPTH_BITS)', 'Number'); + shouldBeGreaterThanOrEqual('context.getParameter(context.DEPTH_BITS)', '0'); + shouldBeType('context.getParameter(context.RED_BITS)', 'Number'); + shouldBeGreaterThanOrEqual('context.getParameter(context.RED_BITS)', '0'); + shouldBeType('context.getParameter(context.GREEN_BITS)', 'Number'); + shouldBeGreaterThanOrEqual('context.getParameter(context.GREEN_BITS)', '0'); + shouldBeType('context.getParameter(context.BLUE_BITS)', 'Number'); + shouldBeGreaterThanOrEqual('context.getParameter(context.BLUE_BITS)', '0'); + shouldBeType('context.getParameter(context.ALPHA_BITS)', 'Number'); + shouldBeGreaterThanOrEqual('context.getParameter(context.ALPHA_BITS)', '0'); + shouldBeType('context.getParameter(context.STENCIL_BITS)', 'Number'); + + 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]'); + shouldBeType('context.getParameter(context.VIEWPORT)', 'Int32Array'); + + shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_COMBINED_TEXTURE_IMAGE_UNITS)', '8'); + shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_CUBE_MAP_TEXTURE_SIZE)', '16'); + shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_FRAGMENT_UNIFORM_VECTORS)', '16'); + shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_RENDERBUFFER_SIZE)', '1'); + shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_TEXTURE_IMAGE_UNITS)', '8'); + shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_TEXTURE_SIZE)', '64'); + shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_VARYING_VECTORS)', '8'); + shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_VERTEX_ATTRIBS)', '8'); + shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_VERTEX_TEXTURE_IMAGE_UNITS)', '0'); + shouldBeGreaterThanOrEqual('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'); + shouldBeType('context.getParameter(context.MAX_VIEWPORT_DIMS)', 'Int32Array'); + + debug(""); + debug("check texture values"); + var maxTextures = context.getParameter(context.MAX_TEXTURE_IMAGE_UNITS); + for (var ii = 0; ii < maxTextures; ++ii) { + context.activeTexture(context.TEXTURE0 + ii); + debug("check texture unit: " + ii); + shouldBe('context.getParameter(context.TEXTURE_BINDING_2D)', 'null'); + shouldBe('context.getParameter(context.TEXTURE_BINDING_CUBE_MAP)', 'null'); + } + + debug(""); + debug("check attrib values"); + var maxAttribs = context.getParameter(context.MAX_VERTEX_ATTRIBS); + for (var ii = 0; ii < maxAttribs; ++ii) { + debug("check attrib: " + ii); + shouldBe('context.getVertexAttrib(ii, context.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING)', 'null'); + shouldBe('context.getVertexAttrib(ii, context.VERTEX_ATTRIB_ARRAY_ENABLED)', 'false'); + shouldBe('context.getVertexAttrib(ii, context.VERTEX_ATTRIB_ARRAY_SIZE)', '4'); + shouldBe('context.getVertexAttrib(ii, context.VERTEX_ATTRIB_ARRAY_STRIDE)', '0'); + shouldBe('context.getVertexAttrib(ii, context.VERTEX_ATTRIB_ARRAY_TYPE)', 'context.FLOAT'); + shouldBe('context.getVertexAttrib(ii, context.VERTEX_ATTRIB_ARRAY_NORMALIZED)', 'false'); + shouldBe('context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB)', '[0, 0, 0, 1]'); + shouldBeType('context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB)', 'Float32Array'); + shouldBe('context.getVertexAttribOffset(ii, context.VERTEX_ATTRIB_ARRAY_POINTER)', '0'); + } + + shouldBe('context.getError()', 'context.NO_ERROR'); +} + +debug(""); +var successfullyParsed = true; + +</script> +<script src="../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-geterror.html b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-geterror.html new file mode 100644 index 000000000..037abca8f --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-geterror.html @@ -0,0 +1,99 @@ +<!-- + +/* +** 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>WebGL get error conformance test.</title> +<link rel="stylesheet" href="../../resources/js-test-style.css"/> +<script src="../../js/desktop-gl-constants.js"></script> +<script src="../../js/js-test-pre.js"></script> +<script src="../../js/webgl-test-utils.js"> </script> +</head> +<body> +<canvas id="example" width="1" height="1" style="width: 256px; height: 48px;"></canvas> +<div id="description"></div><div id="console"></div> +<script> +"use strict"; +description("Test getError."); +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("example"); +var tex = gl.createTexture(); +gl.bindTexture(gl.TEXTURE_2D, tex); + +gl.enable(desktopGL.ALPHA_TEST); +wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "should generate INVALID_ENUM"); +gl.viewport(-1, -1, -1, -1); +wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "should generate INVALID_VALUE"); +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); +wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "should generate INVALID_OPERATION"); + +// Generate 2 errors of each type for 6 total possible errors. +// The OpenGL ES 2.0 spec section 2.5 says the implementation is allowed to +// either return the first error or many errors in an unspecied order. +gl.viewport(-1, -1, -1, -1); +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); +gl.enable(desktopGL.ALPHA_TEST); +gl.viewport(-1, -1, -1, -1); +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); +// Note: This error is specifically last because we know it will be synthasized +// by WebGL at least when implemented on top of Desktop OpenGL +gl.enable(desktopGL.ALPHA_TEST); + +var err1 = gl.getError(); +var err2 = gl.getError(); +var err3 = gl.getError(); +var err4 = gl.getError(); +var err5 = gl.getError(); +var err6 = gl.getError(); + +debug(""); +if (err2 == gl.NO_ERROR) { + debug("This WebGL implementation looks like it uses the 'first error' method"); + debug("There should be 1 error, the first one generated"); + shouldBeTrue('err1 == gl.INVALID_VALUE && err2 == gl.NO_ERROR && err3 == gl.NO_ERROR'); +} else { + debug("This WebGL implementation looks like it uses the many error method"); + debug("Check is that at least one of the errors is the first error"); + shouldBeTrue('err1 == gl.INVALID_VALUE || ' + + 'err2 == gl.INVALID_VALUE || ' + + 'err3 == gl.INVALID_VALUE || ' + + 'err4 == gl.INVALID_VALUE || ' + + 'err5 == gl.INVALID_VALUE || ' + + 'err6 == gl.INVALID_VALUE'); + shouldBeTrue('gl.getError() == gl.NO_ERROR'); +} + +debug(""); +var successfullyParsed = true; +</script> +<script src="../../js/js-test-post.js"></script> + +</body> +</html> + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-getstring.html b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-getstring.html new file mode 100644 index 000000000..9e1bb26d0 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-getstring.html @@ -0,0 +1,81 @@ +<!-- + +/* +** 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>WebGL gl.getParameter Strings Conformance Tests</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> +</head> +<body> +<div id="description"></div> +<div id="console"></div> +<canvas id="canvas" width="2" height="2"> </canvas> +<script> +"use strict"; +description("This test checks getParameter returns strings in the correct format"); + +debug(""); +debug("Canvas.getContext"); + +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("canvas"); +if (!gl) { + testFailed("context does not exist"); +} else { + testPassed("context exists"); + + debug(""); + checkPrefix("WebGL 1.0", "VERSION"); + checkPrefix("WebGL GLSL ES 1.0", "SHADING_LANGUAGE_VERSION"); + shouldBeNonNull("gl.getParameter(gl.VENDOR)"); + shouldBeNonNull("gl.getParameter(gl.RENDERER)"); + shouldBe("gl.getError()", "gl.NO_ERROR"); +} + +function checkPrefix(expected, enum_val) { + var s = gl.getParameter(gl[enum_val]); + if (s != null && + s.length >= expected.length && + s.substring(0, expected.length) == expected) { + testPassed("getParameter(gl." + enum_val + ") correctly started with " + expected); + } else { + testFailed("getParameter(gl." + enum_val + ") did not start with " + expected); + } +} + +debug(""); +var successfullyParsed = true; + +</script> +<script src="../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-initial-state.html b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-initial-state.html new file mode 100644 index 000000000..5968299d0 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-initial-state.html @@ -0,0 +1,79 @@ +<!-- + +/* +** Copyright (c) 2016 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>WebGL gl.getParameter initial values Tests</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> +</head> +<body> +<div id="description"></div> +<div id="console"></div> +<canvas id="canvas" width="2" height="2"> </canvas> +<script> +"use strict"; +description("This test checks the initial value of the OpenGL state"); + +debug(""); +debug("Canvas.getContext"); + +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("canvas"); +if (!gl) { + testFailed("context does not exist"); +} else { + testPassed("context exists"); + + debug(""); + checkParameterInitialValue("ONE", "BLEND_SRC_RGB"); + checkParameterInitialValue("ONE", "BLEND_SRC_ALPHA"); + checkParameterInitialValue("ZERO", "BLEND_DST_RGB"); + checkParameterInitialValue("ZERO", "BLEND_DST_ALPHA"); + shouldBe("gl.getError()", "gl.NO_ERROR"); +} + +function checkParameterInitialValue(expected, enum_val) { + var s = gl.getParameter(gl[enum_val]); + if (s === gl[expected]) { + testPassed("getParameter(gl." + enum_val + ") returned " + expected + " which is " + gl[expected]); + } else { + testFailed("getParameter(gl." + enum_val + ") returned " + s + " expected: " + expected + " which is " + gl[expected]); + } +} + +debug(""); +var successfullyParsed = true; + +</script> +<script src="../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-object-get-calls.html b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-object-get-calls.html new file mode 100644 index 000000000..0b3db6642 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-object-get-calls.html @@ -0,0 +1,47 @@ +<!-- + +/* +** 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"> +<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> +</head> +<body> +<div id="description"></div> +<div id="console"></div> + +<script> +var contextVersion = 1; +</script> +<script src="../../js/tests/gl-object-get-calls.js"></script> + +<script src="../../js/js-test-post.js"></script> +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/state/state-uneffected-after-compositing.html b/dom/canvas/test/webgl-conf/checkout/conformance/state/state-uneffected-after-compositing.html new file mode 100644 index 000000000..e477734a9 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/state-uneffected-after-compositing.html @@ -0,0 +1,107 @@ +<!-- + +/* +** 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>WebGL: Check that state is not lost by compositing</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> +</head> +<body> +<canvas id="testbed" width="16" height="16" style="width:50px; height:50px"></canvas> +<div id="description"></div> +<div id="console"></div> +<script> +"use strict"; +description(); +var wtu = WebGLTestUtils; + +function runTest() +{ + var gl = wtu.create3DContext('testbed', { antialias: false }); + if (!gl) { + testFailed('could not create context'); + return; + } + + var program = wtu.setupTexturedQuad(gl); + var tex = gl.createTexture(); + var fb = gl.createFramebuffer(); + + var step1 = function() { + wtu.fillTexture(gl, tex, 1, 1, [0, 255, 0, 255]); + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas(gl, [0, 255, 0, 255], "drawing with texture should be green"); + }; + + var step2 = function() { + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas(gl, [0, 255, 0, 255], "drawing with texture after composite without rebinding should be green"); + + // Clear background to red + gl.clearColor(1, 0, 0, 1); + gl.clear(gl.COLOR_BUFFER_BIT); + + // Bind framebuffer with green texture. + gl.bindFramebuffer(gl.FRAMEBUFFER, fb); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0); + wtu.checkCanvasRect(gl, 0, 0, 1, 1, [0, 255, 0, 255], "reading from fbo with attached texture should be green"); + }; + + var step3 = function() { + // Should still have fb bound and reading should be green + wtu.checkCanvasRect(gl, 0, 0, 1, 1, [0, 255, 0, 255], "reading from fbo after composite without rebinding should be green"); + }; + + var steps = [ + step1, + step2, + step3, + ]; + + var stepIndex = 0; + var runNextStep = function() { + steps[stepIndex++](); + if (stepIndex == steps.length) { + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors"); + finishTest(); + return; + } + wtu.waitForComposite(runNextStep); + }; + runNextStep(); +} + +runTest(); +var successfullyParsed = true; +</script> +</body> +</html> + |