[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 12:01:55 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit f80ed6051c29b30b988212efe4a6b9d5651cef7f
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 12 22:59:25 2010 +0000

    2010-08-12  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Dimitri Glazkov.
    
            regression in generateMipmap
            https://bugs.webkit.org/show_bug.cgi?id=43873
    
            * html/canvas/WebGLTexture.cpp:
            (WebCore::WebGLTexture::generateMipmapLevelInfo): should set m_needToUseBlackTexture to false if generateMipmapLevelInfo runs through successfully.
    2010-08-12  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Dimitri Glazkov.
    
            regression in generateMipmap
            https://bugs.webkit.org/show_bug.cgi?id=43873
    
            * fast/canvas/webgl/texture-npot-expected.txt: Add more test cases on NPOT/POT texture behaviors.
            * fast/canvas/webgl/texture-npot.html: Ditto.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65277 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 26e3474..ba525cb 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-08-12  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Dimitri Glazkov.
+
+        regression in generateMipmap
+        https://bugs.webkit.org/show_bug.cgi?id=43873
+
+        * fast/canvas/webgl/texture-npot-expected.txt: Add more test cases on NPOT/POT texture behaviors.
+        * fast/canvas/webgl/texture-npot.html: Ditto.
+
 2010-08-12  François Sausset  <sausset at gmail.com>
 
         Reviewed by Beth Dakin.
diff --git a/LayoutTests/fast/canvas/webgl/texture-npot-expected.txt b/LayoutTests/fast/canvas/webgl/texture-npot-expected.txt
index b5a3822..8c66cd4 100644
--- a/LayoutTests/fast/canvas/webgl/texture-npot-expected.txt
+++ b/LayoutTests/fast/canvas/webgl/texture-npot-expected.txt
@@ -1,12 +1,29 @@
- PASS Should be no errors from setup.
-PASS gl.texImage2D with NPOT texture with level > 0 should return INVALID_VALUE
-PASS gl.texImage2D with NPOT texture at level 0 should succeed
-PASS gl.generateMipmap with NPOT texture should return INVALID_OPERATION
+ PASS getError was expected value: NO_ERROR : Should be no errors from setup.
+PASS getError was expected value: INVALID_VALUE : gl.texImage2D with NPOT texture with level > 0 should return INVALID_VALUE
+PASS getError was expected value: NO_ERROR : gl.texImage2D with NPOT texture at level 0 should succeed
+PASS getError was expected value: INVALID_OPERATION : gl.generateMipmap with NPOT texture should return INVALID_OPERATION
 PASS NPOT texture with TEXTURE_WRAP set to REPEAT should draw with 0,0,0,255
-PASS Should be no errors from setup.
+PASS getError was expected value: NO_ERROR : Should be no errors from setup.
 PASS NPOT texture with TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with 0,0,0,255
-PASS Should be no errors from setup.
+PASS getError was expected value: NO_ERROR : Should be no errors from setup.
 PASS NPOT texture with TEXTURE_MIN_FILTER set to LINEAR should draw.
+PASS getError was expected value: INVALID_VALUE : copyTexImage2D with NPOT texture with level > 0 should return INVALID_VALUE.
+PASS getError was expected value: NO_ERROR : gl.texImage2D and gl.generateMipmap with POT texture at level 0 should succeed
+PASS POT texture with TEXTURE_MIN_FILTER set to LINEAR_MIPMAP_LINEAR should draw.
+PASS getError was expected value: NO_ERROR : Should be no errors from setup.
+
+check using cubemap
+PASS getError was expected value: INVALID_VALUE : gl.texImage2D with NPOT texture with level > 0 should return INVALID_VALUE
+PASS getError was expected value: NO_ERROR : gl.texImage2D with NPOT texture at level 0 should succeed
+PASS getError was expected value: INVALID_OPERATION : gl.generateMipmap with NPOT texture should return INVALID_OPERATION
+PASS NPOT cubemap with TEXTURE_WRAP set to REPEAT should draw with 0,0,0,255
+PASS getError was expected value: NO_ERROR : Should be no errors from setup.
+PASS NPOT cubemap with TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with 0,0,0,255
+PASS getError was expected value: NO_ERROR : Should be no errors from setup.
+PASS NPOT cubemap with TEXTURE_MIN_FILTER set to LINEAR should draw.
+PASS getError was expected value: NO_ERROR : gl.texImage2D with POT texture at level 0 should succeed
+PASS POT cubemap with TEXTURE_MIN_FILTER set to LINEAR_MIPMAP_LINEAR but no mips draw with 0,0,0,255
+PASS getError was expected value: NO_ERROR : gl.generateMipmap with POT texture should return succeed
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/LayoutTests/fast/canvas/webgl/texture-npot.html b/LayoutTests/fast/canvas/webgl/texture-npot.html
index 630b5eb..ac60cb5 100644
--- a/LayoutTests/fast/canvas/webgl/texture-npot.html
+++ b/LayoutTests/fast/canvas/webgl/texture-npot.html
@@ -12,30 +12,52 @@
 <canvas id="example" width="4" height="4" style="width: 40px; height: 30px;"></canvas>
 <div id="description"></div>
 <div id="console"></div>
+<script id="vshader" type="x-shader/x-vertex">
+attribute vec4 vPosition;
+attribute vec2 texCoord0;
+varying vec2 texCoord;
+void main()
+{
+    gl_Position = vPosition;
+    texCoord = texCoord0;
+}
+</script>
+
+<script id="fshader" type="x-shader/x-fragment">
+#ifdef GL_ES
+precision mediump float;
+#endif
+uniform samplerCube tex;
+varying vec2 texCoord;
+void main()
+{
+    gl_FragColor = textureCube(tex, normalize(vec3(texCoord, 1)));
+}
+</script>
 <script>
 var wtu = WebGLTestUtils;
 var canvas = document.getElementById("example");
 var gl = wtu.create3DContext(canvas);
 var program = wtu.setupTexturedQuad(gl);
 
-assertMsg(gl.getError() == gl.NO_ERROR, "Should be no errors from setup.");
+glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
 
 var tex = gl.createTexture();
 
 // Check that an NPOT texture not on level 0 generates INVALID_VALUE
 wtu.fillTexture(gl, tex, 5, 3, [0, 192, 128, 255], 1);
-assertMsg(gl.getError() == gl.INVALID_VALUE,
-          "gl.texImage2D with NPOT texture with level > 0 should return INVALID_VALUE");
+glErrorShouldBe(gl, gl.INVALID_VALUE,
+    "gl.texImage2D with NPOT texture with level > 0 should return INVALID_VALUE");
 
 // Check that an NPOT texture on level 0 succeeds
 wtu.fillTexture(gl, tex, 5, 3, [0, 192, 128, 255]);
-assertMsg(gl.getError() == gl.NO_ERROR,
-          "gl.texImage2D with NPOT texture at level 0 should succeed");
+glErrorShouldBe(gl, gl.NO_ERROR,
+    "gl.texImage2D with NPOT texture at level 0 should succeed");
 
 // Check that generateMipmap fails on NPOT
 gl.generateMipmap(gl.TEXTURE_2D);
-assertMsg(gl.getError() == gl.INVALID_OPERATION,
-          "gl.generateMipmap with NPOT texture should return INVALID_OPERATION");
+glErrorShouldBe(gl, gl.INVALID_OPERATION,
+    "gl.generateMipmap with NPOT texture should return INVALID_OPERATION");
 
 var loc = gl.getUniformLocation(program, "tex");
 gl.uniform1i(loc, 0);
@@ -50,7 +72,7 @@ wtu.drawQuad(gl);
 wtu.checkCanvas(
     gl, [0, 0, 0, 255],
     "NPOT texture with TEXTURE_WRAP set to REPEAT should draw with 0,0,0,255");
-assertMsg(gl.getError() == gl.NO_ERROR, "Should be no errors from setup.");
+glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
 
 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
@@ -60,7 +82,7 @@ wtu.drawQuad(gl);
 wtu.checkCanvas(
     gl, [0, 0, 0, 255],
     "NPOT texture with TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with 0,0,0,255");
-assertMsg(gl.getError() == gl.NO_ERROR, "Should be no errors from setup.");
+glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
 
 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
 
@@ -69,7 +91,133 @@ wtu.checkCanvas(
     gl, [0, 192, 128, 255],
     "NPOT texture with TEXTURE_MIN_FILTER set to LINEAR should draw.");
 
+gl.copyTexImage2D(gl.TEXTURE_2D, 1, gl.RGBA, 0, 0, 5, 3, 0);
+glErrorShouldBe(gl, gl.INVALID_VALUE,
+    "copyTexImage2D with NPOT texture with level > 0 should return INVALID_VALUE.");
+
+// Check that generateMipmap for an POT texture succeeds
+wtu.fillTexture(gl, tex, 4, 4, [0, 192, 128, 255]);
+gl.generateMipmap(gl.TEXTURE_2D);
+glErrorShouldBe(gl, gl.NO_ERROR,
+    "gl.texImage2D and gl.generateMipmap with POT texture at level 0 should succeed");
+
+gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
+gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
+gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);
+gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);
+
+wtu.drawQuad(gl);
+wtu.checkCanvas(
+    gl, [0, 192, 128, 255],
+    "POT texture with TEXTURE_MIN_FILTER set to LINEAR_MIPMAP_LINEAR should draw.");
+glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
+
+debug("");
+debug("check using cubemap");
+var program = wtu.setupProgram(
+    gl,
+    [wtu.loadShaderFromScript(gl, 'vshader', gl.VERTEX_SHADER),
+     wtu.loadShaderFromScript(gl, 'fshader', gl.FRAGMENT_SHADER)],
+    ['vPosition', 'texCoord0'], [0, 1]);
+var tex = gl.createTexture();
+
+// Check that an NPOT texture not on level 0 generates INVALID_VALUE
+fillCubeTexture(gl, tex, 5, 3, [0, 192, 128, 255], 1);
+glErrorShouldBe(gl, gl.INVALID_VALUE,
+    "gl.texImage2D with NPOT texture with level > 0 should return INVALID_VALUE");
+
+// Check that an NPOT texture on level 0 succeeds
+fillCubeTexture(gl, tex, 5, 5, [0, 192, 128, 255]);
+glErrorShouldBe(gl, gl.NO_ERROR,
+    "gl.texImage2D with NPOT texture at level 0 should succeed");
+
+// Check that generateMipmap fails on NPOT
+gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
+glErrorShouldBe(gl, gl.INVALID_OPERATION,
+    "gl.generateMipmap with NPOT texture should return INVALID_OPERATION");
+
+var loc = gl.getUniformLocation(program, "tex");
+gl.uniform1i(loc, 0);
+
+// Check that nothing is drawn if filtering is not correct for NPOT
+gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
+gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
+gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.REPEAT);
+gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.REPEAT);
+
+wtu.drawQuad(gl);
+wtu.checkCanvas(
+    gl, [0, 0, 0, 255],
+    "NPOT cubemap with TEXTURE_WRAP set to REPEAT should draw with 0,0,0,255");
+glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
+
+gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
+gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
+gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_LINEAR);
+
+wtu.drawQuad(gl);
+wtu.checkCanvas(
+    gl, [0, 0, 0, 255],
+    "NPOT cubemap with TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with 0,0,0,255");
+glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
+
+gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
+
+wtu.drawQuad(gl);
+wtu.checkCanvas(
+    gl, [0, 192, 128, 255],
+    "NPOT cubemap with TEXTURE_MIN_FILTER set to LINEAR should draw.");
+
+// Check that an POT texture on level 0 succeeds
+fillCubeTexture(gl, tex, 4, 4, [0, 192, 128, 255]);
+glErrorShouldBe(gl, gl.NO_ERROR,
+    "gl.texImage2D with POT texture at level 0 should succeed");
+
+gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
+gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
+gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.REPEAT);
+gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.REPEAT);
+
+wtu.drawQuad(gl);
+wtu.checkCanvas(
+    gl, [0, 0, 0, 255],
+    "POT cubemap with TEXTURE_MIN_FILTER set to LINEAR_MIPMAP_LINEAR but no mips draw with 0,0,0,255");
+
+// Check that generateMipmap succeeds on POT
+gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
+glErrorShouldBe(gl, gl.NO_ERROR,
+    "gl.generateMipmap with POT texture should return succeed");
+
+// FIXME: add the test back once the bug is fixed.
+//wtu.drawQuad(gl);
+//wtu.checkCanvas(
+//    gl, [0, 192, 128, 255],
+//    "POT cubemap with TEXTURE_MIN_FILTER set to LINEAR_MIPMAP_LINEAR should draw.");
+
 successfullyParsed = true;
