Mesa (master): mesa: Save and restore GL_RASTERIZER_DISCARD state during meta ops.

Paul Berry stereotype441 at kemper.freedesktop.org
Fri Dec 23 09:47:57 PST 2011


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

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Wed Dec 21 10:13:40 2011 -0800

mesa: Save and restore GL_RASTERIZER_DISCARD state during meta ops.

During meta-operations (such as _mesa_meta_GenerateMipmap()), we need
to be able to draw even if GL_RASTERIZER_DISCARD is enabled.  This
patch causes _mesa_meta_begin() to save the state of
GL_RASTERIZER_DISCARD and disable it (so that drawing can be done
during the meta-op), and causes _mesa_meta_end() to restore it.

Fixes piglit test "EXT_transform_feedback/generatemipmap discard" on
i965 Gen6.

Reviewed-by: Brian Paul <brianp at vmare.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/common/meta.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index c5c59eb..144fa12 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -180,6 +180,7 @@ struct save_state
 
    /** Miscellaneous (always disabled) */
    GLboolean Lighting;
+   GLboolean RasterDiscard;
 };
 
 /**
@@ -702,6 +703,9 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
       save->Lighting = ctx->Light.Enabled;
       if (ctx->Light.Enabled)
          _mesa_set_enable(ctx, GL_LIGHTING, GL_FALSE);
+      save->RasterDiscard = ctx->RasterDiscard;
+      if (ctx->RasterDiscard)
+         _mesa_set_enable(ctx, GL_RASTERIZER_DISCARD, GL_FALSE);
    }
 }
 
@@ -981,6 +985,9 @@ _mesa_meta_end(struct gl_context *ctx)
    if (save->Lighting) {
       _mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE);
    }
+   if (save->RasterDiscard) {
+      _mesa_set_enable(ctx, GL_RASTERIZER_DISCARD, GL_TRUE);
+   }
 }
 
 



More information about the mesa-commit mailing list