[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-142-g786665c
zmo at google.com
zmo at google.com
Mon Dec 27 16:30:53 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 46665973f3f770253a675db1cb29e5bc3ca196e2
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 22 21:05:01 2010 +0000
2010-12-22 Zhenyao Mo <zmo at google.com>
Reviewed by Kenneth Russell.
CopyTex{Sub}Image2D check always if the bound fbo's internal color format is compatible
https://bugs.webkit.org/show_bug.cgi?id=51423
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::copyTexImage2D): Remove the isGLES2Compliant flag around format compatibility checking.
(WebCore::WebGLRenderingContext::copyTexSubImage2D): Ditto.
(WebCore::WebGLRenderingContext::getBoundFramebufferColorFormat): Helper function to get bound framebuffer's color format; deal with the case of webgl's internal fbo.
* html/canvas/WebGLRenderingContext.h:
2010-12-22 Zhenyao Mo <zmo at google.com>
Reviewed by Kenneth Russell.
CopyTex{Sub}Image2D check always if the bound fbo's internal color format is compatible
https://bugs.webkit.org/show_bug.cgi?id=51423
* fast/canvas/webgl/tex-input-validation-expected.txt: Add test cases for copying from webgl's internal FBO.
* fast/canvas/webgl/tex-input-validation.html: Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74497 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 26f8c6a..01b2603 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-12-22 Zhenyao Mo <zmo at google.com>
+
+ Reviewed by Kenneth Russell.
+
+ CopyTex{Sub}Image2D check always if the bound fbo's internal color format is compatible
+ https://bugs.webkit.org/show_bug.cgi?id=51423
+
+ * fast/canvas/webgl/tex-input-validation-expected.txt: Add test cases for copying from webgl's internal FBO.
+ * fast/canvas/webgl/tex-input-validation.html: Ditto.
+
2010-12-22 Chris Fleizach <cfleizach at apple.com>
Reviewed by Sam Weining.
diff --git a/LayoutTests/fast/canvas/webgl/tex-input-validation-expected.txt b/LayoutTests/fast/canvas/webgl/tex-input-validation-expected.txt
index 7f39e06..988a943 100644
--- a/LayoutTests/fast/canvas/webgl/tex-input-validation-expected.txt
+++ b/LayoutTests/fast/canvas/webgl/tex-input-validation-expected.txt
@@ -4,55 +4,80 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS gl = create3DContext() is non-null.
PASS tex = gl.createTexture() is non-null.
-PASS gl.getError() is gl.NO_ERROR
+PASS getError was expected value: NO_ERROR :
+
Checking TexImage2D: a set of inputs that are valid in GL but invalid in GLES2
-PASS gl.getError() is error
-PASS gl.getError() is error
-PASS gl.getError() is error
-PASS gl.getError() is error
-PASS gl.getError() is error
-PASS gl.getError() is error
+PASS getError was expected value: INVALID_ENUM : internalFormat: RGBA target: 0x8064 format: RGBA type: UNSIGNED_BYTE border: 0
+PASS getError was expected value: INVALID_ENUM : internalFormat: 0x1903 target: TEXTURE_2D format: 0x1903 type: UNSIGNED_BYTE border: 0
+PASS getError was expected value: INVALID_VALUE : internalFormat: RGBA target: TEXTURE_2D format: RGBA type: UNSIGNED_BYTE border: 1
+PASS getError was expected value: INVALID_OPERATION : internalFormat: RGBA target: TEXTURE_2D format: RGB type: UNSIGNED_BYTE border: 0
+PASS getError was expected value: INVALID_ENUM : internalFormat: RGBA target: TEXTURE_2D format: RGBA type: BYTE border: 0
+PASS getError was expected value: NO_ERROR : internalFormat: RGBA target: TEXTURE_2D format: RGBA type: UNSIGNED_BYTE border: 0
+
Checking TexSubImage2D: a set of inputs that are valid in GL but invalid in GLES2
-PASS gl.getError() is error
-PASS gl.getError() is error
-PASS gl.getError() is error
+PASS getError was expected value: INVALID_ENUM : format: 0x1903 type: UNSIGNED_BYTE
+PASS getError was expected value: INVALID_ENUM : format: RGBA type: BYTE
+PASS getError was expected value: NO_ERROR : format: RGBA type: UNSIGNED_BYTE
+
Checking TexParameter: a set of inputs that are valid in GL but invalid in GLES2
-PASS gl.getError() is error
-PASS gl.getError() is error
-PASS gl.getError() is error
-PASS gl.getError() is error
-PASS gl.getError() is error
-PASS gl.getError() is error
-PASS gl.getError() is error
-PASS gl.getError() is error
+PASS getError was expected value: INVALID_ENUM : paramName: TEXTURE_WRAP_T
+PASS getError was expected value: INVALID_ENUM : paramName: TEXTURE_WRAP_T
+PASS getError was expected value: INVALID_ENUM : paramName: 0x813a
+PASS getError was expected value: INVALID_ENUM : paramName: 0x813a
+PASS getError was expected value: INVALID_ENUM : paramName: TEXTURE_WRAP_T
+PASS getError was expected value: INVALID_ENUM : paramName: TEXTURE_WRAP_T
+PASS getError was expected value: NO_ERROR : paramName: TEXTURE_WRAP_T
+PASS getError was expected value: NO_ERROR : paramName: TEXTURE_WRAP_T
+
Checking GetTexParameter: a set of inputs that are valid in GL but invalid in GLES2
-PASS gl.getError() is error
-PASS gl.getError() is error
-PASS gl.getError() is error
+PASS getError was expected value: INVALID_ENUM : paramName: TEXTURE_WRAP_T
+PASS getError was expected value: INVALID_ENUM : paramName: 0x813a
+PASS getError was expected value: NO_ERROR : paramName: TEXTURE_WRAP_T
+
Checking CopyTexImage2D: a set of inputs that are valid in GL but invalid in GLES2
PASS fbo = gl.createFramebuffer() is non-null.
PASS colorBuffer = gl.createRenderbuffer() is non-null.
-PASS gl.getError() is gl.NO_ERROR
-PASS gl.getError() is gl.NO_ERROR
+PASS getError was expected value: NO_ERROR :
+PASS getError was expected value: NO_ERROR :
PASS gl.checkFramebufferStatus(gl.FRAMEBUFFER) is gl.FRAMEBUFFER_COMPLETE
-PASS gl.getError() is error
-PASS gl.getError() is gl.NO_ERROR
+PASS getError was expected value: INVALID_ENUM : colorBufferFormat: RGB565 internalFormat: 0x8054 target: TEXTURE_2D border: 0
+PASS getError was expected value: NO_ERROR :
PASS gl.checkFramebufferStatus(gl.FRAMEBUFFER) is gl.FRAMEBUFFER_COMPLETE
-PASS gl.getError() is error
-PASS gl.getError() is gl.NO_ERROR
+PASS getError was expected value: INVALID_VALUE : colorBufferFormat: RGB565 internalFormat: RGBA target: TEXTURE_2D border: 1
+PASS getError was expected value: NO_ERROR :
PASS gl.checkFramebufferStatus(gl.FRAMEBUFFER) is gl.FRAMEBUFFER_COMPLETE
-PASS gl.getError() is error
-PASS gl.getError() is gl.NO_ERROR
+PASS getError was expected value: INVALID_OPERATION : colorBufferFormat: RGB565 internalFormat: RGBA target: TEXTURE_2D border: 0
+PASS getError was expected value: NO_ERROR :
PASS gl.checkFramebufferStatus(gl.FRAMEBUFFER) is gl.FRAMEBUFFER_COMPLETE
-PASS gl.getError() is error
+PASS getError was expected value: NO_ERROR : colorBufferFormat: RGB565 internalFormat: RGB target: TEXTURE_2D border: 0
+
Checking CopyTexSubImage2D: a set of inputs that are valid in GL but invalid in GLES2
-PASS gl.getError() is gl.NO_ERROR
+PASS getError was expected value: NO_ERROR :
PASS gl.checkFramebufferStatus(gl.FRAMEBUFFER) is gl.FRAMEBUFFER_COMPLETE
-PASS gl.getError() is gl.NO_ERROR
-PASS gl.getError() is error
-PASS gl.getError() is gl.NO_ERROR
+PASS getError was expected value: NO_ERROR :
+PASS getError was expected value: NO_ERROR : colorBufferFormat: RGB5_A1 internalFormat: RGBA target: TEXTURE_2D
+PASS getError was expected value: NO_ERROR :
PASS gl.checkFramebufferStatus(gl.FRAMEBUFFER) is gl.FRAMEBUFFER_COMPLETE
-PASS gl.getError() is error
+PASS getError was expected value: NO_ERROR :
+PASS getError was expected value: INVALID_OPERATION : colorBufferFormat: RGB565 internalFormat: RGBA target: TEXTURE_2D
+
+Checking CopyTex{Sub}Image2D: copy from WebGL internal framebuffer
+PASS gl is non-null.
+PASS tex = gl.createTexture() is non-null.
+PASS getError was expected value: NO_ERROR :
+PASS getError was expected value: NO_ERROR : colorBufferFormat: RGBA internalFormat: RGBA
+PASS gl is non-null.
+PASS tex = gl.createTexture() is non-null.
+PASS getError was expected value: NO_ERROR :
+PASS getError was expected value: INVALID_OPERATION : colorBufferFormat: RGB internalFormat: RGBA
+PASS gl is non-null.
+PASS tex = gl.createTexture() is non-null.
+PASS getError was expected value: NO_ERROR :
+PASS getError was expected value: NO_ERROR : colorBufferFormat: RGBA internalFormat: RGBA
+PASS gl is non-null.
+PASS tex = gl.createTexture() is non-null.
+PASS getError was expected value: NO_ERROR :
+PASS getError was expected value: INVALID_OPERATION : colorBufferFormat: RGB internalFormat: RGBA
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/canvas/webgl/tex-input-validation.html b/LayoutTests/fast/canvas/webgl/tex-input-validation.html
index 1f1c168..7a5ec88 100644
--- a/LayoutTests/fast/canvas/webgl/tex-input-validation.html
+++ b/LayoutTests/fast/canvas/webgl/tex-input-validation.html
@@ -3,25 +3,37 @@
<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;
var gl = null;
var tex = null;
var error = 0;
+function enumToString(value) {
+ return wtu.glEnumToString(gl, value);
+}
+
function testTexImage2D(testCase)
{
var level = 0;
var width = 16;
var height = 16;
- gl.texImage2D(testCase.target, level, testCase.internalformat, width, height, testCase.border, testCase.format, testCase.type, null);
+ var msg = "" +
+ " internalFormat: " + enumToString(testCase.internalFormat) +
+ " target: " + enumToString(testCase.target) +
+ " format: " + enumToString(testCase.format) +
+ " type: " + enumToString(testCase.type) +
+ " border: " + testCase.border;
+
+ gl.texImage2D(testCase.target, level, testCase.internalFormat, width, height, testCase.border, testCase.format, testCase.type, null);
error = testCase.expectedError;
- shouldBe("gl.getError()", "error");
+ glErrorShouldBe(gl, error, msg);
}
function testTexSubImage2D(testCase)
@@ -31,26 +43,31 @@ function testTexSubImage2D(testCase)
var yoffset = 0;
var width = 16;
var height = 16;
+ var msg = ""+
+ " format: " + enumToString(testCase.format) +
+ " type: " + enumToString(testCase.type);
var array = new Uint8Array(width * height * 4);
gl.texSubImage2D(testCase.target, level, xoffset, yoffset, width, height, testCase.format, testCase.type, array);
error = testCase.expectedError;
- shouldBe("gl.getError()", "error");
+ glErrorShouldBe(gl, error, msg);
}
function testTexParameter(testCase)
{
+ var msg = "paramName: " + enumToString(testCase.pname);
error = testCase.expectedError;
gl.texParameteri(testCase.target, testCase.pname, testCase.param);
- shouldBe("gl.getError()", "error");
+ glErrorShouldBe(gl, error, msg);
gl.texParameterf(testCase.target, testCase.pname, testCase.param);
- shouldBe("gl.getError()", "error");
+ glErrorShouldBe(gl, error, msg);
}
function testGetTexParameter(testCase)
{
+ var msg = "paramName: " + enumToString(testCase.pname);
error = testCase.expectedError;
gl.getTexParameter(testCase.target, testCase.pname);
- shouldBe("gl.getError()", "error");
+ glErrorShouldBe(gl, error, msg);
}
function testCopyTexImage2D(testCase)
@@ -61,13 +78,19 @@ function testCopyTexImage2D(testCase)
var width = 16;
var height = 16;
+ var msg = "" +
+ " colorBufferFormat: " + enumToString(testCase.colorBufferFormat) +
+ " internalFormat: " + enumToString(testCase.internalFormat) +
+ " target: " + enumToString(testCase.target) +
+ " border: " + testCase.border;
+
gl.renderbufferStorage(gl.RENDERBUFFER, testCase.colorBufferFormat, width, height);
- shouldBe("gl.getError()", "gl.NO_ERROR");
+ glErrorShouldBe(gl, gl.NO_ERROR);
shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
- gl.copyTexImage2D(testCase.target, level, testCase.internalformat, x, y, width, height, testCase.border);
+ gl.copyTexImage2D(testCase.target, level, testCase.internalFormat, x, y, width, height, testCase.border);
error = testCase.expectedError;
- shouldBe("gl.getError()", "error");
+ glErrorShouldBe(gl, error, msg);
}
function testCopyTexSubImage2D(testCase)
@@ -80,19 +103,57 @@ function testCopyTexSubImage2D(testCase)
var xoffset = 0;
var yoffset = 0;
var border = 0;
+ var type = gl.UNSIGNED_BYTE;
+ var msg = "" +
+ " colorBufferFormat: " + enumToString(testCase.colorBufferFormat) +
+ " internalFormat: " + enumToString(testCase.internalFormat) +
+ " target: " + enumToString(testCase.target);
gl.renderbufferStorage(gl.RENDERBUFFER, testCase.colorBufferFormat, width, height);
- shouldBe("gl.getError()", "gl.NO_ERROR");
+ glErrorShouldBe(gl, gl.NO_ERROR);
shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
- if (testCase.initTex) {
- gl.copyTexImage2D(testCase.target, level, testCase.internalformat, x, y, width, height, border);
- shouldBe("gl.getError()", "gl.NO_ERROR");
- }
+ gl.texImage2D(testCase.target, level, testCase.internalFormat, xoffset + width, yoffset + height, border, testCase.internalFormat, type, null);
+ glErrorShouldBe(gl, gl.NO_ERROR);
gl.copyTexSubImage2D(testCase.target, level, xoffset, yoffset, x, y, width, height);
error = testCase.expectedError;
- shouldBe("gl.getError()", "error");
+ glErrorShouldBe(gl, error, msg);
+}
+
+function testCopyFromInternalFBO(testCase)
+{
+ var target = gl.TEXTURE_2D;
+ var level = 0;
+ var x = 0;
+ var y = 0;
+ var width = 16;
+ var height = 16;
+ var xoffset = 0;
+ var yoffset = 0;
+ var border = 0;
+ var type = gl.UNSIGNED_BYTE;
+ var msg = "" +
+ " colorBufferFormat: " + enumToString(testCase.contextAlpha ? gl.RGBA : gl.RGB) +
+ " internalFormat: " + enumToString(testCase.internalFormat);
+
+ if (testCase.contextAlpha)
+ gl = create3DContext(null, { alpha: true });
+ else
+ gl = create3DContext(null, { alpha: false });
+ shouldBeNonNull("gl");
+ shouldBeNonNull("tex = gl.createTexture()");
+ gl.bindTexture(target, tex);
+ if (testCase.subImage) {
+ gl.texImage2D(target, level, testCase.internalFormat, xoffset + width, yoffset + height, border, testCase.internalFormat, type, null);
+ glErrorShouldBe(gl, gl.NO_ERROR);
+ gl.copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
+ } else {
+ glErrorShouldBe(gl, gl.NO_ERROR);
+ gl.copyTexImage2D(target, level, testCase.internalFormat, x, y, width, height, border);
+ }
+ error = testCase.expectedError;
+ glErrorShouldBe(gl, error, msg);
}
description("Validate tex functions input parameters");
@@ -100,43 +161,44 @@ description("Validate tex functions input parameters");
shouldBeNonNull("gl = create3DContext()");
shouldBeNonNull("tex = gl.createTexture()");
gl.bindTexture(gl.TEXTURE_2D, tex);
-shouldBe("gl.getError()", "gl.NO_ERROR");
+glErrorShouldBe(gl, gl.NO_ERROR);
+debug("");
debug("Checking TexImage2D: a set of inputs that are valid in GL but invalid in GLES2");
var testCases =
[ {target: 0x8064, // GL_PROXY_TEXTURE_2D
- internalformat: gl.RGBA,
+ internalFormat: gl.RGBA,
border: 0,
format: gl.RGBA,
type: gl.UNSIGNED_BYTE,
expectedError: gl.INVALID_ENUM},
{target: gl.TEXTURE_2D,
- internalformat: 0x1903, // GL_RED
+ internalFormat: 0x1903, // GL_RED
border: 0,
format: 0x1903, // GL_RED
type: gl.UNSIGNED_BYTE,
expectedError: gl.INVALID_ENUM},
{target: gl.TEXTURE_2D,
- internalformat: gl.RGBA,
+ internalFormat: gl.RGBA,
border: 1,
format: gl.RGBA,
type: gl.UNSIGNED_BYTE,
expectedError: gl.INVALID_VALUE},
{target: gl.TEXTURE_2D,
- internalformat: gl.RGBA,
+ internalFormat: gl.RGBA,
border: 0,
format: gl.RGB,
type: gl.UNSIGNED_BYTE,
expectedError: gl.INVALID_OPERATION},
{target: gl.TEXTURE_2D,
- internalformat: gl.RGBA,
+ internalFormat: gl.RGBA,
border: 0,
format: gl.RGBA,
type: gl.BYTE,
expectedError: gl.INVALID_ENUM},
{target: gl.TEXTURE_2D,
- internalformat: gl.RGBA,
+ internalFormat: gl.RGBA,
border: 0,
format: gl.RGBA,
type: gl.UNSIGNED_BYTE,
@@ -145,6 +207,7 @@ var testCases =
for (var ii = 0; ii < testCases.length; ++ii)
testTexImage2D(testCases[ii]);
+debug("");
debug("Checking TexSubImage2D: a set of inputs that are valid in GL but invalid in GLES2");
testCases =
@@ -164,6 +227,7 @@ testCases =
for (var ii = 0; ii < testCases.length; ++ii)
testTexSubImage2D(testCases[ii]);
+debug("");
debug("Checking TexParameter: a set of inputs that are valid in GL but invalid in GLES2");
testCases =
@@ -187,6 +251,7 @@ testCases =
for (var ii = 0; ii < testCases.length; ++ii)
testTexParameter(testCases[ii]);
+debug("");
debug("Checking GetTexParameter: a set of inputs that are valid in GL but invalid in GLES2");
testCases =
@@ -203,6 +268,7 @@ testCases =
for (var ii = 0; ii < testCases.length; ++ii)
testGetTexParameter(testCases[ii]);
+debug("");
debug("Checking CopyTexImage2D: a set of inputs that are valid in GL but invalid in GLES2");
var colorBuffer = null;
@@ -213,50 +279,73 @@ gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
shouldBeNonNull("colorBuffer = gl.createRenderbuffer()");
gl.bindRenderbuffer(gl.RENDERBUFFER, colorBuffer);
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorBuffer);
-shouldBe("gl.getError()", "gl.NO_ERROR");
+glErrorShouldBe(gl, gl.NO_ERROR);
testCases =
[ {target: gl.TEXTURE_2D,
colorBufferFormat: gl.RGB565,
- internalformat: 0x8054, // GL_RGB16
+ internalFormat: 0x8054, // GL_RGB16
border: 0,
expectedError: gl.INVALID_ENUM},
{target: gl.TEXTURE_2D,
colorBufferFormat: gl.RGB565,
- internalformat: gl.RGBA,
+ internalFormat: gl.RGBA,
border: 1,
expectedError: gl.INVALID_VALUE},
{target: gl.TEXTURE_2D,
colorBufferFormat: gl.RGB565,
- internalformat: gl.RGBA,
+ internalFormat: gl.RGBA,
border: 0,
expectedError: gl.INVALID_OPERATION},
{target: gl.TEXTURE_2D,
colorBufferFormat: gl.RGB565,
- internalformat: gl.RGB,
+ internalFormat: gl.RGB,
border: 0,
expectedError: gl.NO_ERROR} ];
for (var ii = 0; ii < testCases.length; ++ii)
testCopyTexImage2D(testCases[ii]);
+debug("");
debug("Checking CopyTexSubImage2D: a set of inputs that are valid in GL but invalid in GLES2");
testCases =
[ {target: gl.TEXTURE_2D,
colorBufferFormat: gl.RGB5_A1,
- internalformat: gl.RGBA,
- initTex: true,
+ internalFormat: gl.RGBA,
expectedError: gl.NO_ERROR},
{target: gl.TEXTURE_2D,
colorBufferFormat: gl.RGB565,
- internalformat: gl.RGBA,
- initTex: false,
+ internalFormat: gl.RGBA,
expectedError: gl.INVALID_OPERATION} ];
for (var ii = 0; ii < testCases.length; ++ii)
testCopyTexSubImage2D(testCases[ii]);
+debug("");
+debug("Checking CopyTex{Sub}Image2D: copy from WebGL internal framebuffer");
+
+testCases =
+ [ {contextAlpha: true,
+ internalFormat: gl.RGBA,
+ subImage: false,
+ expectedError: gl.NO_ERROR},
+ {contextAlpha: false,
+ internalFormat: gl.RGBA,
+ subImage: false,
+ expectedError: gl.INVALID_OPERATION},
+ {contextAlpha: true,
+ internalFormat: gl.RGBA,
+ subImage: true,
+ expectedError: gl.NO_ERROR},
+ {contextAlpha: false,
+ internalFormat: gl.RGBA,
+ subImage: true,
+ expectedError: gl.INVALID_OPERATION} ];
+
+for (var ii = 0; ii < testCases.length; ++ii)
+ testCopyFromInternalFBO(testCases[ii]);
+
successfullyParsed = true;
</script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 24e2221..99e0d5f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-12-22 Zhenyao Mo <zmo at google.com>
+
+ Reviewed by Kenneth Russell.
+
+ CopyTex{Sub}Image2D check always if the bound fbo's internal color format is compatible
+ https://bugs.webkit.org/show_bug.cgi?id=51423
+
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore::WebGLRenderingContext::copyTexImage2D): Remove the isGLES2Compliant flag around format compatibility checking.
+ (WebCore::WebGLRenderingContext::copyTexSubImage2D): Ditto.
+ (WebCore::WebGLRenderingContext::getBoundFramebufferColorFormat): Helper function to get bound framebuffer's color format; deal with the case of webgl's internal fbo.
+ * html/canvas/WebGLRenderingContext.h:
+
2010-12-22 Xan Lopez <xlopez at igalia.com>
Reviewed by Gustavo Noronha.
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index 65769e1..a53d799 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -637,13 +637,9 @@ void WebGLRenderingContext::copyTexImage2D(unsigned long target, long level, uns
WebGLTexture* tex = validateTextureBinding(target, true);
if (!tex)
return;
- if (!isGLES2Compliant()) {
- if (m_framebufferBinding && m_framebufferBinding->object()
- && !isTexInternalFormatColorBufferCombinationValid(internalformat,
- m_framebufferBinding->getColorBufferFormat())) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
- return;
- }
+ if (!isTexInternalFormatColorBufferCombinationValid(internalformat, getBoundFramebufferColorFormat())) {
+ m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+ return;
}
if (!isGLES2NPOTStrict() && level && WebGLTexture::isNPOT(width, height)) {
m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
@@ -666,13 +662,9 @@ void WebGLRenderingContext::copyTexSubImage2D(unsigned long target, long level,
WebGLTexture* tex = validateTextureBinding(target, true);
if (!tex)
return;
- if (!isGLES2Compliant()) {
- if (m_framebufferBinding && m_framebufferBinding->object()
- && !isTexInternalFormatColorBufferCombinationValid(tex->getInternalFormat(level),
- m_framebufferBinding->getColorBufferFormat())) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
- return;
- }
+ if (!isTexInternalFormatColorBufferCombinationValid(tex->getInternalFormat(level), getBoundFramebufferColorFormat())) {
+ m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+ return;
}
if (m_framebufferBinding && !m_framebufferBinding->onAccess(!isResourceSafe())) {
m_context->synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION);
@@ -3571,6 +3563,15 @@ bool WebGLRenderingContext::isTexInternalFormatColorBufferCombinationValid(unsig
return false;
}
+unsigned long WebGLRenderingContext::getBoundFramebufferColorFormat()
+{
+ if (m_framebufferBinding && m_framebufferBinding->object())
+ return m_framebufferBinding->getColorBufferFormat();
+ if (m_attributes.alpha)
+ return GraphicsContext3D::RGBA;
+ return GraphicsContext3D::RGB;
+}
+
WebGLTexture* WebGLRenderingContext::validateTextureBinding(unsigned long target, bool useSixEnumsForCubeMap)
{
WebGLTexture* tex = 0;
diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h
index f4bd047..b693844 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.h
+++ b/WebCore/html/canvas/WebGLRenderingContext.h
@@ -502,6 +502,9 @@ public:
bool isTexInternalFormatColorBufferCombinationValid(unsigned long texInternalFormat,
unsigned long colorBufferFormat);
+ // Helper function to get the bound framebuffer's color buffer format.
+ unsigned long getBoundFramebufferColorFormat();
+
// Helper function to check target and texture bound to the target.
// Generate GL errors and return 0 if target is invalid or texture bound is
// null. Otherwise, return the texture bound to the target.
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list