Mesa (master): mesa: Don't call GenerateMipmap if Width or Height == 0.

Kenneth Graunke kwg at kemper.freedesktop.org
Sat Jul 23 03:33:25 UTC 2016


Module: Mesa
Branch: master
Commit: f80bea2d8066d228e78a1744d036f69a0265116e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f80bea2d8066d228e78a1744d036f69a0265116e

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Jul 21 22:13:38 2016 -0700

mesa: Don't call GenerateMipmap if Width or Height == 0.

One of the WebGL 2.0 conformance tests is trying to call
glGenerateMipmaps with a width and height of 0.  With the meta
implementation, this generates a "framebuffer attachment incomplete"
status, and falls back to the CPU path, calling MapTextureImage.

Except that there's no actual texture to map, and we assert fail.

There's no work to do in this case.  The test expects it to succeed,
so just return early with no error and avoid hassling the driver.

Cc: mesa-stable at lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96911
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>

---

 src/mesa/main/genmipmap.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c
index c952c4f..97d3c62 100644
--- a/src/mesa/main/genmipmap.c
+++ b/src/mesa/main/genmipmap.c
@@ -149,6 +149,11 @@ _mesa_generate_texture_mipmap(struct gl_context *ctx,
       return;
    }
 
+   if (srcImage->Width == 0 || srcImage->Height == 0) {
+      _mesa_unlock_texture(ctx, texObj);
+      return;
+   }
+
    if (target == GL_TEXTURE_CUBE_MAP) {
       GLuint face;
       for (face = 0; face < 6; face++) {




More information about the mesa-commit mailing list