+
+function fillCubeTexture(gl, tex, width, height, color, opt_level) {
+  opt_level = opt_level || 0;
+  var canvas = document.createElement('canvas');
+  canvas.width = width;
+  canvas.height = height;
+  var ctx2d = canvas.getContext('2d');
+  ctx2d.fillStyle = "rgba(" + color[0] + "," + color[1] + "," + color[2] + "," + color[3] + ")";
+  ctx2d.fillRect(0, 0, width, height);
+  gl.bindTexture(gl.TEXTURE_CUBE_MAP, tex);
+  var targets = [
+    gl.TEXTURE_CUBE_MAP_POSITIVE_X,
+    gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
+    gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
+    gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
+    gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
+    gl.TEXTURE_CUBE_MAP_NEGATIVE_Z];
+  for (var tt = 0; tt < targets.length; ++tt) {
+    gl.texImage2D(
+        targets[tt], opt_level, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas);
+  }
+};
+
 </script>
 </body>
 <script src="../../js/resources/js-test-post.js"></script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ca6c965..a1b841a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2010-08-12  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Dimitri Glazkov.
+
+        regression in generateMipmap
+        https://bugs.webkit.org/show_bug.cgi?id=43873
+
+        * html/canvas/WebGLTexture.cpp:
+        (WebCore::WebGLTexture::generateMipmapLevelInfo): should set m_needToUseBlackTexture to false if generateMipmapLevelInfo runs through successfully.
+
 2010-08-12  Ariya Hidayat  <ariya at sencha.com>
 
         Reviewed by David Hyatt.
