Commit ccd6c76d authored by zmo@google.com's avatar zmo@google.com

2010-12-29 Zhenyao Mo <zmo@google.com>

        Reviewed by Kenneth Russell.

        Update validation of stencil mask and ref values
        https://bugs.webkit.org/show_bug.cgi?id=50716

        * fast/canvas/webgl/webgl-specific-expected.txt: Sync with khronos: refactor the test, also update the stencil setting test due to spec change.
        * fast/canvas/webgl/webgl-specific.html: Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74820 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f9cd1f5c
2010-12-29 Zhenyao Mo <zmo@google.com>
Reviewed by Kenneth Russell.
Update validation of stencil mask and ref values
https://bugs.webkit.org/show_bug.cgi?id=50716
* fast/canvas/webgl/webgl-specific-expected.txt: Sync with khronos: refactor the test, also update the stencil setting test due to spec change.
* fast/canvas/webgl/webgl-specific.html: Ditto.
2010-12-30 Abhishek Arya <inferno@chromium.org>
Unreviewed.
......
......@@ -2,33 +2,52 @@ Tests the a few differences between WebGL and GLES2
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS getError was expected value: INVALID_OPERATION : depthRange should generate INVALID_OPERATION if zNear is greater than zFar
PASS getError was expected value: NO_ERROR : stencilMask should generate no error
PASS getError was expected value: INVALID_OPERATION : a different mask value for front and back facing is illegal
PASS getError was expected value: INVALID_OPERATION : a different mask value for front and back facing is illegal
PASS getError was expected value: NO_ERROR : stencilFunc should generate no error
PASS getError was expected value: INVALID_OPERATION : a different reference value for front and back facing is illegal
PASS getError was expected value: INVALID_OPERATION : a different reference value for front and back facing is illegal
PASS getError was expected value: INVALID_OPERATION : a different mask value for front and back facing is illegal
PASS getError was expected value: INVALID_OPERATION : a different mask value for front and back facing is illegal
PASS getError was expected value: NO_ERROR : Setup should succeed
Verify that constant color and constant alpha cannot be used together as source and destination factors in the blend function
PASS gl.blendFunc(gl.CONSTANT_COLOR, gl.CONSTANT_ALPHA) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFunc(gl.ONE_MINUS_CONSTANT_COLOR, gl.CONSTANT_ALPHA) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFunc(gl.CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFunc(gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFunc(gl.CONSTANT_ALPHA, gl.CONSTANT_COLOR) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFunc(gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFunc(gl.ONE_MINUS_CONSTANT_ALPHA, gl.CONSTANT_COLOR) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFunc(gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFuncSeparate(gl.CONSTANT_COLOR, gl.CONSTANT_ALPHA, gl.ONE, gl.ZERO) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_COLOR, gl.CONSTANT_ALPHA, gl.ONE, gl.ZERO) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFuncSeparate(gl.CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE, gl.ZERO) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE, gl.ZERO) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFuncSeparate(gl.CONSTANT_ALPHA, gl.CONSTANT_COLOR, gl.ONE, gl.ZERO) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFuncSeparate(gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE, gl.ZERO) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_ALPHA, gl.CONSTANT_COLOR, gl.ONE, gl.ZERO) generated expected GL error: INVALID_OPERATION.
PASS gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE, gl.ZERO) generated expected GL error: INVALID_OPERATION.
Verify that in depthRange zNear <= zFar
PASS gl.depthRange(20, 10) generated expected GL error: INVALID_OPERATION.
Verify that front/back settings should be the same for stenclMask and stencilFunc
PASS gl.stencilMask(255) generated expected GL error: NO_ERROR.
PASS gl.drawArrays(gl.TRIANGLES, 0, 0) generated expected GL error: NO_ERROR.
PASS gl.stencilMaskSeparate(gl.FRONT, 1) generated expected GL error: NO_ERROR.
PASS gl.drawArrays(gl.TRIANGLES, 0, 0) generated expected GL error: INVALID_OPERATION.
PASS gl.stencilMaskSeparate(gl.BACK, 1) generated expected GL error: NO_ERROR.
PASS gl.drawArrays(gl.TRIANGLES, 0, 0) generated expected GL error: NO_ERROR.
PASS gl.stencilFunc(gl.ALWAYS, 0, 255) generated expected GL error: NO_ERROR.
PASS gl.drawArrays(gl.TRIANGLES, 0, 0) generated expected GL error: NO_ERROR.
PASS gl.stencilFuncSeparate(gl.BACK, gl.ALWAYS, 1, 255) generated expected GL error: NO_ERROR.
PASS gl.drawArrays(gl.TRIANGLES, 0, 0) generated expected GL error: INVALID_OPERATION.
PASS gl.stencilFuncSeparate(gl.FRONT, gl.ALWAYS, 1, 255) generated expected GL error: NO_ERROR.
PASS gl.drawArrays(gl.TRIANGLES, 0, 0) generated expected GL error: NO_ERROR.
PASS gl.stencilFuncSeparate(gl.BACK, gl.ALWAYS, 1, 1) generated expected GL error: NO_ERROR.
PASS gl.drawArrays(gl.TRIANGLES, 0, 0) generated expected GL error: INVALID_OPERATION.
PASS gl.stencilFuncSeparate(gl.FRONT, gl.ALWAYS, 1, 1) generated expected GL error: NO_ERROR.
PASS gl.drawArrays(gl.TRIANGLES, 0, 0) generated expected GL error: NO_ERROR.
Verify that IMPLEMENTATION_COLOR_READ_FORMAT and IMPLEMENTATION_COLOR_READ_TYPE are undefined
PASS undefined is undefined.
PASS undefined is undefined.
Verify that UNPACK_COLORSPACE_CONVERSION_WEBGL is supported
PASS gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL) is gl.BROWSER_DEFAULT_WEBGL
PASS gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL) is gl.NONE
PASS getError was expected value: NO_ERROR : set/get UNPACK_COLORSPACE_CONVERSION_WEBGL should generate no error
......
......@@ -17,95 +17,68 @@ var wtu = WebGLTestUtils;
description("Tests the a few differences between WebGL and GLES2");
var gl = wtu.create3DContext();
var program = wtu.loadStandardProgram(gl);
gl.useProgram(program);
var vertexObject = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
gl.enableVertexAttribArray(0);
glErrorShouldBe(gl, gl.NO_ERROR, "Setup should succeed");
gl.blendFunc(gl.CONSTANT_COLOR, gl.CONSTANT_ALPHA);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFunc(gl.ONE_MINUS_CONSTANT_COLOR, gl.CONSTANT_ALPHA);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFunc(gl.CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFunc(gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFunc(gl.CONSTANT_ALPHA, gl.CONSTANT_COLOR);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFunc(gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFunc(gl.ONE_MINUS_CONSTANT_ALPHA, gl.CONSTANT_COLOR);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFunc(gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
debug("");
debug("Verify that constant color and constant alpha cannot be used together as source and destination factors in the blend function");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.CONSTANT_COLOR, gl.CONSTANT_ALPHA)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.ONE_MINUS_CONSTANT_COLOR, gl.CONSTANT_ALPHA)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.CONSTANT_ALPHA, gl.CONSTANT_COLOR)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.ONE_MINUS_CONSTANT_ALPHA, gl.CONSTANT_COLOR)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFunc(gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR)");
gl.blendFuncSeparate(gl.CONSTANT_COLOR, gl.CONSTANT_ALPHA, gl.ONE, gl.ZERO);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_COLOR, gl.CONSTANT_ALPHA, gl.ONE, gl.ZERO);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFuncSeparate(gl.CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE, gl.ZERO);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE, gl.ZERO);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFuncSeparate(gl.CONSTANT_ALPHA, gl.CONSTANT_COLOR, gl.ONE, gl.ZERO);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFuncSeparate(gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE, gl.ZERO);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_ALPHA, gl.CONSTANT_COLOR, gl.ONE, gl.ZERO);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE, gl.ZERO);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"constant color and constant alpha cannot be used together as source and destination factors in the blend function");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.CONSTANT_COLOR, gl.CONSTANT_ALPHA, gl.ONE, gl.ZERO)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_COLOR, gl.CONSTANT_ALPHA, gl.ONE, gl.ZERO)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE, gl.ZERO)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE, gl.ZERO)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.CONSTANT_ALPHA, gl.CONSTANT_COLOR, gl.ONE, gl.ZERO)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE, gl.ZERO)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_ALPHA, gl.CONSTANT_COLOR, gl.ONE, gl.ZERO)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.blendFuncSeparate(gl.ONE_MINUS_CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_COLOR, gl.ONE, gl.ZERO)");
gl.depthRange(20, 10);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"depthRange should generate INVALID_OPERATION if zNear is greater than zFar");
debug("");
debug("Verify that in depthRange zNear <= zFar");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.depthRange(20, 10)");
gl.stencilMask(255);
glErrorShouldBe(gl, gl.NO_ERROR,
"stencilMask should generate no error");
gl.stencilMaskSeparate(gl.FRONT, 1);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"a different mask value for front and back facing is illegal");
gl.stencilMaskSeparate(gl.BACK, 1);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"a different mask value for front and back facing is illegal");
debug("");
debug("Verify that front/back settings should be the same for stenclMask and stencilFunc");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilMask(255)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilMaskSeparate(gl.FRONT, 1)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawArrays(gl.TRIANGLES, 0, 0)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilMaskSeparate(gl.BACK, 1)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)");
gl.stencilFunc(gl.ALWAYS, 0, 255);
glErrorShouldBe(gl, gl.NO_ERROR,
"stencilFunc should generate no error");
gl.stencilFuncSeparate(gl.FRONT, gl.ALWAYS, 1, 255);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"a different reference value for front and back facing is illegal");
gl.stencilFuncSeparate(gl.BACK, gl.ALWAYS, 1, 255);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"a different reference value for front and back facing is illegal");
gl.stencilFuncSeparate(gl.FRONT, gl.ALWAYS, 0, 1);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"a different mask value for front and back facing is illegal");
gl.stencilFuncSeparate(gl.BACK, gl.ALWAYS, 0, 1);
glErrorShouldBe(gl, gl.INVALID_OPERATION,
"a different mask value for front and back facing is illegal");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFunc(gl.ALWAYS, 0, 255)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFuncSeparate(gl.BACK, gl.ALWAYS, 1, 255)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawArrays(gl.TRIANGLES, 0, 0)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFuncSeparate(gl.FRONT, gl.ALWAYS, 1, 255)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFuncSeparate(gl.BACK, gl.ALWAYS, 1, 1)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.drawArrays(gl.TRIANGLES, 0, 0)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.stencilFuncSeparate(gl.FRONT, gl.ALWAYS, 1, 1)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.drawArrays(gl.TRIANGLES, 0, 0)");
debug("");
debug("Verify that IMPLEMENTATION_COLOR_READ_FORMAT and IMPLEMENTATION_COLOR_READ_TYPE are undefined");
shouldBeUndefined(gl.IMPLEMENTATION_COLOR_READ_FORMAT);
shouldBeUndefined(gl.IMPLEMENTATION_COLOR_READ_TYPE);
debug("");
debug("Verify that UNPACK_COLORSPACE_CONVERSION_WEBGL is supported");
shouldBe("gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL)", "gl.BROWSER_DEFAULT_WEBGL");
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);
shouldBe("gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL)", "gl.NONE");
glErrorShouldBe(gl, gl.NO_ERROR,
"set/get UNPACK_COLORSPACE_CONVERSION_WEBGL should generate no error");
glErrorShouldBe(gl, gl.NO_ERROR, "set/get UNPACK_COLORSPACE_CONVERSION_WEBGL should generate no error");
successfullyParsed = true;
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment