[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
zmo at google.com
zmo at google.com
Wed Dec 22 15:24:43 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 977e90087c57f3a0df4d56f7a828a945b20115a0
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 2 23:25:00 2010 +0000
2010-11-01 Zhenyao Mo <zmo at google.com>
Reviewed by Kenneth Russell.
blendFunc should generate INVALID_OPERATION if constant color and constant alpha are together as source and destination factors
https://bugs.webkit.org/show_bug.cgi?id=48674
Test: fast/canvas/webgl/webgl-specific.html
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::blendFunc):
(WebCore::WebGLRenderingContext::blendFuncSeparate):
* html/canvas/WebGLRenderingContext.h:
(WebCore::WebGLRenderingContext::validateBlendFuncFactors): Helper function to do the checking.
2010-11-01 Zhenyao Mo <zmo at google.com>
Reviewed by Kenneth Russell.
blendFunc should generate INVALID_OPERATION if constant color and constant alpha are together as source and destination factors
https://bugs.webkit.org/show_bug.cgi?id=48674
* fast/canvas/webgl/webgl-specific-expected.txt: Added.
* fast/canvas/webgl/webgl-specific.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index f07d326..0027b7e 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-01 Zhenyao Mo <zmo at google.com>
+
+ Reviewed by Kenneth Russell.
+
+ blendFunc should generate INVALID_OPERATION if constant color and constant alpha are together as source and destination factors
+ https://bugs.webkit.org/show_bug.cgi?id=48674
+
+ * fast/canvas/webgl/webgl-specific-expected.txt: Added.
+ * fast/canvas/webgl/webgl-specific.html: Added.
+
2010-11-02 Dmitry Titov <dimich at chromium.org>
[Chromium] Unreviewed update of test expectations.
diff --git a/LayoutTests/fast/canvas/webgl/webgl-specific-expected.txt b/LayoutTests/fast/canvas/webgl/webgl-specific-expected.txt
new file mode 100644
index 0000000..c9616bd
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/webgl-specific-expected.txt
@@ -0,0 +1,24 @@
+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 successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/webgl/webgl-specific.html b/LayoutTests/fast/canvas/webgl/webgl-specific.html
new file mode 100644
index 0000000..2e1e9b1
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/webgl-specific.html
@@ -0,0 +1,108 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title>WebGL GLES2 difference test.</title>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css"/>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/webgl-test.js"></script>
+<script src="resources/webgl-test-utils.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+var wtu = WebGLTestUtils;
+description("Tests the a few differences between WebGL and GLES2");
+
+var gl = wtu.create3DContext();
+
+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");
+
+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");
+
+/*
+gl.depthRange(20, 10);
+glErrorShouldBe(gl, gl.INVALID_OPERATION,
+ "depthRange should generate INVALID_OPERATION if zNear is greater than zFar");
+
+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");
+
+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");
+*/
+
+successfullyParsed = true;
+</script>
+
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index fc176f9..7e09ce6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-11-01 Zhenyao Mo <zmo at google.com>
+
+ Reviewed by Kenneth Russell.
+
+ blendFunc should generate INVALID_OPERATION if constant color and constant alpha are together as source and destination factors
+ https://bugs.webkit.org/show_bug.cgi?id=48674
+
+ Test: fast/canvas/webgl/webgl-specific.html
+
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore::WebGLRenderingContext::blendFunc):
+ (WebCore::WebGLRenderingContext::blendFuncSeparate):
+ * html/canvas/WebGLRenderingContext.h:
+ (WebCore::WebGLRenderingContext::validateBlendFuncFactors): Helper function to do the checking.
+
2010-11-02 Simon Fraser <simon.fraser at apple.com>
Reviewed by Dan Bernstein.
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index fd76d5a..2a59e89 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -353,12 +353,16 @@ void WebGLRenderingContext::blendEquationSeparate(unsigned long modeRGB, unsigne
void WebGLRenderingContext::blendFunc(unsigned long sfactor, unsigned long dfactor)
{
+ if (!validateBlendFuncFactors(sfactor, dfactor))
+ return;
m_context->blendFunc(sfactor, dfactor);
cleanupAfterGraphicsCall(false);
}
void WebGLRenderingContext::blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha)
{
+ if (!validateBlendFuncFactors(srcRGB, dstRGB))
+ return;
m_context->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
cleanupAfterGraphicsCall(false);
}
@@ -3393,6 +3397,18 @@ bool WebGLRenderingContext::validateBlendEquation(unsigned long mode)
}
}
+bool WebGLRenderingContext::validateBlendFuncFactors(unsigned long src, unsigned long dst)
+{
+ if (((src == GraphicsContext3D::CONSTANT_COLOR || src == GraphicsContext3D::ONE_MINUS_CONSTANT_COLOR)
+ && (dst == GraphicsContext3D::CONSTANT_ALPHA || dst == GraphicsContext3D::ONE_MINUS_CONSTANT_ALPHA))
+ || ((dst == GraphicsContext3D::CONSTANT_COLOR || dst == GraphicsContext3D::ONE_MINUS_CONSTANT_COLOR)
+ && (src == GraphicsContext3D::CONSTANT_ALPHA || src == GraphicsContext3D::ONE_MINUS_CONSTANT_ALPHA))) {
+ m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+ return false;
+ }
+ return true;
+}
+
bool WebGLRenderingContext::validateCapability(unsigned long cap)
{
switch (cap) {
diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h
index ce66f6a..70aeb54 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.h
+++ b/WebCore/html/canvas/WebGLRenderingContext.h
@@ -495,6 +495,9 @@ public:
// Helper function to validate blend equation mode.
bool validateBlendEquation(unsigned long);
+ // Helper function to validate blend func factors.
+ bool validateBlendFuncFactors(unsigned long src, unsigned long dst);
+
// Helper function to validate a GL capability.
bool validateCapability(unsigned long);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list