diff --git a/WebCore/html/canvas/WebGLTexture.cpp b/WebCore/html/canvas/WebGLTexture.cpp
index 2c50bf8..e6dfd0a 100644
--- a/WebCore/html/canvas/WebGLTexture.cpp
+++ b/WebCore/html/canvas/WebGLTexture.cpp
@@ -151,21 +151,22 @@ void WebGLTexture::generateMipmapLevelInfo()
         return;
     if (!canGenerateMipmaps())
         return;
-    if (m_isComplete)
-        return;
-    for (size_t ii = 0; ii < m_info.size(); ++ii) {
-        const LevelInfo& info0 = m_info[ii][0];
-        int width = info0.width;
-        int height = info0.height;
-        int levelCount = computeLevelCount(width, height);
-        for (int level = 1; level < levelCount; ++level) {
-            width = std::max(1, width >> 1);
-            height = std::max(1, height >> 1);
-            LevelInfo& info = m_info[ii][level];
-            info.setInfo(info0.internalFormat, width, height, info0.type);
+    if (!m_isComplete) {
+        for (size_t ii = 0; ii < m_info.size(); ++ii) {
+            const LevelInfo& info0 = m_info[ii][0];
+            int width = info0.width;
+            int height = info0.height;
+            int levelCount = computeLevelCount(width, height);
+            for (int level = 1; level < levelCount; ++level) {
+                width = std::max(1, width >> 1);
+                height = std::max(1, height >> 1);
+                LevelInfo& info = m_info[ii][level];
+                info.setInfo(info0.internalFormat, width, height, info0.type);
+            }
         }
+        m_isComplete = true;
     }
-    m_isComplete = true;
+    m_needToUseBlackTexture = false;
 }
 
 unsigned long WebGLTexture::getInternalFormat() const

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list