Mesa (master): meta: Add flag MESA_META_SELECT_FEEDBACK

Chad Versace chadversary at kemper.freedesktop.org
Tue Oct 18 11:44:12 PDT 2011


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

Author: Chad Versace <chad at chad-versace.us>
Date:   Fri Oct  7 15:07:00 2011 -0700

meta: Add flag MESA_META_SELECT_FEEDBACK

If this flag is set, then _mesa_meta_begin/end will save/restore the state of
GL_SELECT and GL_FEEDBACK render modes.

Intel's future buffer resolve meta-ops will require this, since buffer resolves
may occur when the GL_RENDER_MODE is GL_SELECT.

Reviewed-by: Brian Paul <brianp at vmware.com>
Signed-off-by: Chad Versace <chad at chad-versace.us>

---

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

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 36bd295..6958ddf 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -44,6 +44,7 @@
 #include "main/depth.h"
 #include "main/enable.h"
 #include "main/fbobject.h"
+#include "main/feedback.h"
 #include "main/formats.h"
 #include "main/image.h"
 #include "main/macros.h"
@@ -172,6 +173,11 @@ struct save_state
    struct gl_query_object *CondRenderQuery;
    GLenum CondRenderMode;
 
+   /** MESA_META_SELECT_FEEDBACK */
+   GLenum RenderMode;
+   struct gl_selection Select;
+   struct gl_feedback Feedback;
+
    /** Miscellaneous (always disabled) */
    GLboolean Lighting;
 };
@@ -608,6 +614,17 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
 	 _mesa_EndConditionalRender();
    }
 
+   if (state & MESA_META_SELECT_FEEDBACK) {
+      save->RenderMode = ctx->RenderMode;
+      if (ctx->RenderMode == GL_SELECT) {
+	 save->Select = ctx->Select; /* struct copy */
+	 _mesa_RenderMode(GL_RENDER);
+      } else if (ctx->RenderMode == GL_FEEDBACK) {
+	 save->Feedback = ctx->Feedback; /* struct copy */
+	 _mesa_RenderMode(GL_RENDER);
+      }
+   }
+
    /* misc */
    {
       save->Lighting = ctx->Light.Enabled;
@@ -893,6 +910,16 @@ _mesa_meta_end(struct gl_context *ctx)
 				      save->CondRenderMode);
    }
 
+   if (state & MESA_META_SELECT_FEEDBACK) {
+      if (save->RenderMode == GL_SELECT) {
+	 _mesa_RenderMode(GL_SELECT);
+	 ctx->Select = save->Select;
+      } else if (save->RenderMode == GL_FEEDBACK) {
+	 _mesa_RenderMode(GL_FEEDBACK);
+	 ctx->Feedback = save->Feedback;
+      }
+   }
+
    /* misc */
    if (save->Lighting) {
       _mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE);
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 7ec5683..e0435a8 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -54,6 +54,7 @@
 #define MESA_META_CLAMP_VERTEX_COLOR    0x10000
 #define MESA_META_CONDITIONAL_RENDER    0x20000
 #define MESA_META_CLIP                  0x40000
+#define MESA_META_SELECT_FEEDBACK       0x80000
 /**\}*/
 
 extern void



More information about the mesa-commit mailing list