[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

zmo at google.com zmo at google.com
Mon Feb 21 00:05:55 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit abdd5a29b8ea7b8392c9deb7606c6062c5aeb118
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 28 01:26:12 2011 +0000

    2011-01-27  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Kenneth Russell.
    
            texSubImage2D's format/type needs to match the internalformat/type from the previous texImage2D call
            https://bugs.webkit.org/show_bug.cgi?id=53054
    
            * fast/canvas/webgl/tex-sub-image-2d-bad-args-expected.txt: Added.
            * fast/canvas/webgl/tex-sub-image-2d-bad-args.html: Added.
    2011-01-27  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Kenneth Russell.
    
            texSubImage2D's format/type needs to match the internalformat/type from the previous texImage2D call
            https://bugs.webkit.org/show_bug.cgi?id=53054
    
            Test: fast/canvas/webgl/tex-sub-image-2d-bad-args.html
    
            * html/canvas/WebGLRenderingContext.cpp:
            (WebCore::WebGLRenderingContext::texSubImage2DBase): Check format/type match.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76874 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c1fc8fa..b50ebcf 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-27  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Kenneth Russell.
+
+        texSubImage2D's format/type needs to match the internalformat/type from the previous texImage2D call
+        https://bugs.webkit.org/show_bug.cgi?id=53054
+
+        * fast/canvas/webgl/tex-sub-image-2d-bad-args-expected.txt: Added.
+        * fast/canvas/webgl/tex-sub-image-2d-bad-args.html: Added.
+
 2011-01-27  Ryosuke Niwa  <rniwa at webkit.org>
 
         Unreviewed rebaselines for Chromium Mac and Windows.
diff --git a/LayoutTests/fast/canvas/webgl/tex-sub-image-2d-bad-args-expected.txt b/LayoutTests/fast/canvas/webgl/tex-sub-image-2d-bad-args-expected.txt
new file mode 100644
index 0000000..c353841
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/tex-sub-image-2d-bad-args-expected.txt
@@ -0,0 +1,27 @@
+ 
+Tests texSubImage2D with bad arguments
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS getError was expected value: NO_ERROR : Setup should succeed
+PASS getError was expected value: INVALID_VALUE : y + height > texture height
+PASS getError was expected value: INVALID_VALUE : x + width > texture width
+PASS getError was expected value: INVALID_VALUE : negative x
+PASS getError was expected value: INVALID_VALUE : negative y
+PASS getError was expected value: INVALID_VALUE : negative level
+PASS getError was expected value: INVALID_ENUM : bad target
+PASS getError was expected value: NO_ERROR : good args
+PASS getError was expected value: INVALID_OPERATION : format not same as original
+PASS getError was expected value: INVALID_OPERATION : type not same as original
+PASS getError was expected value: NO_ERROR : make texture RGB
+PASS getError was expected value: NO_ERROR : format same as original RGB
+PASS getError was expected value: INVALID_OPERATION : format not same as original RGB
+PASS getError was expected value: INVALID_OPERATION : type not same as original RGB
+PASS getError was expected value: NO_ERROR : make texture RGBA 4_4_4_4
+PASS getError was expected value: NO_ERROR : format same as original RGBA 4_4_4_4
+PASS getError was expected value: INVALID_OPERATION : format not same as original RGBA 4_4_4_4
+PASS getError was expected value: INVALID_OPERATION : type not same as original RGBA 4_4_4_4
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/webgl/tex-sub-image-2d-bad-args.html b/LayoutTests/fast/canvas/webgl/tex-sub-image-2d-bad-args.html
new file mode 100644
index 0000000..254a9a6
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/tex-sub-image-2d-bad-args.html
@@ -0,0 +1,65 @@
+<html>
+<head>
+<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>
+<canvas id="testbed" width="16" height="16"></canvas>
+<canvas id="c" width="16" height="16"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+description('Tests texSubImage2D with bad arguments');
+
+var wtu = WebGLTestUtils;
+var canvas = document.getElementById("testbed");
+var c = document.getElementById("c");
+
+var gl = wtu.create3DContext(canvas);
+var tex = gl.createTexture();
+gl.bindTexture(gl.TEXTURE_2D, tex);
+gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.NO_ERROR, "Setup should succeed"); 
+
+gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 1, gl.RGBA, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.INVALID_VALUE, "y + height > texture height");
+gl.texSubImage2D(gl.TEXTURE_2D, 0, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.INVALID_VALUE, "x + width > texture width");
+gl.texSubImage2D(gl.TEXTURE_2D, 0, -1, 0, gl.RGBA, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.INVALID_VALUE, "negative x");
+gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, -1, gl.RGBA, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.INVALID_VALUE, "negative y");
+gl.texSubImage2D(gl.TEXTURE_2D, -1, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.INVALID_VALUE, "negative level");
+gl.texSubImage2D(gl.FLOAT, 0, 0,0, gl.RGBA, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.INVALID_ENUM, "bad target");
+gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.NO_ERROR, "good args");
+gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.INVALID_OPERATION, "format not same as original");
+gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED_SHORT_4_4_4_4, c);
+glErrorShouldBe(gl, gl.INVALID_OPERATION, "type not same as original");
+gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.NO_ERROR, "make texture RGB");
+gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.NO_ERROR, "format same as original RGB");
+gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.INVALID_OPERATION, "format not same as original RGB");
+gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_SHORT_5_6_5, c);
+glErrorShouldBe(gl, gl.INVALID_OPERATION, "type not same as original RGB");
+gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_SHORT_4_4_4_4, c);
+glErrorShouldBe(gl, gl.NO_ERROR, "make texture RGBA 4_4_4_4");
+gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED_SHORT_4_4_4_4, c);
+glErrorShouldBe(gl, gl.NO_ERROR, "format same as original RGBA 4_4_4_4");
+gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGB, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.INVALID_OPERATION, "format not same as original RGBA 4_4_4_4");
+gl.texSubImage2D(gl.TEXTURE_2D, 0, 0,0, gl.RGBA, gl.UNSIGNED_BYTE, c);
+glErrorShouldBe(gl, gl.INVALID_OPERATION, "type not same as original RGBA 4_4_4_4");
+
+successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 63fceb4..76d599a 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-27  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Kenneth Russell.
+
+        texSubImage2D's format/type needs to match the internalformat/type from the previous texImage2D call
+        https://bugs.webkit.org/show_bug.cgi?id=53054
+
+        Test: fast/canvas/webgl/tex-sub-image-2d-bad-args.html
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::texSubImage2DBase): Check format/type match.
+
 2011-01-27  Yi Shen  <yi.4.shen at nokia.com>, Tor Arne Vestbø <tor.arne.vestbo at nokia.com>
 
         Reviewed by Andreas Kling.
diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
index f4004f2..71f70d1 100644
--- a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -3078,12 +3078,21 @@ void WebGLRenderingContext::texSubImage2DBase(GC3Denum target, GC3Dint level, GC
     ec = 0;
     if (isContextLost())
         return;
-    if (!validateTexFuncFormatAndType(format, type))
+    if (!validateTexFuncParameters(target, level, format, width, height, 0, format, type))
         return;
-    if (!validateTextureBinding(target, true))
+    if (!validateSize(xoffset, yoffset))
         return;
-    if (!validateSize(xoffset, yoffset) || !validateSize(width, height))
+    WebGLTexture* tex = validateTextureBinding(target, true);
+    if (!tex)
         return;
+    if (xoffset + width > tex->getWidth(target, level) || yoffset + height > tex->getHeight(target, level)) {
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
+        return;
+    }
+    if (tex->getInternalFormat(target, level) != format || tex->getType(target, level) != type) {
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+        return;
+    }
     m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
     cleanupAfterGraphicsCall(false);
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list