diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 1336c4d0b56..24e6a3b312f 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -53,7 +53,7 @@ FILE_PATTERNS_TO_CHECK = ["*.rs", "*.rc", "*.cpp", "*.c", "*.yml"] # File patterns that are ignored for all tidy and lint checks. -FILE_PATTERNS_TO_IGNORE = ["*.#*", "*.pyc", "fake-ld.sh"] +FILE_PATTERNS_TO_IGNORE = ["*.#*", "*.pyc", "fake-ld.sh", "*.ogv", "*.webm"] SPEC_BASE_PATH = "components/script/dom/" diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/attribs/gl-bindAttribLocation-aliasing.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/attribs/gl-bindAttribLocation-aliasing.html index 86fd74af8f3..62d341c60b9 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/attribs/gl-bindAttribLocation-aliasing.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/attribs/gl-bindAttribLocation-aliasing.html @@ -1,92 +1,92 @@ - - - - - - + + + + + + - - -bindAttribLocation with aliasing - - -
-
- - - - - + + +bindAttribLocation with aliasing + + +
+
+ + + + + \ No newline at end of file diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/buffer-data-array-buffer.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/buffer-data-array-buffer.html index d0fcf406556..6c989addb2b 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/buffer-data-array-buffer.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/buffer-data-array-buffer.html @@ -85,8 +85,7 @@ wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); gl.bufferSubData(gl.ARRAY_BUFFER, 10, array); wtu.glErrorShouldBe(gl, gl.NO_ERROR); -gl.bufferSubData(gl.ARRAY_BUFFER, 10, null); -wtu.glErrorShouldBe(gl, [gl.NO_ERROR, gl.INVALID_VALUE]); +wtu.shouldThrowOrGenerateGLError(gl, [gl.NO_ERROR, gl.INVALID_VALUE], "gl.bufferSubData(gl.ARRAY_BUFFER, 10, null)"); var successfullyParsed = true; diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/index-validation-copies-indices.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/index-validation-copies-indices.html index 55bbb970507..f5589f6e32f 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/index-validation-copies-indices.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/index-validation-copies-indices.html @@ -58,13 +58,15 @@ context.bindBuffer(context.ELEMENT_ARRAY_BUFFER, indexObject); var indices = new Uint16Array([ 10000, 0, 1, 2, 3, 10000 ]); context.bufferData(context.ELEMENT_ARRAY_BUFFER, indices, context.STATIC_DRAW); wtu.shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 2)"); -wtu.shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 0)"); -wtu.shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 4)"); +var indexValidationError = wtu.shouldGenerateGLError(context, + [context.INVALID_OPERATION, context.NO_ERROR], + "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 0)"); +wtu.shouldGenerateGLError(context, indexValidationError, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 4)"); indices[0] = 2; indices[5] = 1; wtu.shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 2)"); -wtu.shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 0)"); -wtu.shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 4)"); +wtu.shouldGenerateGLError(context, indexValidationError, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 0)"); +wtu.shouldGenerateGLError(context, indexValidationError, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 4)"); debug("") var successfullyParsed = true; diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/index-validation-verifies-too-many-indices.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/index-validation-verifies-too-many-indices.html index 1fba7e461a7..95088070521 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/index-validation-verifies-too-many-indices.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/index-validation-verifies-too-many-indices.html @@ -60,9 +60,9 @@ var indexObject = context.createBuffer(); debug("Test out of range indices") context.bindBuffer(context.ELEMENT_ARRAY_BUFFER, indexObject); context.bufferData(context.ELEMENT_ARRAY_BUFFER, new Uint16Array([ 10000, 0, 1, 2, 3, 10000 ]), context.STATIC_DRAW); +var indexValidationError = wtu.shouldGenerateGLError(context, [context.INVALID_OPERATION, context.NO_ERROR], "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 0)"); wtu.shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 2)"); -wtu.shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 0)"); -wtu.shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 4)"); +wtu.shouldGenerateGLError(context, indexValidationError, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 4)"); debug("") var successfullyParsed = true; diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/index-validation.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/index-validation.html index 8ffcbc79bd2..1572381dc9b 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/index-validation.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/buffers/index-validation.html @@ -112,7 +112,7 @@ gl.vertexAttribPointer(normalLoc, 3, gl.FLOAT, false, 7 * sizeInBytes(gl.FLOAT), gl.enableVertexAttribArray(normalLoc); wtu.glErrorShouldBe(gl, gl.NO_ERROR); shouldBeUndefined('gl.drawElements(gl.TRIANGLES, 3, gl.UNSIGNED_SHORT, 0)'); -wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); +wtu.glErrorShouldBe(gl, [gl.INVALID_OPERATION, gl.NO_ERROR]); debug("Test with enabled attribute that does not belong to current program"); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/constants-and-properties.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/constants-and-properties.html index df818c45ed5..e373387866e 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/constants-and-properties.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/constants-and-properties.html @@ -48,7 +48,7 @@ var constants = { DEPTH_BUFFER_BIT : 0x00000100, STENCIL_BUFFER_BIT : 0x00000400, COLOR_BUFFER_BIT : 0x00004000, - + /* BeginMode */ POINTS : 0x0000, LINES : 0x0001, @@ -57,7 +57,7 @@ LINE_STRIP : 0x0003, TRIANGLES : 0x0004, TRIANGLE_STRIP : 0x0005, TRIANGLE_FAN : 0x0006, - + /* AlphaFunction (not supported in ES20) */ /* NEVER */ /* LESS */ @@ -67,7 +67,7 @@ TRIANGLE_FAN : 0x0006, /* NOTEQUAL */ /* GEQUAL */ /* ALWAYS */ - + /* BlendingFactorDest */ ZERO : 0, ONE : 1, @@ -77,7 +77,7 @@ SRC_ALPHA : 0x0302, ONE_MINUS_SRC_ALPHA : 0x0303, DST_ALPHA : 0x0304, ONE_MINUS_DST_ALPHA : 0x0305, - + /* BlendingFactorSrc */ /* ZERO */ /* ONE */ @@ -88,17 +88,17 @@ SRC_ALPHA_SATURATE : 0x0308, /* ONE_MINUS_SRC_ALPHA */ /* DST_ALPHA */ /* ONE_MINUS_DST_ALPHA */ - + /* BlendEquationSeparate */ FUNC_ADD : 0x8006, BLEND_EQUATION : 0x8009, BLEND_EQUATION_RGB : 0x8009, /* same as BLEND_EQUATION */ BLEND_EQUATION_ALPHA : 0x883D, - + /* BlendSubtract */ FUNC_SUBTRACT : 0x800A, FUNC_REVERSE_SUBTRACT : 0x800B, - + /* Separate Blend Functions */ BLEND_DST_RGB : 0x80C8, BLEND_SRC_RGB : 0x80C9, @@ -109,27 +109,27 @@ ONE_MINUS_CONSTANT_COLOR : 0x8002, CONSTANT_ALPHA : 0x8003, ONE_MINUS_CONSTANT_ALPHA : 0x8004, BLEND_COLOR : 0x8005, - + /* Buffer Objects */ ARRAY_BUFFER : 0x8892, ELEMENT_ARRAY_BUFFER : 0x8893, ARRAY_BUFFER_BINDING : 0x8894, ELEMENT_ARRAY_BUFFER_BINDING : 0x8895, - + STREAM_DRAW : 0x88E0, STATIC_DRAW : 0x88E4, DYNAMIC_DRAW : 0x88E8, - + BUFFER_SIZE : 0x8764, BUFFER_USAGE : 0x8765, - + CURRENT_VERTEX_ATTRIB : 0x8626, - + /* CullFaceMode */ FRONT : 0x0404, BACK : 0x0405, FRONT_AND_BACK : 0x0408, - + /* DepthFunction */ /* NEVER */ /* LESS */ @@ -139,7 +139,7 @@ FRONT_AND_BACK : 0x0408, /* NOTEQUAL */ /* GEQUAL */ /* ALWAYS */ - + /* EnableCap */ /* TEXTURE_2D */ CULL_FACE : 0x0B44, @@ -151,18 +151,18 @@ SCISSOR_TEST : 0x0C11, POLYGON_OFFSET_FILL : 0x8037, SAMPLE_ALPHA_TO_COVERAGE : 0x809E, SAMPLE_COVERAGE : 0x80A0, - + /* ErrorCode */ NO_ERROR : 0, INVALID_ENUM : 0x0500, INVALID_VALUE : 0x0501, INVALID_OPERATION : 0x0502, OUT_OF_MEMORY : 0x0505, - + /* FrontFaceDirection */ CW : 0x0900, CCW : 0x0901, - + /* GetPName */ LINE_WIDTH : 0x0B21, ALIASED_POINT_SIZE_RANGE : 0x846D, @@ -212,23 +212,23 @@ SAMPLE_BUFFERS : 0x80A8, SAMPLES : 0x80A9, SAMPLE_COVERAGE_VALUE : 0x80AA, SAMPLE_COVERAGE_INVERT : 0x80AB, - + /* GetTextureParameter */ /* TEXTURE_MAG_FILTER */ /* TEXTURE_MIN_FILTER */ /* TEXTURE_WRAP_S */ /* TEXTURE_WRAP_T */ - + COMPRESSED_TEXTURE_FORMATS : 0x86A3, - + /* HintMode */ DONT_CARE : 0x1100, FASTEST : 0x1101, NICEST : 0x1102, - + /* HintTarget */ GENERATE_MIPMAP_HINT : 0x8192, - + /* DataType */ BYTE : 0x1400, UNSIGNED_BYTE : 0x1401, @@ -237,7 +237,7 @@ UNSIGNED_SHORT : 0x1403, INT : 0x1404, UNSIGNED_INT : 0x1405, FLOAT : 0x1406, - + /* PixelFormat */ DEPTH_COMPONENT : 0x1902, ALPHA : 0x1906, @@ -245,13 +245,13 @@ RGB : 0x1907, RGBA : 0x1908, LUMINANCE : 0x1909, LUMINANCE_ALPHA : 0x190A, - + /* PixelType */ /* UNSIGNED_BYTE */ UNSIGNED_SHORT_4_4_4_4 : 0x8033, UNSIGNED_SHORT_5_5_5_1 : 0x8034, UNSIGNED_SHORT_5_6_5 : 0x8363, - + /* Shaders */ FRAGMENT_SHADER : 0x8B30, VERTEX_SHADER : 0x8B31, @@ -271,7 +271,7 @@ ACTIVE_UNIFORMS : 0x8B86, ACTIVE_ATTRIBUTES : 0x8B89, SHADING_LANGUAGE_VERSION : 0x8B8C, CURRENT_PROGRAM : 0x8B8D, - + /* StencilFunction */ NEVER : 0x0200, LESS : 0x0201, @@ -281,7 +281,7 @@ GREATER : 0x0204, NOTEQUAL : 0x0205, GEQUAL : 0x0206, ALWAYS : 0x0207, - + /* StencilOp */ /* ZERO */ KEEP : 0x1E00, @@ -291,16 +291,16 @@ DECR : 0x1E03, INVERT : 0x150A, INCR_WRAP : 0x8507, DECR_WRAP : 0x8508, - + /* StringName */ VENDOR : 0x1F00, RENDERER : 0x1F01, VERSION : 0x1F02, - + /* TextureMagFilter */ NEAREST : 0x2600, LINEAR : 0x2601, - + /* TextureMinFilter */ /* NEAREST */ /* LINEAR */ @@ -308,17 +308,17 @@ NEAREST_MIPMAP_NEAREST : 0x2700, LINEAR_MIPMAP_NEAREST : 0x2701, NEAREST_MIPMAP_LINEAR : 0x2702, LINEAR_MIPMAP_LINEAR : 0x2703, - + /* TextureParameterName */ TEXTURE_MAG_FILTER : 0x2800, TEXTURE_MIN_FILTER : 0x2801, TEXTURE_WRAP_S : 0x2802, TEXTURE_WRAP_T : 0x2803, - + /* TextureTarget */ TEXTURE_2D : 0x0DE1, TEXTURE : 0x1702, - + TEXTURE_CUBE_MAP : 0x8513, TEXTURE_BINDING_CUBE_MAP : 0x8514, TEXTURE_CUBE_MAP_POSITIVE_X : 0x8515, @@ -328,7 +328,7 @@ TEXTURE_CUBE_MAP_NEGATIVE_Y : 0x8518, TEXTURE_CUBE_MAP_POSITIVE_Z : 0x8519, TEXTURE_CUBE_MAP_NEGATIVE_Z : 0x851A, MAX_CUBE_MAP_TEXTURE_SIZE : 0x851C, - + /* TextureUnit */ TEXTURE0 : 0x84C0, TEXTURE1 : 0x84C1, @@ -363,12 +363,12 @@ TEXTURE29 : 0x84DD, TEXTURE30 : 0x84DE, TEXTURE31 : 0x84DF, ACTIVE_TEXTURE : 0x84E0, - + /* TextureWrapMode */ REPEAT : 0x2901, CLAMP_TO_EDGE : 0x812F, MIRRORED_REPEAT : 0x8370, - + /* Uniform Types */ FLOAT_VEC2 : 0x8B50, FLOAT_VEC3 : 0x8B51, @@ -385,7 +385,7 @@ FLOAT_MAT3 : 0x8B5B, FLOAT_MAT4 : 0x8B5C, SAMPLER_2D : 0x8B5E, SAMPLER_CUBE : 0x8B60, - + /* Vertex Arrays */ VERTEX_ATTRIB_ARRAY_ENABLED : 0x8622, VERTEX_ATTRIB_ARRAY_SIZE : 0x8623, @@ -394,14 +394,14 @@ VERTEX_ATTRIB_ARRAY_TYPE : 0x8625, VERTEX_ATTRIB_ARRAY_NORMALIZED : 0x886A, VERTEX_ATTRIB_ARRAY_POINTER : 0x8645, VERTEX_ATTRIB_ARRAY_BUFFER_BINDING : 0x889F, - + /* Read Format */ IMPLEMENTATION_COLOR_READ_TYPE : 0x8B9A, IMPLEMENTATION_COLOR_READ_FORMAT : 0x8B9B, /* Shader Source */ COMPILE_STATUS : 0x8B81, - + /* Shader Precision-Specified Types */ LOW_FLOAT : 0x8DF0, MEDIUM_FLOAT : 0x8DF1, @@ -409,19 +409,18 @@ HIGH_FLOAT : 0x8DF2, LOW_INT : 0x8DF3, MEDIUM_INT : 0x8DF4, HIGH_INT : 0x8DF5, - + /* Framebuffer Object. */ FRAMEBUFFER : 0x8D40, RENDERBUFFER : 0x8D41, - + RGBA4 : 0x8056, RGB5_A1 : 0x8057, RGB565 : 0x8D62, DEPTH_COMPONENT16 : 0x81A5, -STENCIL_INDEX : 0x1901, STENCIL_INDEX8 : 0x8D48, DEPTH_STENCIL : 0x84F9, - + RENDERBUFFER_WIDTH : 0x8D42, RENDERBUFFER_HEIGHT : 0x8D43, RENDERBUFFER_INTERNAL_FORMAT : 0x8D44, @@ -431,29 +430,29 @@ RENDERBUFFER_BLUE_SIZE : 0x8D52, RENDERBUFFER_ALPHA_SIZE : 0x8D53, RENDERBUFFER_DEPTH_SIZE : 0x8D54, RENDERBUFFER_STENCIL_SIZE : 0x8D55, - + FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE : 0x8CD0, FRAMEBUFFER_ATTACHMENT_OBJECT_NAME : 0x8CD1, FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL : 0x8CD2, FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE : 0x8CD3, - + COLOR_ATTACHMENT0 : 0x8CE0, DEPTH_ATTACHMENT : 0x8D00, STENCIL_ATTACHMENT : 0x8D20, DEPTH_STENCIL_ATTACHMENT : 0x821A, - + NONE : 0, - + FRAMEBUFFER_COMPLETE : 0x8CD5, FRAMEBUFFER_INCOMPLETE_ATTACHMENT : 0x8CD6, FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT : 0x8CD7, FRAMEBUFFER_INCOMPLETE_DIMENSIONS : 0x8CD9, FRAMEBUFFER_UNSUPPORTED : 0x8CDD, - + FRAMEBUFFER_BINDING : 0x8CA6, RENDERBUFFER_BINDING : 0x8CA7, MAX_RENDERBUFFER_SIZE : 0x84E8, - + INVALID_FRAMEBUFFER_OPERATION : 0x0506, /* WebGL-specific enums */ @@ -475,6 +474,7 @@ canvas : "implementation-dependent" // added in versions of the spec that are backward-compatible with // this version var ignoredProperties = [ + 'STENCIL_INDEX', ]; // Constants removed from the WebGL spec compared to ES 2.0 diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/context-attributes-alpha-depth-stencil-antialias.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/context-attributes-alpha-depth-stencil-antialias.html index f86b6f1b3c0..f0f21c4e109 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/context-attributes-alpha-depth-stencil-antialias.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/context-attributes-alpha-depth-stencil-antialias.html @@ -64,8 +64,7 @@ void main() var wtu = WebGLTestUtils; var gl; var contextAttribs = null; -var pixel_1 = [0, 0, 0, 1]; -var pixel_2 = [0, 0, 0, 1]; +var redChannels = [0, 0, 0]; var correctColor = null; var framebuffer; var fbHasColor; @@ -304,10 +303,13 @@ function testStencilAndDepth(stencil, depth) function testAntialias(antialias) { debug("Testing antialias = " + antialias); + // Both the width and height of canvas are N. + // Note that "N = 2" doesn't work for some post processing AA per the discussion at https://github.com/KhronosGroup/WebGL/pull/1977. + var N = 3; if (antialias) - shouldBeNonNull("gl = getWebGL(2, 2, { depth: false, stencil: false, alpha: false, antialias: true }, [ 0, 0, 0, 1 ], 1, 0)"); + shouldBeNonNull("gl = getWebGL(" + N + ", " + N + ", { depth: false, stencil: false, alpha: false, antialias: true }, [ 0, 0, 0, 1 ], 1, 0)"); else - shouldBeNonNull("gl = getWebGL(2, 2, { depth: false, stencil: false, alpha: false, antialias: false }, [ 0, 0, 0, 1 ], 1, 0)"); + shouldBeNonNull("gl = getWebGL(" + N + ", " + N + ", { depth: false, stencil: false, alpha: false, antialias: false }, [ 0, 0, 0, 1 ], 1, 0)"); shouldBeNonNull("contextAttribs = gl.getContextAttributes()"); var vertices = new Float32Array([ @@ -319,17 +321,13 @@ function testAntialias(antialias) 255, 0, 0, 255, 255, 0, 0, 255]); drawAndReadPixel(gl, vertices, colors, 0, 0); - var buf_1 = new Uint8Array(1 * 1 * 4); - var buf_2 = new Uint8Array(1 * 1 * 4); - gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buf_1); - gl.readPixels(0, 1, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buf_2); - pixel_1[0] = buf_1[0]; - pixel_2[0] = buf_2[0]; - // For some anti-alias algorithms, effects may be not on diagonal line pixels, so that either: - // - The red channel of the pixel at (0, 0) is not 0 and not 255, or, - // - If it is 0, expect that the red channel of the pixel at (0, 1) is not 0 and not 255. - shouldBe("pixel_1[0] != 255 && pixel_1[0] != 0 || pixel_1[0] == 0 && pixel_2[0] != 255 && pixel_2[0] != 0", - "contextAttribs.antialias"); + var buf = new Uint8Array(N * N * 4); + gl.readPixels(0, 0, N, N, gl.RGBA, gl.UNSIGNED_BYTE, buf); + redChannels[0] = buf[4 * (N + 1)]; // (1, 1) + redChannels[1] = buf[4 * N * (N - 1)]; // left top + redChannels[2] = buf[4 * (N - 1)]; // right bottom + shouldBeTrue("redChannels[1] == 255 && redChannels[2] == 0"); + shouldBe("redChannels[0] != 255 && redChannels[0] != 0", "contextAttribs.antialias"); } function runTest() diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/context-lost-restored.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/context-lost-restored.html index dc83e16e6de..4781f6baa25 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/context-lost-restored.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/context-lost-restored.html @@ -159,7 +159,7 @@ function testLosingAndRestoringContext() // restore the context after this event has exited. setTimeout(function() { shouldGenerateGLError(gl, gl.NO_ERROR, "WEBGL_lose_context.restoreContext()"); - // The context should still be lost. It will not get restored until the + // The context should still be lost. It will not get restored until the // webglrestorecontext event is fired. shouldBeTrue("gl.isContextLost()"); shouldBe("gl.getError()", "gl.NO_ERROR"); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/context-lost.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/context-lost.html index 62daf2e9bec..ed94a0f89bb 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/context-lost.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/context/context-lost.html @@ -87,6 +87,9 @@ function init() canvas.addEventListener("webglcontextlost", testLostContext, false); + // We need to initialize |uniformLocation| before losing context. + // Otherwise gl.getUniform() when context is lost will throw. + uniformLocation = gl.getUniformLocation(program, "tex"); loseContext(); } diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/angle-instanced-arrays.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/angle-instanced-arrays.html index 908e612a47f..ee58314179f 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/angle-instanced-arrays.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/angle-instanced-arrays.html @@ -125,7 +125,7 @@ function runSupportedTest(extensionEnabled) { function runDivisorTestDisabled() { debug("Testing VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE with extension disabled"); - + var VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE; gl.getVertexAttrib(0, VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE); @@ -385,7 +385,7 @@ function runANGLECorruptionTest() ext.drawArraysInstancedANGLE(gl.TRIANGLES, 0, 6, instanceCount); - // Make sure each color was drawn correctly + // Make sure each color was drawn correctly var i; var passed = true; for (i = 0; i < instanceCount; ++i) { diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/ext-frag-depth.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/ext-frag-depth.html index 7885484152f..4599690dc35 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/ext-frag-depth.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/ext-frag-depth.html @@ -202,7 +202,7 @@ function runOutputTests() { canvas.width = 50; canvas.height = 50; gl.viewport(0, 0, canvas.width, canvas.height); - + // Enable depth testing with a clearDepth of 0.5 // This makes it so that fragments are only rendered when // gl_fragDepthEXT is < 0.5 diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/ext-sRGB.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/ext-sRGB.html index a1da0ffd71e..e61c81035d9 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/ext-sRGB.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/ext-sRGB.html @@ -326,7 +326,7 @@ function runFramebufferTextureConversionTest(format) { wtu.glErrorShouldBe(gl, gl.NO_ERROR); shouldBe('gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, ext.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT)', 'ext.SRGB_EXT'); - + if (validFormat) { shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE"); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/ext-texture-filter-anisotropic.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/ext-texture-filter-anisotropic.html index 81cde8f0ecf..ea6ff9c8679 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/ext-texture-filter-anisotropic.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/ext-texture-filter-anisotropic.html @@ -93,22 +93,22 @@ function runSupportedTest(extensionEnabled) { function runHintTestDisabled() { debug("Testing MAX_TEXTURE_MAX_ANISOTROPY_EXT with extension disabled"); - + var MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; gl.getParameter(MAX_TEXTURE_MAX_ANISOTROPY_EXT); wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "MAX_TEXTURE_MAX_ANISOTROPY_EXT should not be queryable if extension is disabled"); - + debug("Testing TEXTURE_MAX_ANISOTROPY_EXT with extension disabled"); var TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; var texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, texture); - + gl.getTexParameter(gl.TEXTURE_2D, TEXTURE_MAX_ANISOTROPY_EXT); wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "TEXTURE_MAX_ANISOTROPY_EXT should not be queryable if extension is disabled"); gl.texParameterf(gl.TEXTURE_2D, TEXTURE_MAX_ANISOTROPY_EXT, 1); wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "TEXTURE_MAX_ANISOTROPY_EXT should not be settable if extension is disabled"); - + gl.texParameteri(gl.TEXTURE_2D, TEXTURE_MAX_ANISOTROPY_EXT, 1); wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "TEXTURE_MAX_ANISOTROPY_EXT should not be settable if extension is disabled"); @@ -129,7 +129,7 @@ function runHintTestEnabled() { else{ testFailed("Minimum value of MAX_TEXTURE_MAX_ANISOTROPY_EXT is 2.0, returned values was: " + max_anisotropy); } - + // TODO make a texture and verify initial value == 1 and setting to less than 1 is invalid value debug("Testing TEXTURE_MAX_ANISOTROPY_EXT with extension disabled"); @@ -137,7 +137,7 @@ function runHintTestEnabled() { var texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, texture); - + var queried_value = gl.getTexParameter(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT); wtu.glErrorShouldBe(gl, gl.NO_ERROR, "TEXTURE_MAX_ANISOTROPY_EXT query should succeed if extension is enabled"); @@ -150,13 +150,13 @@ function runHintTestEnabled() { gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, 0); wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "texParameterf TEXTURE_MAX_ANISOTROPY_EXT set to < 1 should be an invalid value"); - + gl.texParameteri(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, 0); wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "texParameteri TEXTURE_MAX_ANISOTROPY_EXT set to < 1 should be an invalid value"); - + gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy); wtu.glErrorShouldBe(gl, gl.NO_ERROR, "texParameterf TEXTURE_MAX_ANISOTROPY_EXT set to >= 2 should succeed"); - + gl.texParameteri(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy); wtu.glErrorShouldBe(gl, gl.NO_ERROR, "texParameteri TEXTURE_MAX_ANISOTROPY_EXT set to >= 2 should succeed"); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-element-index-uint.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-element-index-uint.html index b5a0806d271..add8bdd603f 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-element-index-uint.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-element-index-uint.html @@ -81,7 +81,7 @@ for (var ii = 0; ii < 2; ++ii) { testFailed("WebGL context does not exist"); } else { testPassed("WebGL context exists"); - + var drawType = (ii == 0) ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW; debug("Testing " + ((ii == 0) ? "STATIC_DRAW" : "DYNAMIC_DRAW")); @@ -131,17 +131,17 @@ function runSupportedTest(extensionEnabled) { function runDrawTests(drawType) { debug("Test that draws with unsigned integer indices produce the expected results"); - + canvas.width = 50; canvas.height = 50; gl.viewport(0, 0, canvas.width, canvas.height); - + var program = wtu.setupNoTexCoordTextureProgram(gl); function setupDraw(s) { // Create a vertex buffer that cannot be fully indexed via shorts var quadArrayLen = 65537 * 3; var quadArray = new Float32Array(quadArrayLen); - + // Leave all but the last 4 values zero-ed out var idx = quadArrayLen - 12; @@ -290,8 +290,8 @@ function runIndexValidationTests(drawType) { gl.vertexAttribPointer(normalLoc, 3, gl.FLOAT, false, 7 * sizeInBytes(gl.FLOAT), 4 * sizeInBytes(gl.FLOAT)); gl.enableVertexAttribArray(normalLoc); wtu.glErrorShouldBe(gl, gl.NO_ERROR); - shouldBeUndefined('gl.drawElements(gl.TRIANGLES, 3, gl.UNSIGNED_INT, 0)'); - wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + wtu.shouldGenerateGLError(gl, [gl.INVALID_OPERATION, gl.NO_ERROR], + 'gl.drawElements(gl.TRIANGLES, 3, gl.UNSIGNED_INT, 0)'); debug("Test with enabled attribute that does not belong to current program"); @@ -331,13 +331,14 @@ function runCopiesIndicesTests(drawType) { var indices = new Uint32Array([ 10000, 0, 1, 2, 3, 10000 ]); gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, drawType); wtu.shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 4)"); - wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 0)"); - wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 8)"); + var indexValidationError = wtu.shouldGenerateGLError(gl, [gl.INVALID_OPERATION, gl.NO_ERROR], + "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 0)"); + wtu.shouldGenerateGLError(gl, indexValidationError, "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 8)"); indices[0] = 2; indices[5] = 1; wtu.shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 4)"); - wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 0)"); - wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 8)"); + wtu.shouldGenerateGLError(gl, indexValidationError, "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 0)"); + wtu.shouldGenerateGLError(gl, indexValidationError, "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 8)"); } function runResizedBufferTests(drawType) { @@ -423,8 +424,9 @@ function runVerifiesTooManyIndicesTests(drawType) { gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexObject); gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint32Array([ 10000, 0, 1, 2, 3, 10000 ]), drawType); wtu.shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 4)"); - wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 0)"); - wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 8)"); + var indexValidationError = wtu.shouldGenerateGLError(gl, [gl.INVALID_OPERATION, gl.NO_ERROR], + "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 0)"); + wtu.shouldGenerateGLError(gl, indexValidationError, "gl.drawElements(gl.TRIANGLE_STRIP, 4, gl.UNSIGNED_INT, 8)"); } function runCrashWithBufferSubDataTests(drawType) { diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-texture-float.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-texture-float.html index 9a20f3f25e0..4c00492fe25 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-texture-float.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-texture-float.html @@ -183,10 +183,10 @@ function arrayToString(arr, size) { mySize = size; var out = "["; for (var ii = 0; ii < mySize; ++ii) { - if (ii > 0) { - out += ", "; - } - out += arr[ii]; + if (ii > 0) { + out += ", "; + } + out += arr[ii]; } return out + "]"; } @@ -252,25 +252,25 @@ function runRenderTargetAndReadbackTest(testProgram, format, numberOfChannels, s var implType = gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE); wtu.glErrorShouldBe(gl, gl.NO_ERROR, "getParameter of IMPLEMENTATION_COLOR_READ_{FORMAT|TYPE} should succeed"); if ((implFormat == gl.RGBA || implFormat == gl.RGB) && implType == gl.FLOAT) { - debug("Checking readback of floating-point values"); - var arraySize = (implFormat == gl.RGBA) ? 4 : 3 - var buf = new Float32Array(arraySize); - gl.readPixels(0, 0, 1, 1, implFormat, implType , buf); - wtu.glErrorShouldBe(gl, gl.NO_ERROR, "readPixels from floating-point renderbuffer should succeed"); - var ok = true; - var tolerance = 8.0; // TODO: factor this out from both this test and the subtractor shader above. - for (var ii = 0; ii < buf.length; ++ii) { - if (Math.abs(buf[ii] - subtractor[ii]) > tolerance) { - ok = false; - break; - } - } - if (ok) { - testPassed("readPixels of float-type data from floating-point renderbuffer succeeded"); - } else { - testFailed("readPixels of float-type data from floating-point renderbuffer failed: expected " - + arrayToString(subtractor, arraySize) + ", got " + arrayToString(buf)); - } + debug("Checking readback of floating-point values"); + var arraySize = (implFormat == gl.RGBA) ? 4 : 3 + var buf = new Float32Array(arraySize); + gl.readPixels(0, 0, 1, 1, implFormat, implType , buf); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "readPixels from floating-point renderbuffer should succeed"); + var ok = true; + var tolerance = 8.0; // TODO: factor this out from both this test and the subtractor shader above. + for (var ii = 0; ii < buf.length; ++ii) { + if (Math.abs(buf[ii] - subtractor[ii]) > tolerance) { + ok = false; + break; + } + } + if (ok) { + testPassed("readPixels of float-type data from floating-point renderbuffer succeeded"); + } else { + testFailed("readPixels of float-type data from floating-point renderbuffer failed: expected " + + arrayToString(subtractor, arraySize) + ", got " + arrayToString(buf)); + } } } diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-texture-half-float.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-texture-half-float.html index fd47e55a8a2..792da43e263 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-texture-half-float.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-texture-half-float.html @@ -117,13 +117,13 @@ if (!gl) { formats.forEach(function(f) { runTextureCreationTest(true, f.format, null, f.expected); }); - + // Texture creation should fail when passed with non-null, non-Uint16 ArrayBufferView formats.forEach(function(f) { var width = 2; var height = 2; var format = f.format; - + // Float32Array var float32Data = new Float32Array(width * height * getNumberOfChannels(format)); for (var ii = 0; ii < float32Data.length; ii++) { @@ -140,7 +140,7 @@ if (!gl) { }); // Test that Uint16 encoded half float values can be used as texture data. - + // First test that values in the 0-1 range can be written and read. var halfFloatOneThird = 0x3555; // Half float 1/3 var uint16Formats = [ @@ -234,12 +234,12 @@ function runTextureCreationTest(extensionEnabled, opt_format, opt_data, opt_expe var format = opt_format || gl.RGBA; var data = opt_data || null; var expectSuccess = true; - + if (!extensionEnabled || !opt_expected) expectSuccess = false; debug("Testing texture creation with extension " + (extensionEnabled ? "enabled" : "disabled") + ", format " + getFormatName(format) + ", and data " + (data ? "non-null" : "null") + - ". Expect " + (expectSuccess ? "Success" : "Failure")); + ". Expect " + (expectSuccess ? "Success" : "Failure")); var texture = allocateTexture(); var width = 2; diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-vertex-array-object-bufferData.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-vertex-array-object-bufferData.html index 7d2acf9dd36..ee8db23bf36 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-vertex-array-object-bufferData.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/oes-vertex-array-object-bufferData.html @@ -101,7 +101,7 @@ if (!gl) { * namely the Nexus 5, and Nexus 7 (in 2014/01) when using bufferData before binding the VAO. * The tested OS was Android KitKat 4.4.2, the effects were the same in all tested browsers * (Chrome, Chrome Beta, Firefox, Firefox Beta), so it is likely a driver bug. - * These devices have the similar Adreno 320 and Adreno 330 GPUs respectively. + * These devices have the similar Adreno 320 and Adreno 330 GPUs respectively. * * The issuse resulted from this sequence of actions in a requestAnimationFrame loop: * 1. upload some vertex buffers with gl.bufferData (eg. colors) @@ -109,12 +109,12 @@ if (!gl) { * 3. clear the canvas * 4. draw (some triangles) to the canvas * 5. unbind the VAO - * + * * This caused the drawn triangles to be drawn with black (0) for most of the frames, with some * rare frames presenting the correct render results. Interestingly on both devices exactly every - * 64th frame passed (starting with the very first one), the others failed. + * 64th frame passed (starting with the very first one), the others failed. * (Because of this, we test multiple frames.) - * When positions were uploaded, seemingly nothing was drawn, that's likely because the + * When positions were uploaded, seemingly nothing was drawn, that's likely because the * position buffer was also all 0s. * * The issue did not occur: @@ -123,61 +123,61 @@ if (!gl) { */ function runBufferDataTest() { debug("Testing draws with bufferData"); - + canvas.width = 50; canvas.height = 50; gl.viewport(0, 0, canvas.width, canvas.height); - + var testColor = [0, 255, 0, 255]; var clearColor = [255, 0, 0, 255]; - + // Where the issue occures, this is the sequence of success/failure every time: // result: success fail fail fail fail ... success fail fail ... // currentTestCount: 0 1 2 3 4 ... 64 65 66 ... // So with just 1 test it passes, but 2 tests are enough. Here we use 3. - var numberOfTests = 3; + var numberOfTests = 3; var currentTestCount = 0; - + var positionLoc = 0; var colorLoc = 1; var gridRes = 1; - + var program = wtu.setupSimpleVertexColorProgram(gl, positionLoc, colorLoc); - + var vao0 = ext.createVertexArrayOES(); ext.bindVertexArrayOES(vao0); - + var buffers = wtu.setupIndexedQuadWithOptions(gl, { gridRes: gridRes, positionLocation: positionLoc }); - + var colorTypedArray = createColorTypedArray(); - + var colorBuffer = gl.createBuffer(gl.ARRAY_BUFFER); gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer); gl.enableVertexAttribArray(colorLoc); - gl.vertexAttribPointer(colorLoc, 4, gl.FLOAT, false, 0, 0); - + gl.vertexAttribPointer(colorLoc, 4, gl.FLOAT, false, 0, 0); + ext.bindVertexArrayOES(null); - + testDrawing(); - + function testDrawing() { // this order works fine: // ext.bindVertexArrayOES(vao0); // uploadColor(); - + // this order doesn't: uploadColor(); ext.bindVertexArrayOES(vao0); - + wtu.clearAndDrawIndexedQuad(gl, 1, clearColor); - + ext.bindVertexArrayOES(null); //debug(""+currentTestCount+" sharedArrayBufferSize && bufferSizeNeeded <= 4294967295) { + // ArrayBuffers can be at most 4GB (minus 1 byte), but any allocations larger than 1 GB are unreliable in practice. So limit allocations to 1 GB. + // Textures that are wide in just one dimension can still be used to test max TEXTURE_2D size limit even if we don't allocate space for huge square textures. + if (bufferSizeNeeded > sharedArrayBufferSize && bufferSizeNeeded <= Math.pow(2, 30)) { sharedArrayBufferSize = bufferSizeNeeded; } } @@ -195,7 +196,7 @@ function testFormatType(t, test) { for (var j = 0; j < t.targets.length; ++j) { var target = t.targets[j]; debug(""); - debug(wtu.glEnumToString(gl, target)); + debug(wtu.glEnumToString(gl, target) + " " + wtu.glEnumToString(ext, test.format)); // positive test var size = positiveTestSize; @@ -219,11 +220,25 @@ function testFormatType(t, test) { var dataSize = test.func(t.maxSize + test.sizeStep, t.maxSize + test.sizeStep); // this check assumes that each element is 1 byte if (dataSize > sharedArrayBuffer.byteLength) { - testPassed("Unable to test texture larger than maximum size due to ArrayBuffer size limitations -- this is legal"); + if (t.target == gl.TEXTURE_CUBE_MAP) { + testPassed("Unable to test texture larger than maximum size due to ArrayBuffer size limitations -- this is legal"); + } else { + var wideAndShortDataSize = test.func(t.maxSize + test.sizeStep, test.sizeStep); + var pixelsNegativeTest1 = new test.dataType(sharedArrayBuffer, 0, wideAndShortDataSize); + gl.compressedTexImage2D(target, 0, test.format, t.maxSize + test.sizeStep, test.sizeStep, 0, pixelsNegativeTest1); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "width out of bounds: should generate INVALID_VALUE." + + " level is 0, size is " + (t.maxSize + test.sizeStep) + "x" + (test.sizeStep)); + + var narrowAndTallDataSize = test.func(test.sizeStep, t.maxSize + test.sizeStep); + var pixelsNegativeTest1 = new test.dataType(sharedArrayBuffer, 0, narrowAndTallDataSize); + gl.compressedTexImage2D(target, 0, test.format, test.sizeStep, t.maxSize + test.sizeStep, 0, pixelsNegativeTest1); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "height out of bounds: should generate INVALID_VALUE." + + " level is 0, size is " + (test.sizeStep) + "x" + (t.maxSize + test.sizeStep)); + } } else { var pixelsNegativeTest1 = new test.dataType(sharedArrayBuffer, 0, dataSize); gl.compressedTexImage2D(target, 0, test.format, t.maxSize + test.sizeStep, t.maxSize + test.sizeStep, 0, pixelsNegativeTest1); - wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "width or height out of bounds: should generate INVALID_VALUE." + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "width and height out of bounds: should generate INVALID_VALUE." + " level is 0, size is " + (t.maxSize + test.sizeStep) + "x" + (t.maxSize + test.sizeStep)); } // level out of bounds diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/webgl-draw-buffers.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/webgl-draw-buffers.html index 7c963616c45..a4912717b29 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/webgl-draw-buffers.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/webgl-draw-buffers.html @@ -62,6 +62,13 @@ void main() { gl_FragColor = vec4(1,0,0,1); } + diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/webgl-shared-resources.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/webgl-shared-resources.html index a490773dde7..98727cb6733 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/webgl-shared-resources.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/extensions/webgl-shared-resources.html @@ -1,863 +1,863 @@ - - - - - - -WebGL WEBGL_Shared_Resources Conformance Test - + + + + + + +WebGL WEBGL_Shared_Resources Conformance Test + - - - - - - - - - -
-
- - - - + + + + + + + + + +
+
+ + + + diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/bugs/conditional-discard-in-loop.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/bugs/conditional-discard-in-loop.html index d1512370422..8288a653922 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/bugs/conditional-discard-in-loop.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/bugs/conditional-discard-in-loop.html @@ -43,49 +43,49 @@ - - - - - - -
-
- - - + + + + + + +
+
+ + + \ No newline at end of file diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/include.vs b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/include.vs index 7096579f082..50970e6ccfe 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/include.vs +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/include.vs @@ -1,4 +1,4 @@ -// Do not delete! -// Needed to help glsl-conformance tests. - - +// Do not delete! +// Needed to help glsl-conformance tests. + + diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shader-struct-scope.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shader-struct-scope.html index 0167c1cc09e..048c14eed5d 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shader-struct-scope.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shader-struct-scope.html @@ -1,254 +1,254 @@ - - - - - - - - -Struct Scope Test - - + + + + + + + + +Struct Scope Test + + - - - - - - -
-
- - - - - - - - - - - - - - - - - - + + + + + + +
+
+ + + + + + + + + + + + + + + + + + diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shader-with-short-circuiting-operators.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shader-with-short-circuiting-operators.html index 5e08d2a6e2c..64efaad1769 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shader-with-short-circuiting-operators.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shader-with-short-circuiting-operators.html @@ -75,7 +75,7 @@ { int x = 1; $(variables) - + if ($(condition)) { /*do nothing*/ } @@ -92,7 +92,7 @@ { int x = 1; $(variables) - + if ($(condition)) { /*do nothing*/ } diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shaders-with-constant-expression-loop-conditions.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shaders-with-constant-expression-loop-conditions.html index 744a82a15c3..2ceaeb6ddd9 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shaders-with-constant-expression-loop-conditions.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shaders-with-constant-expression-loop-conditions.html @@ -1,146 +1,146 @@ - - - - - - WebGL GLSL Conformance Tests - - + + + + + + WebGL GLSL Conformance Tests + + - - - - - -
-
- - - - - - - - - + + + + + +
+
+ + + + + + + + + diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shaders-with-uniform-structs.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shaders-with-uniform-structs.html index 418e76790b6..5dd4d35a3cd 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shaders-with-uniform-structs.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/shaders-with-uniform-structs.html @@ -42,7 +42,7 @@
- - - - - - - - - - - - -
-
- - - - + + + + + + + + + + + + +
+
+ + + + diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-mixed-array-declarators.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-mixed-array-declarators.html index 6a6f0f494f9..5734c35c519 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-mixed-array-declarators.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-mixed-array-declarators.html @@ -1,92 +1,92 @@ - - - - - - - + + + + + + + - - - - - - -
-
- - - + + + + + + +
+
+ + + \ No newline at end of file diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-nesting-of-variable-names.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-nesting-of-variable-names.html index b2027c3ce1c..88a8a38a062 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-nesting-of-variable-names.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-nesting-of-variable-names.html @@ -1,95 +1,95 @@ - - - - - - - + + + + + + + - - - - - - -
-
- - - + + + + + + +
+
+ + + \ No newline at end of file diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-specifiers-in-uniforms.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-specifiers-in-uniforms.html index d49bee2fc39..d3c750f9d54 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-specifiers-in-uniforms.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-specifiers-in-uniforms.html @@ -1,86 +1,86 @@ - - - - - - - + + + + + + + - - - - - - -
-
- - - + + + + + + +
+
+ + + \ No newline at end of file diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-unary-operators.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-unary-operators.html index 8f7cdbcea22..e33393fd1e9 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-unary-operators.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/struct-unary-operators.html @@ -1,91 +1,91 @@ - - - - - - - + + + + + + + - - - - - - -
-
- - - + + + + + + +
+
+ + + \ No newline at end of file diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/ternary-operators-in-global-initializers.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/ternary-operators-in-global-initializers.html index e0f18c79022..62f40956d15 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/ternary-operators-in-global-initializers.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/ternary-operators-in-global-initializers.html @@ -1,88 +1,88 @@ - - - - - - - + + + + + + + - - - -Ternary Operators in Global Initializers - - -
-
- - - - + + + +Ternary Operators in Global Initializers + + +
+
+ + + + diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/ternary-operators-in-initializers.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/ternary-operators-in-initializers.html index 51bfcb8f0ba..088620c91bc 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/ternary-operators-in-initializers.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/misc/ternary-operators-in-initializers.html @@ -1,145 +1,145 @@ - - - - - - - + + + + + + + - - - - - - -
-
- - - - - - - - - - - - - - + + + + + + +
+
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/samplers/glsl-function-texture2dprojlod.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/samplers/glsl-function-texture2dprojlod.html index 1dfb83171c9..82d8bcd119f 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/samplers/glsl-function-texture2dprojlod.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/samplers/glsl-function-texture2dprojlod.html @@ -107,7 +107,7 @@ function runTest() { var program = wtu.setupProgram( gl, ['vshader2d' + ss, 'fshader2d'], ['vPosition', 'texCoord0'], [0, 1]); wtu.setupUnitQuad(gl, 0, 1); - + var tex = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, tex); gl.texParameteri( @@ -129,7 +129,7 @@ function runTest() { ctx.fillRect(0, 0, size, size); ctx.fillStyle = "rgb(" + color.color[0] + "," + color.color[1] + "," + color.color[2] + ")"; ctx.fillRect(size / 2, 0, size / 2, size / 2); - + gl.texImage2D(gl.TEXTURE_2D, ii, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c); } diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/variables/gl-fragcoord-xy-values.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/variables/gl-fragcoord-xy-values.html index ad1268feea4..857cb9a6cbb 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/variables/gl-fragcoord-xy-values.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/glsl/variables/gl-fragcoord-xy-values.html @@ -44,14 +44,14 @@ @@ -88,33 +88,33 @@ precision mediump float; // Inputs - varying vec2 vTargetPixelCoord; + varying vec2 vTargetPixelCoord; const vec2 pixSize = vec2(2.0/32.0, 2.0/32.0); - + void main() { // Coordinates within a framebuffer pixel [0, 1> vec2 inPixelCoord = fract(vTargetPixelCoord / pixSize); // Create different color dependent on the position inside the framebuffer pixel - float r = (inPixelCoord.x < 0.4) ? 0.2 : (inPixelCoord.x > 0.6) ? 0.8 : 0.5; - float g = (inPixelCoord.y < 0.4) ? 0.2 : (inPixelCoord.y > 0.6) ? 0.8 : 0.5; - + float r = (inPixelCoord.x < 0.4) ? 0.2 : (inPixelCoord.x > 0.6) ? 0.8 : 0.5; + float g = (inPixelCoord.y < 0.4) ? 0.2 : (inPixelCoord.y > 0.6) ? 0.8 : 0.5; + gl_FragColor = vec4(r, g, 0.0, 1.0); } - - - - - - - - - - - - diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/more/functions/readPixelsBadArgs.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/more/functions/readPixelsBadArgs.html index 6dc5c2bfd8e..849ef34739f 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/more/functions/readPixelsBadArgs.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/more/functions/readPixelsBadArgs.html @@ -36,7 +36,7 @@ @@ -83,7 +83,7 @@ assertMsg(gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE, "framebuffer should be FRAMEBUFFER_COMPLETE."); - var program = wtu.setupProgram(gl, ["vs", "fs"], ["vPosition", "vTexCoord"]); + var program = wtu.setupProgram(gl, ["vs", "fs"], ["a_position", "a_texCoord"]); gl.uniform1i(gl.getUniformLocation(program, "u_texture"), 0); gl.disable(gl.BLEND); gl.disable(gl.DEPTH_TEST); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/renderbuffers/framebuffer-object-attachment.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/renderbuffers/framebuffer-object-attachment.html index a44dc9c8e7f..d1f4753e645 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/renderbuffers/framebuffer-object-attachment.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/renderbuffers/framebuffer-object-attachment.html @@ -268,7 +268,7 @@ function testFramebufferRequiredCombinations() { var fbo = gl.createFramebuffer(); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); - + var width = 64; var height = 64; @@ -292,7 +292,7 @@ function testFramebufferRequiredCombinations() { checkFramebufferForAllowedStatuses(ALLOW_COMPLETE); checkBufferBits(gl.DEPTH_ATTACHMENT); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null); - + // 3. COLOR_ATTACHMENT0 = RGBA/UNSIGNED_BYTE texture + DEPTH_STENCIL_ATTACHMENT = DEPTH_STENCIL renderbuffer gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, renderbuffer); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/gl-drawelements.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/gl-drawelements.html index a866f5d2b9a..e8c5200ccfd 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/gl-drawelements.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/gl-drawelements.html @@ -57,69 +57,61 @@ diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/line-loop-tri-fan.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/line-loop-tri-fan.html index 32a86f9b894..e6e25a2675d 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/line-loop-tri-fan.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/line-loop-tri-fan.html @@ -110,7 +110,7 @@ testPassed("Triangle fan was drawn correctly."); } else { testFailed("Triangle fan was drawn incorrectly."); - } + } } function runTest() diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/point-size.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/point-size.html index dd5cbba78f2..55971ecc231 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/point-size.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/point-size.html @@ -107,7 +107,7 @@ gl.uniform1f(locPointSize, 1.0); gl.drawArrays(gl.POINTS, 0, vertices.length / 3); - + shouldBe('gl.getError()', 'gl.NO_ERROR'); for (var y = 0; y < 2; ++y) { @@ -135,7 +135,7 @@ shouldBe('gl.getError()', 'gl.NO_ERROR'); test(program1); - // Under some versions of ANGLE point sprite shader programs were + // Under some versions of ANGLE point sprite shader programs were // incorrectly reloaded from cache. Rebuilding the shader program and // repeating the test simulates the conditions that caused it to fail debug(''); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/polygon-offset.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/polygon-offset.html index 8c15384ec36..d24811c3391 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/polygon-offset.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/rendering/polygon-offset.html @@ -113,7 +113,7 @@ draw(gl, slantedSquare, colLoc, blue); draw(gl, slantedSquare, colLoc, green); check(gl); - + debug('Polygon offset units should have no effect when fill is off'); clear(gl, red, 1.0); draw(gl, slantedSquare, colLoc, blue); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/glsl-constructor-tests-generator.js b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/glsl-constructor-tests-generator.js index 258ebdf8431..558458b04ad 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/glsl-constructor-tests-generator.js +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/glsl-constructor-tests-generator.js @@ -23,35 +23,35 @@ var GLSLConstructorTestsGenerator = (function() { - + var wtu = WebGLTestUtils; -// Shader code templates +// Shader code templates var constructorVertexTemplate = [ "attribute vec4 vPosition;", "precision mediump int;", "precision mediump float;", - // Colors used to signal correctness of component values comparison + // Colors used to signal correctness of component values comparison "const vec4 green = vec4(0.0, 1.0, 0.0, 1.0);", "const vec4 red = vec4(1.0, 0.0, 0.0, 1.0);", - // Error bound used in comparison of floating point values - "$(errorBound)", + // Error bound used in comparison of floating point values + "$(errorBound)", "varying vec4 vColor;", - + "void main() {", " $(argsList)", - + " $(type) v = $(type)($(argsConstr));", - + " if ($(checkCompVals))", " vColor = green;", " else", " vColor = red;", - + " gl_Position = vPosition;", "}" ].join("\n"); @@ -59,9 +59,9 @@ var constructorVertexTemplate = [ var passThroughColorFragmentShader = [ "precision mediump float;", - + "varying vec4 vColor;", - + "void main() {", " gl_FragColor = vColor;", "}" @@ -72,18 +72,18 @@ var constructorFragmentTemplate = [ "precision mediump int;", "precision mediump float;", - // Colors used to signal correctness of component values comparison + // Colors used to signal correctness of component values comparison "const vec4 green = vec4(0.0, 1.0, 0.0, 1.0); ", "const vec4 red = vec4(1.0, 0.0, 0.0, 1.0); ", - + // Error bound used in comparison of floating point values - "$(errorBound)", + "$(errorBound)", "void main() {", " $(argsList)", - + " $(type) v = $(type)($(argsConstr));", - + " if ($(checkCompVals))", " gl_FragColor = green;", " else", @@ -92,17 +92,17 @@ var constructorFragmentTemplate = [ ].join("\n"); -// Coding of the different argument types +// Coding of the different argument types // s : scalar // v2 : vec2 // v3 : vec3 // v4 : vec4 // m2 : mat2 -// m3 : mat3 +// m3 : mat3 // m4 : mat4 // Returns the dimensions of the type -// Count of columns, count of rows +// Count of columns, count of rows function getTypeCodeDimensions(typeCode) { switch (typeCode) { case "s": return [1, 1]; @@ -112,18 +112,18 @@ function getTypeCodeDimensions(typeCode) { case "m2": return [2, 2]; case "m3": return [3, 3]; case "m4": return [4, 4]; - + default: - wtu.error("GLSLConstructorTestsGenerator.getTypeCodeDimensions(), unknown type code"); + wtu.error("GLSLConstructorTestsGenerator.getTypeCodeDimensions(), unknown type code"); debugger; - } + } }; // Returns the component count for the type code function getTypeCodeComponentCount(typeCode) { var dim = getTypeCodeDimensions(typeCode); - + return dim[0] * dim[1]; } @@ -140,7 +140,7 @@ function getGLSLBaseTypeName(typeCode) { case "m4": return "mat4"; default: - wtu.error("GLSLConstructorTestsGenerator.getGLSLBaseTypeName(), unknown type code"); + wtu.error("GLSLConstructorTestsGenerator.getGLSLBaseTypeName(), unknown type code"); debugger; } } @@ -151,13 +151,13 @@ function getGLSLScalarType(targetType) { switch(targetType[0]) { case 'i': return "int"; case 'b': return "bool"; - + case 'v': case 'm': return "float"; - + default: - wtu.error("GLSLConstructorTestsGenerator.getGLSLScalarType(), unknown target type"); + wtu.error("GLSLConstructorTestsGenerator.getGLSLScalarType(), unknown target type"); debugger; } } @@ -166,16 +166,16 @@ function getGLSLScalarType(targetType) { // Returns the scalar prefix for the associated scalar type function getGLSLScalarPrefix(targetType) { switch(targetType[0]) { - case 'i': - case 'b': + case 'i': + case 'b': return targetType[0]; - + case 'v': case 'm': return ''; - + default: - wtu.error("GLSLConstructorTestsGenerator.getGLSLScalarPrefix(), unknown target type"); + wtu.error("GLSLConstructorTestsGenerator.getGLSLScalarPrefix(), unknown target type"); debugger; } } @@ -192,22 +192,22 @@ function getGLSLArgumentType(typeCode, targetType) { else return baseType; } - else + else return getGLSLScalarType(targetType); } -// Returns the glsl type of the argument components +// Returns the glsl type of the argument components function getGLSLArgumentComponentType(argTypeCode, targetType) { var scalarType; if (argTypeCode[0] === "m") { - // Matrices are always floats + // Matrices are always floats scalarType = "float"; } - else + else scalarType = getGLSLScalarType(targetType); - + return scalarType; } @@ -217,49 +217,49 @@ function getGLSLColumnSize(targetType) { if (!isNaN(colSize)) return colSize; - - wtu.error("GLSLConstructorTestsGenerator.getGLSLColumnSize(), invalid target type"); + + wtu.error("GLSLConstructorTestsGenerator.getGLSLColumnSize(), invalid target type"); debugger; } - - -// Returns correct string representation of scalar value + + +// Returns correct string representation of scalar value function getScalarTypeValStr(val, scalarType) { if (val == null) debugger; - + switch (scalarType) { case "float": return val.toFixed(1); case "int": return val; case "bool": return (val === 0) ? "false" : "true"; - + default: - wtu.error("GLSLConstructorTestsGenerator.getScalarTypeValStr(), unknown scalar type"); + wtu.error("GLSLConstructorTestsGenerator.getScalarTypeValStr(), unknown scalar type"); debugger; } } -// Returns true if the glsl type name is a matrix +// Returns true if the glsl type name is a matrix function isGLSLTypeMatrix(type) { return (type.indexOf("mat") !== -1); } -// Returns true if the glsl type name is a vector +// Returns true if the glsl type name is a vector function isGLSLTypeVector(type) { return (type.indexOf("vec") !== -1); } - -// Returns the count of components + +// Returns the count of components function getGLSLTypeComponentCount(type) { var colSize = getGLSLColumnSize(type); - + if (isGLSLTypeMatrix(type)) return colSize * colSize; else - return colSize; + return colSize; } @@ -267,19 +267,19 @@ function getGLSLTypeComponentCount(type) { // Like vec3(1.0, 2.0, 3.0) function getComponentSequenceConstructorExpression(typeCode, firstCompValue, targetType) { var scalarType = getGLSLArgumentComponentType(typeCode, targetType); - + if (typeCode === "s") { // Scalar return getScalarTypeValStr(firstCompValue, scalarType) + ";"; - } + } else { // Structured typeargTypeCode[0] === "m" compCount = getTypeCodeComponentCount(typeCode); var constrExpParts = new Array(compCount); - for (var aa = 0; aa < compCount; ++aa) - constrExpParts[aa] = getScalarTypeValStr(firstCompValue + aa, scalarType); - - return getGLSLArgumentType(typeCode, targetType) + "(" + constrExpParts.join(", ") + ");"; + for (var aa = 0; aa < compCount; ++aa) + constrExpParts[aa] = getScalarTypeValStr(firstCompValue + aa, scalarType); + + return getGLSLArgumentType(typeCode, targetType) + "(" + constrExpParts.join(", ") + ");"; } } @@ -290,67 +290,67 @@ function getComponentSelectorExpStr(targetType, compIx) { var colRowIx = getColRowIndexFromLinearIndex(compIx, getGLSLColumnSize(targetType)); return "v[" + colRowIx.colIx + "][" + colRowIx.rowIx + "]"; } - else + else return "v[" + compIx + "]"; } - - + + // Returns expression which validates the components set by the constructor expression function getComponentValidationExpression(refCompVals, targetType) { // Early out for invalid arguments - if (refCompVals.length === 0) + if (refCompVals.length === 0) return "false"; - + var scalarType = getGLSLScalarType(targetType); var checkComponentValueParts = new Array(refCompVals.length); for (var cc = 0; cc < refCompVals.length; ++cc) { var val_str = getScalarTypeValStr(refCompVals[cc], scalarType); var comp_sel_exp = getComponentSelectorExpStr(targetType, cc); if (scalarType === "float") { - // Comparison of floating point values with error bound + // Comparison of floating point values with error bound checkComponentValueParts[cc] = "abs(" + comp_sel_exp + " - " + val_str + ") <= errorBound"; } else { // Simple comparison to expected value checkComponentValueParts[cc] = comp_sel_exp + " == " + val_str; } - } - + } + return checkComponentValueParts.join(" && "); } -// Returns substitution parts to turn the shader template into testable shader code +// Returns substitution parts to turn the shader template into testable shader code function getTestShaderParts(targetType, argExp, firstCompValue) { - // glsl code of declarations of arguments + // glsl code of declarations of arguments var argsListParts = new Array(argExp.length); // glsl code of constructor expression var argsConstrParts = new Array(argExp.length); - + // glsl type expression var typeExpParts = new Array(argExp.length); for (var aa = 0; aa < argExp.length; ++aa) { var typeCode = argExp[aa]; var argCompCount = getTypeCodeComponentCount(typeCode); - var argName = "a" + aa; + var argName = "a" + aa; var argType = getGLSLArgumentType(typeCode, targetType); var argConstrExp = argType + " " + argName + " = " + getComponentSequenceConstructorExpression(typeCode, firstCompValue, targetType); - + // Add construction of one argument // Indent if not first argument argsListParts[aa] = ((aa > 0) ? " " : "") + argConstrExp; - + // Add argument name to target type argument list argsConstrParts[aa] = argName; - - // Add type name to type expression + + // Add type name to type expression typeExpParts[aa] = argType; // Increment argument component value so all argument component arguments have a unique value firstCompValue += argCompCount; } - + return { argsList: argsListParts.join("\n") + "\n", argsConstr: argsConstrParts.join(", "), @@ -366,7 +366,7 @@ function getArrayWithIdenticalValues(size, val) { var matArray = new Array(size); for (var aa = 0; aa < size; ++aa) matArray[aa] = val; - + return matArray; } @@ -376,16 +376,16 @@ function getArrayWithIncreasingValues(size, start) { var matArray = new Array(size); for (var aa = 0; aa < size; ++aa) matArray[aa] = start + aa; - + return matArray; } // Utility functions to manipulate the array of reference values if the target type is a matrix -// Returns an array which is the column order layout of a square matrix where the diagonal is set to a specified value +// Returns an array which is the column order layout of a square matrix where the diagonal is set to a specified value function matCompArraySetDiagonal(matArray, diagVal) { - // The entries for the diagonal start at array index 0 and increase + // The entries for the diagonal start at array index 0 and increase // by column size + 1 var colSize = Math.round(Math.sqrt(matArray.length)); var dIx = 0; @@ -394,57 +394,57 @@ function matCompArraySetDiagonal(matArray, diagVal) { dIx += (colSize + 1); } while (dIx < colSize * colSize); - + return matArray; } -// Returns an array which contains the values of an identity matrix read out in column order +// Returns an array which contains the values of an identity matrix read out in column order function matCompArrayCreateDiagonalMatrix(colSize, diagVal) { var size = colSize * colSize; var matArray = new Array(size); for (var aa = 0; aa < size; ++aa) matArray[aa] = 0; - - return matCompArraySetDiagonal(matArray, diagVal); + + return matCompArraySetDiagonal(matArray, diagVal); } // Returns the column and row index from the linear index if the components of the matrix are stored in column order in an array -// in a one dimensional array in column order +// in a one dimensional array in column order function getColRowIndexFromLinearIndex(linIx, colSize) { - return { + return { colIx: Math.floor(linIx / colSize), rowIx: linIx % colSize }; -} - - -// Returns the linear index for matrix column and row index for a specified matrix size +} + + +// Returns the linear index for matrix column and row index for a specified matrix size function getLinearIndexFromColRowIndex(rowColIx, colSize) { return rowColIx.colIx * colSize + rowColIx.rowIx; } - - -// Returns a matrix set from another matrix + + +// Returns a matrix set from another matrix function matCompArraySetMatrixFromMatrix(dstColSize, srcMatArray) { // Overwrite components from destination with the source component values at the same col, row coordinates var dstMatArray = matCompArrayCreateDiagonalMatrix(dstColSize, 1); - + var srcColSize = Math.round(Math.sqrt(srcMatArray.length)); - + for (var c_ix = 0; c_ix < srcMatArray.length; ++c_ix) { var srcMatIx = getColRowIndexFromLinearIndex(c_ix, srcColSize); - if (srcMatIx.colIx < dstColSize && srcMatIx.rowIx < dstColSize) { + if (srcMatIx.colIx < dstColSize && srcMatIx.rowIx < dstColSize) { // Source matrix coordinates are valid destination matrix coordinates dstMatArray[getLinearIndexFromColRowIndex(srcMatIx, dstColSize)] = srcMatArray[c_ix]; - } - } - - return dstMatArray; + } + } + + return dstMatArray; } - + // Returns the glsl code to verify if the components are set correctly // and the message to display for the test function getConstructorExpressionInfo(targetType, argExp, firstCompValue) { @@ -452,15 +452,15 @@ function getConstructorExpressionInfo(targetType, argExp, firstCompValue) { var argCompCounts = new Array(argExp.length); for (var aa = 0; aa < argExp.length; ++aa) { argCompCounts[aa] = getTypeCodeComponentCount(argExp[aa]); - argCompCountsSum += argCompCounts[aa]; + argCompCountsSum += argCompCounts[aa]; } - - var targetCompCount = getGLSLTypeComponentCount(targetType); + + var targetCompCount = getGLSLTypeComponentCount(targetType); var refCompVals; var testMsg; - var valid; - + var valid; + if (argCompCountsSum === 0) { // A constructor needs at least one argument refCompVals = []; @@ -468,7 +468,7 @@ function getConstructorExpressionInfo(targetType, argExp, firstCompValue) { valid = false; } else { - if (isGLSLTypeVector(targetType)) { + if (isGLSLTypeVector(targetType)) { if (argCompCountsSum === 1) { // One scalar argument // Vector constructor with one scalar argument set all components to the same value @@ -488,38 +488,38 @@ function getConstructorExpressionInfo(targetType, argExp, firstCompValue) { // argCompCountsSum >= targetCompCount // All components set var lastArgFirstCompIx = argCompCountsSum - argCompCounts[argCompCounts.length - 1]; - + if (lastArgFirstCompIx < targetCompCount) { // First component of last argument is used refCompVals = getArrayWithIncreasingValues(targetCompCount, firstCompValue); testMsg = "valid"; valid = true; } - else { + else { // First component of last argument is not used refCompVals = []; testMsg = "invalid (unused argument)"; valid = false; - } + } } } - } + } else { // Matrix target type if (argCompCountsSum === 1) { // One scalar argument // Matrix constructors with one scalar set all components on the diagonal to the same value - // All other components are set to zero + // All other components are set to zero refCompVals = matCompArrayCreateDiagonalMatrix(Math.round(Math.sqrt(targetCompCount)), firstCompValue); testMsg = "valid (diagonal components set to the same value, off-diagonal components set to zero)"; - valid = true; + valid = true; } else { // Not one scalar argument if (argExp.length === 1 && argExp[0][0] === "m") { // One single matrix argument var dstColSize = getGLSLColumnSize(targetType); - refCompVals = matCompArraySetMatrixFromMatrix(dstColSize, getArrayWithIncreasingValues(getTypeCodeComponentCount(argExp[0]), firstCompValue)); + refCompVals = matCompArraySetMatrixFromMatrix(dstColSize, getArrayWithIncreasingValues(getTypeCodeComponentCount(argExp[0]), firstCompValue)); testMsg = "valid, components at corresponding col, row indices are set from argument, other components are set from identity matrix"; valid = true; } @@ -528,10 +528,10 @@ function getConstructorExpressionInfo(targetType, argExp, firstCompValue) { // Can be treated in the same manner // Arguments can not be of type matrix var matFound = false; - for (var aa = 0; aa < argExp.length; ++aa) + for (var aa = 0; aa < argExp.length; ++aa) if (argExp[aa][0] === "m") matFound = true; - + if (matFound) { refCompVals = []; testMsg = "invalid, argument list greater than one contains matrix type"; @@ -547,32 +547,32 @@ function getConstructorExpressionInfo(targetType, argExp, firstCompValue) { // argCompCountsSum >= targetCompCount // All components set var lastArgFirstCompIx = argCompCountsSum - argCompCounts[argCompCounts.length - 1]; - + if (lastArgFirstCompIx < targetCompCount) { // First component of last argument is used refCompVals = getArrayWithIncreasingValues(targetCompCount, firstCompValue); testMsg = "valid"; valid = true; } - else { + else { // First component of last argument is not used refCompVals = []; testMsg = "invalid (unused argument)"; valid = false; - } + } } } } } } } - - // Check if no case is missed + + // Check if no case is missed if (testMsg == null || valid == null) { - wtu.error("GLSLConstructorTestsGenerator.getConstructorExpressionInfo(), info not set"); + wtu.error("GLSLConstructorTestsGenerator.getConstructorExpressionInfo(), info not set"); debugger; } - + return { refCompVals: refCompVals, testMsg: testMsg, @@ -589,18 +589,18 @@ function getVertexAndFragmentShaderTestCase(targetType, argExp) { // 0 and 1 are values used by matrix constructed from a matrix or a single scalar firstCompValue = 2; } - + var argCode = getTestShaderParts (targetType, argExp, firstCompValue); var expInfo = getConstructorExpressionInfo(targetType, argExp, firstCompValue); - + var substitutions = { - type: targetType, + type: targetType, errorBound: (getGLSLScalarType(targetType) === "float") ? "const float errorBound = 1.0E-5;" : "", argsList: argCode.argsList, - argsConstr: argCode.argsConstr, + argsConstr: argCode.argsConstr, checkCompVals: getComponentValidationExpression(expInfo.refCompVals, targetType) }; - + return [ { // Test constructor argument list in vertex shader vShaderSource: wtu.replaceParams(constructorVertexTemplate, substitutions), @@ -620,7 +620,7 @@ function getVertexAndFragmentShaderTestCase(targetType, argExp) { passMsg: "Fragment shader : " + argCode.typeExp + ", " + expInfo.testMsg, render: expInfo.valid } - ]; + ]; } @@ -661,35 +661,35 @@ function getNextArgumentSequence(inSeq) { nextSeq[aa] = currArg; } } - + if (overflow) { - nextSeq.push(typeCodeIncrementer.first); - } + nextSeq.push(typeCodeIncrementer.first); + } } - - return nextSeq; + + return nextSeq; } - + // Returns true if two argument expressions are equal function areArgExpEqual(expA, expB) { if (expA.length !== expB.length) return false; - - for (var aa = 0; aa < expA.length; ++aa) + + for (var aa = 0; aa < expA.length; ++aa) if (expA[aa] !== expB[aa]) return false; - + return true; } -// Returns true if first argument expression is smaller -// (comes before the second one in iterating order) -// compared to the second argument expression +// Returns true if first argument expression is smaller +// (comes before the second one in iterating order) +// compared to the second argument expression function isArgExpSmallerOrEqual(argExpA, argExpB) { var aLen = argExpA.length; - var bLen = argExpB.length; + var bLen = argExpB.length; if (aLen !== bLen) return (aLen < bLen); @@ -697,7 +697,7 @@ function isArgExpSmallerOrEqual(argExpA, argExpB) { for (var aa = aLen - 1; aa >= 0; --aa) { var argA = argExpA[aa]; var argB = argExpB[aa]; - + if (argA !== argB) { var aOrder = typeCodeIncrementer[argA].order; var bOrder = typeCodeIncrementer[argB].order; @@ -705,17 +705,17 @@ function isArgExpSmallerOrEqual(argExpA, argExpB) { return (aOrder < bOrder); } } - - // Argument type expressions are equal + + // Argument type expressions are equal return true; } -// Returns the next argument expression from sequence set +// Returns the next argument expression from sequence set // Returns null if end is reached function getNextArgumentExpression(testExp, testSet) { var testInterval = testSet[testExp.ix]; - + if (areArgExpEqual(testExp.argExp, testInterval[1])) { // End of current interval reached if (testExp.ix === testSet.length - 1) { @@ -725,7 +725,7 @@ function getNextArgumentExpression(testExp, testSet) { else { // Return first argument expression of next interval var nextIx = testExp.ix + 1; - return { ix: nextIx, argExp: testSet[nextIx][0] }; + return { ix: nextIx, argExp: testSet[nextIx][0] }; } } else { @@ -735,27 +735,27 @@ function getNextArgumentExpression(testExp, testSet) { } -// Returns an array of the parts in the string separated by commas and with the white space trimmed +// Returns an array of the parts in the string separated by commas and with the white space trimmed function convertCsvToArray(str) { // Checks type codes in input function checkInput(el, ix, arr) { var typeCode = el.trim(); if (!(typeCode in typeCodeIncrementer) && typeCode !== "first") { - wtu.error("GLSLConstructorTestsGenerator.convertCsvToArray(), unknown type code" + typeCode); - debugger; + wtu.error("GLSLConstructorTestsGenerator.convertCsvToArray(), unknown type code" + typeCode); + debugger; } - arr[ix] = typeCode; - } - + arr[ix] = typeCode; + } + var spArr = str.split(","); - + // Convert empty string to empty array if (spArr.length === 1 && spArr[0].trim() === "") spArr = []; - + spArr.forEach(checkInput); - + return spArr; } @@ -771,13 +771,13 @@ function processInputs(testSequences) { // Check if interval is valid if (!isArgExpSmallerOrEqual(begin, end)) { - wtu.error("GLSLConstructorTestsGenerator.processInputs(), interval not valid"); - debugger; + wtu.error("GLSLConstructorTestsGenerator.processInputs(), interval not valid"); + debugger; } - - testSet[tt] = [ begin, end ]; + + testSet[tt] = [ begin, end ]; } - + return testSet; } @@ -785,21 +785,21 @@ function processInputs(testSequences) { /** * Returns list of test cases for vector types * All combinations of arguments up to one unused argument of one component are tested - * @param {targetType} Name of target type to test the constructor expressions on + * @param {targetType} Name of target type to test the constructor expressions on * @param {testSet} Set of intervals of argument sequences to test */ function getConstructorTests(targetType, testSequences) { // List of tests to return var testInfos = []; - // List of argument types + // List of argument types var testSet = processInputs(testSequences); var testExp = { ix: 0, argExp: testSet[0][0] }; - + do { - // Add one vertex shader test case and one fragment shader test case + // Add one vertex shader test case and one fragment shader test case testInfos = testInfos.concat(getVertexAndFragmentShaderTestCase(targetType, testExp.argExp)); - + // Generate next argument expression testExp = getNextArgumentExpression(testExp, testSet); } @@ -807,7 +807,7 @@ function getConstructorTests(targetType, testSequences) { return testInfos; } - + // Returns default test argument expression set // For details on input format : see bottom of file @@ -818,14 +818,14 @@ function getDefaultTestSet(targetType) { case "bvec2": return [ // No arguments and all single argument expressions - " - m4", - + " - m4", + // All two argument expressions with a scalar as second argument "s, s - m4, s", - + // All two arguments expressions with a scalar as first argument "s, v2", "s, v3", "s, v4", "s, m2", "s, m3", "s, m4", - + // Three argument expression "s, s, s" ]; @@ -835,20 +835,20 @@ function getDefaultTestSet(targetType) { case "bvec3": return [ // No arguments and all single argument expressions - " - m4", - + " - m4", + // All two argument expressions with a scalar as second argument "s, s - m4, s", - + // All two argument expressions with a scalar as first argument "s, v2", "s, v3", "s, v4", "s, m2", "s, m3", "s, m4", - + // All three argument expressions with two scalars as second and third argument "s, s, s - m4, s, s", - - // All three argument expressions with two scalars as first and second argument + + // All three argument expressions with two scalars as first and second argument "s, s, v2", "s, s, v3", "s, s, v4", "s, s, m2", "s, s, m3", "s, s, m4", - + // Four argument expression "s, s, s, s" ]; @@ -859,26 +859,26 @@ function getDefaultTestSet(targetType) { case "mat2": return [ // No arguments and all single argument expressions - " - m4", - + " - m4", + // All two argument expressions with a scalar as second argument "s, s - m4, s", - + // All two argument expressions with a scalar as first argument "s, v2", "s, v3", "s, v4", "s, m2", "s, m3", "s, m4", - + // All three argument expressions with two scalars as second and third argument "s, s, s - m4, s, s", - - // All three argument expressions with two scalars as first and second argument + + // All three argument expressions with two scalars as first and second argument "s, s, v2", "s, s, v3", "s, s, v4", "s, s, m2", "s, s, m3", "s, s, m4", // All four argument expressions with three scalars as second, third and fourth argument "s, s, s, s - m4, s, s, s", - - // All four argument expressions with three scalars as first, second and third argument + + // All four argument expressions with three scalars as first, second and third argument "s, s, s, v2", "s, s, s, v3", "s, s, s, v4", "s, s, s, m2", "s, s, s, m3", "s, s, s, m4", - + // Five argument expression "s, s, s, s, s" ]; @@ -887,17 +887,17 @@ function getDefaultTestSet(targetType) { case "mat4": return [ // No arguments and all single argument expressions - " - m4", - + " - m4", + // All two argument expressions with a scalar as second argument "s, s - m4, s", - + // All two argument expressions with a scalar as first argument "s, v2", "s, v3", "s, v4", "s, m2", "s, m3", "s, m4", // Several argument sequences "v4, s, v4", "v4, s, v3, v2", "v4, v4, v3, v2", "v4, v4, v4, v4", "v2, v2, v2, v2, v2", "v2, v2, v2, v2, v2, v2, v2, v2", - "v3, v3, v3", "v3, v3, v3, s", "v3, v3, v3, v3, v3, s", "v3, v3, v3, v3, v3, s, s", + "v3, v3, v3", "v3, v3, v3, s", "v3, v3, v3, v3, v3, s", "v3, v3, v3, v3, v3, s, s", ]; } } @@ -915,24 +915,24 @@ return { // Input is an array of intervals of argument types // The generated test argument sequences are from (including) the lower interval boundary // until (including) the upper boundary -// Coding and order of the different argument types : +// Coding and order of the different argument types : // s : scalar // v2 : vec2 // v3 : vec3 // v4 : vec4 // m2 : mat2 -// m3 : mat3 +// m3 : mat3 // m4 : mat4 // One interval is put in one string // Low and high bound are separated by a dash. // If there is no dash it is regarded as an interval of one expression -// The individual argument codes are separated by commas +// The individual argument codes are separated by commas // The individual arguments are incremented from left to right // The left most argument is the one which is incremented first -// Once the left most arguments wraps the second argument is increased +// Once the left most arguments wraps the second argument is increased // Examples : // "s - m4" : All single arguments from scalar up to (including) mat4 -// "m2, s - m4, s" : All two argument expressions with a matrix argument as first argument and a scalar as second argument +// "m2, s - m4, s" : All two argument expressions with a matrix argument as first argument and a scalar as second argument // " - m4, m4" : The empty argument, all one arguments and all two argument expressions // "m2, s, v3, m4" : One 4 argument expression : mat2, scalar, vec3, mat4 diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/glsl-generator.js b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/glsl-generator.js index 940c0cd17b0..dbb97eb020c 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/glsl-generator.js +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/glsl-generator.js @@ -1103,13 +1103,13 @@ return { * float, vec2, vec3, vec4 in that order. * * tolerance: (optional) - * Allow some tolerance in the comparisons. The tolerance is applied to - * both vertex and fragment shaders. The default tolerance is 0, meaning + * Allow some tolerance in the comparisons. The tolerance is applied to + * both vertex and fragment shaders. The default tolerance is 0, meaning * the values have to be identical. * * fragmentTolerance: (optional) - * Specify a tolerance which only applies to fragment shaders. The - * fragment-only tolerance will override the shared tolerance for + * Specify a tolerance which only applies to fragment shaders. The + * fragment-only tolerance will override the shared tolerance for * fragment shaders if both are specified. Fragment shaders usually * use mediump float precision so they sometimes require higher tolerance * than vertex shaders which use highp by default. @@ -1229,15 +1229,15 @@ return { * * extra: (optional) * Extra GLSL code inserted at the top of each test's shader. - * + * * tolerance: (optional) - * Allow some tolerance in the comparisons. The tolerance is applied to - * both vertex and fragment shaders. The default tolerance is 0, meaning + * Allow some tolerance in the comparisons. The tolerance is applied to + * both vertex and fragment shaders. The default tolerance is 0, meaning * the values have to be identical. * * fragmentTolerance: (optional) - * Specify a tolerance which only applies to fragment shaders. The - * fragment-only tolerance will override the shared tolerance for + * Specify a tolerance which only applies to fragment shaders. The + * fragment-only tolerance will override the shared tolerance for * fragment shaders if both are specified. Fragment shaders usually * use mediump float precision so they sometimes require higher tolerance * than vertex shaders which use highp. diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/out-of-bounds-test.js b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/out-of-bounds-test.js index 1da05eb8d85..9059cdf5c10 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/out-of-bounds-test.js +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/out-of-bounds-test.js @@ -165,7 +165,7 @@ var runDrawElementsTest = function(callTemplate, gl, wtu, ext) { wtu.shouldGenerateGLError(gl, gl.NO_ERROR, 'gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, (new Uint8Array([ 3, 0, 1, 2 ])).subarray(1), gl.STATIC_DRAW)'); wtu.shouldGenerateGLError(gl, gl.NO_ERROR, wtu.replaceParams(callTemplate, {count: 3, type: 'gl.UNSIGNED_BYTE', offset: 0})); wtu.shouldGenerateGLError(gl, gl.NO_ERROR, 'gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 0, new Uint8Array([ 3, 0, 1]))'); - wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, wtu.replaceParams(callTemplate, {count: 3, type: 'gl.UNSIGNED_BYTE', offset: 0})); + var indexValidationError = wtu.shouldGenerateGLError(gl, [gl.INVALID_OPERATION, gl.NO_ERROR], wtu.replaceParams(callTemplate, {count: 3, type: 'gl.UNSIGNED_BYTE', offset: 0})); wtu.shouldGenerateGLError(gl, gl.NO_ERROR, 'gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, 0, (new Uint8Array([ 3, 0, 1, 2 ])).subarray(1))'); wtu.shouldGenerateGLError(gl, gl.NO_ERROR, wtu.replaceParams(callTemplate, {count: 3, type: 'gl.UNSIGNED_BYTE', offset: 0})); wtu.shouldGenerateGLError(gl, gl.NO_ERROR, wtu.replaceParams(callTemplate, {count: 0, type: 'gl.UNSIGNED_BYTE', offset: 0})); @@ -204,10 +204,10 @@ var runDrawElementsTest = function(callTemplate, gl, wtu, ext) { // invalid operation with indices that would be valid with correct bindings wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, wtu.replaceParams(callTemplate, {count: 9, type: 'gl.UNSIGNED_SHORT', offset: 1000})); - wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, wtu.replaceParams(callTemplate, {count: 12, type: 'gl.UNSIGNED_SHORT', offset: 0})); - wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, wtu.replaceParams(callTemplate, {count: 15, type: 'gl.UNSIGNED_SHORT', offset: 0})); - wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, wtu.replaceParams(callTemplate, {count: 18, type: 'gl.UNSIGNED_SHORT', offset: 0})); - wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, wtu.replaceParams(callTemplate, {count: 3, type: 'gl.UNSIGNED_SHORT', offset: 2*15})); + wtu.shouldGenerateGLError(gl, indexValidationError, wtu.replaceParams(callTemplate, {count: 12, type: 'gl.UNSIGNED_SHORT', offset: 0})); + wtu.shouldGenerateGLError(gl, indexValidationError, wtu.replaceParams(callTemplate, {count: 15, type: 'gl.UNSIGNED_SHORT', offset: 0})); + wtu.shouldGenerateGLError(gl, indexValidationError, wtu.replaceParams(callTemplate, {count: 18, type: 'gl.UNSIGNED_SHORT', offset: 0})); + wtu.shouldGenerateGLError(gl, indexValidationError, wtu.replaceParams(callTemplate, {count: 3, type: 'gl.UNSIGNED_SHORT', offset: 2*15})); // 0xffffffff needs to convert to a 'long' IDL argument as -1, as per // WebIDL 4.1.7. JS ToInt32(0xffffffff) == -1. Thus INVALID_VALUE. diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/structUniformShader.vert b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/structUniformShader.vert index 59c719a0014..77e5a675dc9 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/structUniformShader.vert +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/structUniformShader.vert @@ -45,7 +45,7 @@ uniform float u_array[4]; varying vec3 v_normal; void main() -{ +{ v_normal = a_normal; gl_Position = u_modelViewProjMatrix * a_vertex + vec4(u_struct.x, u_struct.y, 0, 1) + diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/webgl-test-utils.js b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/webgl-test-utils.js index 4f2bae34e3c..c98cde21804 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/webgl-test-utils.js +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/resources/webgl-test-utils.js @@ -1274,7 +1274,7 @@ var create3DContext = function(opt_canvas, opt_attributes, opt_version) { var names; switch (opt_version) { case 2: - names = ["webgl2", "experimental-webgl2"]; break; + names = ["webgl2"]; break; default: names = ["webgl", "experimental-webgl"]; break; } @@ -1352,8 +1352,34 @@ var shouldGenerateGLError = function(gl, glErrors, evalStr) { } if (exception) { testFailed(evalStr + " threw exception " + exception); + return -1; } else { - glErrorShouldBe(gl, glErrors, "after evaluating: " + evalStr); + return glErrorShouldBe(gl, glErrors, "after evaluating: " + evalStr); + } +}; + +/** + * Tests that an evaluated expression either throws an exception or generates a specific GL error. + * @param {!WebGLRenderingContext} gl The WebGLRenderingContext to use. + * @param {number|Array.} glErrors The expected gl error or an array of expected errors. + * @param {string} evalStr The string to evaluate. + * @param {string} opt_msg The optional message to display. + */ +var shouldThrowOrGenerateGLError = function(gl, glErrors, evalStr, opt_msg) { + var exception; + try { + eval(evalStr); + } catch (e) { + exception = e; + } + if (exception) { + testPassed(evalStr + " threw exception " + exception); + return 0; + } else { + if (!opt_msg) { + opt_msg = "after evaluating: " + evalStr; + } + return glErrorShouldBe(gl, glErrors, opt_msg); } }; @@ -1382,13 +1408,14 @@ var glErrorShouldBe = function(gl, glErrors, opt_msg) { var msg = "getError was " + ((glErrors.length > 1) ? "one of: " : "expected value: "); testPassed(msg + expected + " : " + opt_msg); } + return err; }; /** * Links a WebGL program, throws if there are errors. * @param {!WebGLRenderingContext} gl The WebGLRenderingContext to use. * @param {!WebGLProgram} program The WebGLProgram to link. - * @param {function(string): void) opt_errorCallback callback for errors. + * @param {function(string): void) opt_errorCallback callback for errors. */ var linkProgram = function(gl, program, opt_errorCallback) { var errFn = opt_errorCallback || testFailed; @@ -1601,8 +1628,8 @@ var readFileList = function(url) { * Loads a shader. * @param {!WebGLRenderingContext} gl The WebGLRenderingContext to use. * @param {string} shaderSource The shader source. - * @param {number} shaderType The type of shader. - * @param {function(string): void) opt_errorCallback callback for errors. + * @param {number} shaderType The type of shader. + * @param {function(string): void) opt_errorCallback callback for errors. * @param {boolean} opt_logShaders Whether to log shader source. * @param {string} opt_shaderLabel Label that identifies the shader source in * the log. @@ -1660,7 +1687,7 @@ var loadShader = function( * @param {!WebGLRenderingContext} gl The WebGLRenderingContext to use. * @param {file} file The URL of the shader source. * @param {number} type The type of shader. - * @param {function(string): void) opt_errorCallback callback for errors. + * @param {function(string): void) opt_errorCallback callback for errors. * @param {boolean} opt_logShaders Whether to log shader source. * @return {!WebGLShader} The created shader. */ @@ -1690,7 +1717,7 @@ var getScript = function(scriptId) { * @param {string} scriptId The id of the script tag. * @param {number} opt_shaderType The type of shader. If not passed in it will * be derived from the type of the script tag. - * @param {function(string): void) opt_errorCallback callback for errors. + * @param {function(string): void) opt_errorCallback callback for errors. * @param {boolean} opt_logShaders Whether to log shader source. * @return {!WebGLShader} The created shader. */ @@ -1733,7 +1760,7 @@ var loadStandardProgram = function(gl) { * @param {!WebGLRenderingContext} gl The WebGLRenderingContext to use. * @param {string} vertexShaderPath The URL of the vertex shader. * @param {string} fragmentShaderPath The URL of the fragment shader. - * @param {function(string): void) opt_errorCallback callback for errors. + * @param {function(string): void) opt_errorCallback callback for errors. * @return {!WebGLProgram} The created program. */ var loadProgramFromFile = function( @@ -1765,7 +1792,7 @@ var loadProgramFromFile = function( * vertex shader. * @param {string} fragmentScriptId The id of the script tag that contains the * fragment shader. - * @param {function(string): void) opt_errorCallback callback for errors. + * @param {function(string): void) opt_errorCallback callback for errors. * @return {!WebGLProgram} The created program. */ var loadProgramFromScript = function loadProgramFromScript( @@ -1806,7 +1833,7 @@ var createProgram = function(gl, vertexShader, fragmentShader, opt_errorCallback * @param {!WebGLRenderingContext} gl The WebGLRenderingContext to use. * @param {string} vertexShader The vertex shader source. * @param {string} fragmentShader The fragment shader source. - * @param {function(string): void) opt_errorCallback callback for errors. + * @param {function(string): void) opt_errorCallback callback for errors. * @param {boolean} opt_logShaders Whether to log shader source. * @return {!WebGLProgram} The created program. */ @@ -2358,7 +2385,7 @@ var _requestAnimFrame; */ var requestAnimFrame = function(callback) { if (!_requestAnimFrame) { - _requestAnimFrame = getPrefixedProperty(window, "requestAnimationFrame") || + _requestAnimFrame = getPrefixedProperty(window, "requestAnimationFrame") || function(callback, element) { return window.setTimeout(callback, 1000 / 70); }; @@ -2731,6 +2758,7 @@ return { startPlayingAndWaitForVideo: startPlayingAndWaitForVideo, startsWith: startsWith, shouldGenerateGLError: shouldGenerateGLError, + shouldThrowOrGenerateGLError: shouldThrowOrGenerateGLError, readFile: readFile, readFileList: readFileList, replaceParams: replaceParams, diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/state/gl-enable-enum-test.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/state/gl-enable-enum-test.html index ad42f7bd639..e01d445c4b4 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/state/gl-enable-enum-test.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/state/gl-enable-enum-test.html @@ -145,9 +145,9 @@ if (!gl) { 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'); + 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"); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/state/gl-get-calls.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/state/gl-get-calls.html index 2cb967df036..186bba44d95 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/state/gl-get-calls.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/state/gl-get-calls.html @@ -119,13 +119,13 @@ else { // 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'); @@ -137,7 +137,7 @@ else { 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; diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/state/gl-object-get-calls.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/state/gl-object-get-calls.html index 4fedc675b72..f0d9a479e17 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/state/gl-object-get-calls.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/state/gl-object-get-calls.html @@ -74,8 +74,7 @@ var shaders = gl.getAttachedShaders(standardProgram); shouldBe('shaders.length', '2'); shouldBeTrue('shaders[0] == standardVert && shaders[1] == standardFrag || shaders[1] == standardVert && shaders[0] == standardFrag'); wtu.glErrorShouldBe(gl, gl.NO_ERROR); -shouldBeNull('gl.getAttachedShaders(null)'); -wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); +wtu.shouldThrowOrGenerateGLError(gl, gl.INVALID_VALUE, 'gl.getAttachedShaders(null)'); shouldThrow('gl.getAttachedShaders(standardVert)'); wtu.glErrorShouldBe(gl, gl.NO_ERROR); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/gl-get-tex-parameter.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/gl-get-tex-parameter.html index e9db9e6c230..dce30a011cf 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/gl-get-tex-parameter.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/gl-get-tex-parameter.html @@ -76,7 +76,7 @@ function applyStates(fn) { for (var ss = 0; ss < states.length; ++ss) { var stateInfo = states[ss]; for (var ii = 0; ii < targets.length; ++ii) { - var target = targets[ii]; + var target = targets[ii]; gl.activeTexture(gl.TEXTURE0 + ii); fn(target, stateInfo); } diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/mipmap-fbo.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/mipmap-fbo.html index b44f5eee339..2ad3c17b559 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/mipmap-fbo.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/mipmap-fbo.html @@ -56,25 +56,25 @@ function init(){ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2, 2, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); gl.bindTexture(gl.TEXTURE_2D, null); - + // setup framebuffer // var fbo = gl.createFramebuffer(); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); gl.bindFramebuffer(gl.FRAMEBUFFER, null); - + // fill the framebuffer // gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); gl.clearColor(1, 0, 1, 1); gl.clear(gl.COLOR_BUFFER_BIT); gl.bindFramebuffer(gl.FRAMEBUFFER, null); - + // generate mipmap // gl.bindTexture(gl.TEXTURE_2D, texture); gl.generateMipmap(gl.TEXTURE_2D); gl.drawArrays(gl.TRIANGLES, 0, 6); - + // readback // wtu.checkCanvas(gl, [255, 0, 255, 255]); } diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/origin-clean-conformance.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/origin-clean-conformance.html index 1e33a24d2d5..d0221e7a919 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/origin-clean-conformance.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/origin-clean-conformance.html @@ -50,7 +50,7 @@ function causedException(func) { return hadException; } -var defaultImgUrl = "http://www.opengl.org/img/opengl_logo.jpg"; +var defaultImgUrl = "https://get.webgl.org/conformance-resources/opengl_logo.jpg"; var localImgUrl = "../resources/opengl_logo.jpg"; var imgDomain; diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/tex-sub-image-2d-bad-args.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/tex-sub-image-2d-bad-args.html index df8865d8c94..4ae7170cdf8 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/tex-sub-image-2d-bad-args.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/tex-sub-image-2d-bad-args.html @@ -50,7 +50,7 @@ var gl = wtu.create3DContext("testbed"); var tex = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, tex); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c); -wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Setup should succeed"); +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Setup should succeed"); gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 1, gl.RGBA, gl.UNSIGNED_BYTE, c); wtu.glErrorShouldBe(gl, gl.INVALID_VALUE, "y + height > texture height"); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/texture-draw-with-2d-and-cube.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/texture-draw-with-2d-and-cube.html index 0002dce9946..60d881d9661 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/texture-draw-with-2d-and-cube.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/texture-draw-with-2d-and-cube.html @@ -1,127 +1,127 @@ - - - - - - -WebGL ActiveTexture BindTexture conformance test. - + + + + + + +WebGL ActiveTexture BindTexture conformance test. + - - - - - - -
-
- - - - - - - - - + + + + + + +
+
+ + + + + + + + + diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/texture-fakeblack.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/texture-fakeblack.html index 883886a9428..c6cfc585114 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/texture-fakeblack.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/textures/texture-fakeblack.html @@ -42,10 +42,10 @@
diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/uniforms/gl-uniform-arrays.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/uniforms/gl-uniform-arrays.html index 4285d9d4e4f..47aa3a5a93a 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/uniforms/gl-uniform-arrays.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/uniforms/gl-uniform-arrays.html @@ -432,14 +432,14 @@ function testUniformOptimizationIssues(testIndex) { // Ensure that requesting an array uniform past MaxInt32PlusOne returns no uniform var nameMaxInt32PlusOne = test.arrayName + "[" + (test.usedUniformVector + MaxInt32PlusOne) + "]"; - assertMsg(gl.getUniformLocation(program, nameMaxInt32PlusOne) === null, + assertMsg(gl.getUniformLocation(program, nameMaxInt32PlusOne) === null, "Requesting " + nameMaxInt32PlusOne + " uniform should return a null uniform location"); // Set just the used uniform var name = test.arrayName + "[" + test.usedUniformVector + "]"; var uniformLocation = gl.getUniformLocation(program, name); gl.uniform4fv(uniformLocation, test.color); - wtu.setupIndexedQuad(gl, 1, positionLoc); + wtu.setupIndexedQuad(gl, 1); wtu.clearAndDrawIndexedQuad(gl, 1); wtu.checkCanvas(gl, [0, 255, 0, 255], "should be green"); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/uniforms/out-of-bounds-uniform-array-access.html b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/uniforms/out-of-bounds-uniform-array-access.html index 530c45d894c..2758b320ff1 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/uniforms/out-of-bounds-uniform-array-access.html +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/conformance/uniforms/out-of-bounds-uniform-array-access.html @@ -122,8 +122,8 @@ function isKnownColor(r, g, b) { return true; for (var ii = 0; ii < knownColors.length; ii += 4) { if (withinEpsilon(r / 255.0, knownColors[ii + 0]) && - withinEpsilon(g / 255.0, knownColors[ii + 1]) && - withinEpsilon(b / 255.0, knownColors[ii + 2])) + withinEpsilon(g / 255.0, knownColors[ii + 1]) && + withinEpsilon(b / 255.0, knownColors[ii + 2])) return true; } return false; @@ -141,22 +141,22 @@ function runOneIteration() { gl.uniform1f(lineWidthLoc, lineWidth); gl.uniform1i(elemMultLoc, elemMult); gl.drawArrays(gl.POINTS, 0, gridRes * gridRes); - + // Read back gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels); // Verify for (var y = 0; y < height; ++y) { for (var x = 0; x < width; ++x) { - if (!isKnownColor(pixels[4 * (width * y + x) + 0], - pixels[4 * (width * y + x) + 1], - pixels[4 * (width * y + x) + 2])) { + if (!isKnownColor(pixels[4 * (width * y + x) + 0], + pixels[4 * (width * y + x) + 1], + pixels[4 * (width * y + x) + 2])) { ok = false; if (firstFailingPixel == null) { - firstFailingPixel = [x, y]; - firstFailingValue = [pixels[4 * (width * y + x) + 0], - pixels[4 * (width * y + x) + 1], - pixels[4 * (width * y + x) + 2]]; + firstFailingPixel = [x, y]; + firstFailingValue = [pixels[4 * (width * y + x) + 0], + pixels[4 * (width * y + x) + 1], + pixels[4 * (width * y + x) + 2]]; } } } @@ -166,14 +166,14 @@ function runOneIteration() { lineWidth -= 2540; if (ok) { testPassed("Good rendering results for lineWidths " + - startingLineWidth + "..." + endingLineWidth + - " at elemMult=" + elemMult); + startingLineWidth + "..." + endingLineWidth + + " at elemMult=" + elemMult); } else { testFailed("for lineWidth=" + lineWidth + ", elemMult=" + elemMult + ": first failing pixel (" + firstFailingPixel[0] + ", " + firstFailingPixel[1] + ") was (" + - firstFailingValue[0] + ", " + - firstFailingValue[1] + ", " + - firstFailingValue[2] + "), should be (0, 0, 0) or one of known colors"); + firstFailingValue[0] + ", " + + firstFailingValue[1] + ", " + + firstFailingValue[2] + "), should be (0, 0, 0) or one of known colors"); } elemMult += 73; setTimeout(runOneIteration, 0); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/resources/cookies.js b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/resources/cookies.js index d12170ef091..7ec7a4b4d32 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/resources/cookies.js +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/resources/cookies.js @@ -42,8 +42,8 @@ var docCookies = { document.cookie = encodeURIComponent(sKey) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : ""); return true; }, - - + + removeItem: function (sKey, sPath, sDomain) { if (!sKey || !this.hasItem(sKey)) { return false; } document.cookie = encodeURIComponent(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + ( sDomain ? "; domain=" + sDomain : "") + ( sPath ? "; path=" + sPath : ""); diff --git a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/resources/js-test-pre.js b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/resources/js-test-pre.js index 9236711b669..c4bb6531acd 100644 --- a/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/resources/js-test-pre.js +++ b/tests/wpt/mozilla/tests/webgl/conformance-1.0.3/resources/js-test-pre.js @@ -136,7 +136,7 @@ function debug(msg) { _addSpan(msg); if (_jsTestPreVerboseLogging) { - _logToConsole(msg); + _logToConsole(msg); } } @@ -150,7 +150,7 @@ function testPassed(msg) reportTestResultsToHarness(true, msg); _addSpan('PASS ' + escapeHTML(msg) + ''); if (_jsTestPreVerboseLogging) { - _logToConsole('PASS ' + msg); + _logToConsole('PASS ' + msg); } }