summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-conf/checkout/conformance/state
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/state/00_test_list.txt9
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/state/fb-attach-implicit-target-assignment.html94
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enable-enum-test.html171
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enum-tests.html29
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/state/gl-get-calls.html198
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/state/gl-geterror.html78
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/state/gl-getstring.html60
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/state/gl-initial-state.html58
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/state/gl-object-get-calls.html24
-rw-r--r--dom/canvas/test/webgl-conf/checkout/conformance/state/state-uneffected-after-compositing.html86
10 files changed, 807 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 0000000000..8af8f296a1
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/00_test_list.txt
@@ -0,0 +1,9 @@
+--min-version 1.0.4 fb-attach-implicit-target-assignment.html
+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/fb-attach-implicit-target-assignment.html b/dom/canvas/test/webgl-conf/checkout/conformance/state/fb-attach-implicit-target-assignment.html
new file mode 100644
index 0000000000..1247c1f856
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/fb-attach-implicit-target-assignment.html
@@ -0,0 +1,94 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!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('Test implicit target assignment during FB attachment');
+
+const wtu = WebGLTestUtils;
+const gl = wtu.create3DContext('canvas');
+let fb, rb, tex;
+
+(() => {
+ if (!gl) {
+ testFailed('context does not exist');
+ return;
+ }
+
+ fb = gl.createFramebuffer();
+ gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
+
+ wtu.glErrorShouldBe(gl, 0, 'No errors');
+
+ // -
+
+ debug('');
+ debug('framebufferRenderbuffer');
+
+ rb = gl.createRenderbuffer();
+ shouldBe('gl.isRenderbuffer(rb)', 'false');
+ gl.bindRenderbuffer(gl.RENDERBUFFER, rb);
+ shouldBe('gl.isRenderbuffer(rb)', 'true');
+
+ rb = gl.createRenderbuffer();
+ shouldBe('gl.isRenderbuffer(rb)', 'false');
+ gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rb);
+ wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, 'framebufferRenderbuffer must be preceeded by some bindRenderbuffer');
+ shouldBe('gl.isRenderbuffer(rb)', 'false');
+
+ wtu.glErrorShouldBe(gl, 0, 'No errors');
+
+ // -
+
+ debug('');
+ debug('framebufferTexture2D');
+
+ tex = gl.createTexture();
+ shouldBe('gl.isTexture(tex)', 'false');
+ gl.bindTexture(gl.TEXTURE_2D, tex);
+ shouldBe('gl.isTexture(tex)', 'true');
+
+ tex = gl.createTexture();
+ shouldBe('gl.isTexture(tex)', 'false');
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0);
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1636524 :
+ wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, 'framebufferTexture2D must be preceeded by some bindTexture');
+ shouldBe('gl.isTexture(tex)', 'false');
+
+ gl.bindTexture(gl.TEXTURE_CUBE_MAP, tex);
+ wtu.glErrorShouldBe(gl, 0, 'No errors after bindTexture');
+
+ tex = gl.createTexture();
+ shouldBe('gl.isTexture(tex)', 'false');
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X, tex, 0);
+ wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, 'framebufferTexture2D must be preceeded by some bindTexture');
+ shouldBe('gl.isTexture(tex)', 'false');
+
+ gl.bindTexture(gl.TEXTURE_2D, tex);
+ wtu.glErrorShouldBe(gl, 0, 'No errors after bindTexture');
+})();
+
+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-enable-enum-test.html b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enable-enum-test.html
new file mode 100644
index 0000000000..89efc94209
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enable-enum-test.html
@@ -0,0 +1,171 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!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>
+<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.");
+
+var wtu = WebGLTestUtils;
+
+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'
+];
+var validEnums = [
+ 'BLEND',
+ 'CULL_FACE',
+ 'DEPTH_TEST',
+ 'DITHER',
+ 'POLYGON_OFFSET_FILL',
+ 'SAMPLE_ALPHA_TO_COVERAGE',
+ 'SAMPLE_COVERAGE',
+ 'SCISSOR_TEST',
+ 'STENCIL_TEST'
+];
+
+var gl;
+
+function runNegativeTests() {
+ debug("");
+ debug("Running negative tests");
+
+ gl = wtu.create3DContext();
+ if (!gl) {
+ testFailed("context does not exist");
+ return;
+ }
+ testPassed("context exists");
+
+ 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 );
+ }
+}
+
+function runPositiveTestsWithParameters(params) {
+ debug("");
+ debug("Running positive tests with parameters: " + JSON.stringify(params));
+
+ // Pass null for the canvas, to make sure we create a new context each time.
+ var newgl = wtu.create3DContext(null, params);
+ if (gl == newgl) {
+ testFailed("got an old context");
+ return;
+ }
+ gl = newgl;
+ if (!gl) {
+ testFailed("context does not exist");
+ return;
+ }
+ testPassed("context exists");
+
+ debug("Checking gl.ENABLE enums.");
+
+ 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');
+ shouldBe('gl.getParameter(gl.' + name + ')', 'true');
+ gl.disable(gl[name]);
+ shouldBe('gl.isEnabled(gl.' + name + ')', 'false');
+ shouldBe('gl.getParameter(gl.' + name + ')', 'false');
+ wtu.glErrorShouldBe(gl, gl.NO_ERROR,
+ "gl.isEnabled and gl.GetParameter must not set errors when passed GL_" + name );
+ }
+
+ wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors");
+}
+
+runNegativeTests();
+runPositiveTestsWithParameters({alpha: true, antialias: true, stencil: true, depth: true});
+runPositiveTestsWithParameters({alpha: false, antialias: true, stencil: true, depth: true});
+runPositiveTestsWithParameters({alpha: true, antialias: false, stencil: true, depth: true});
+runPositiveTestsWithParameters({alpha: true, antialias: true, stencil: false, depth: true});
+runPositiveTestsWithParameters({alpha: true, antialias: true, stencil: true, depth: false});
+
+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 0000000000..9c3d244d79
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-enum-tests.html
@@ -0,0 +1,29 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!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 0000000000..a1a27d8e6c
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-get-calls.html
@@ -0,0 +1,198 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!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 0000000000..ad5c18e267
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-geterror.html
@@ -0,0 +1,78 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!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 0000000000..3594cc678e
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-getstring.html
@@ -0,0 +1,60 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!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 0000000000..024eaa109b
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-initial-state.html
@@ -0,0 +1,58 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!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 0000000000..7aa2cedf99
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/gl-object-get-calls.html
@@ -0,0 +1,24 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!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>
+</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 0000000000..f428156c17
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/state/state-uneffected-after-compositing.html
@@ -0,0 +1,86 @@
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!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>
+