Mesa (master): meta: Don't try to glOrtho when the draw buffer isn' t initialized.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Nov 29 02:13:31 UTC 2012


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Nov 26 21:11:14 2012 -0800

meta: Don't try to glOrtho when the draw buffer isn't initialized.

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 at vmware.com>

---

 src/mesa/drivers/common/meta.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 417dbd0..7d58281 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -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) {




More information about the mesa-commit mailing list