meta: Don't try to glOrtho when the draw buffer isn't initialized.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 27 Nov 2012 05:11:14 +0000 (21:11 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 29 Nov 2012 02:12:07 +0000 (18:12 -0800)
I ran across this while running a glGenerateMipmap() test.

_meta_GenerateMipmap sets MESA_META_TRANSFORM, which causes
_mesa_meta_begin to try and set a default orthographic projection.

Unfortunately, if the drawbuffer isn't set up, ctx->DrawBuffer->Width
and Height are 0, which just causes an GL_INVALID_VALUE error.

Fixes oglconform's fbo/mipmap.automatic, mipmap.manual, and
mipmap.manualIterateTexTargets.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/drivers/common/meta.c

index 417dbd041e17e07b76248192525e19561675d3f8..7d58281c181905027b077e75a9d491d2a67532a2 100644 (file)
@@ -684,9 +684,11 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
       _mesa_LoadIdentity();
       _mesa_MatrixMode(GL_PROJECTION);
       _mesa_LoadIdentity();
-      _mesa_Ortho(0.0, ctx->DrawBuffer->Width,
-                  0.0, ctx->DrawBuffer->Height,
-                  -1.0, 1.0);
+      if (ctx->DrawBuffer->Initialized) {
+         _mesa_Ortho(0.0, ctx->DrawBuffer->Width,
+                     0.0, ctx->DrawBuffer->Height,
+                     -1.0, 1.0);
+      }
    }
 
    if (state & MESA_META_CLIP) {