[Mesa-dev] [PATCH 1/2] meta: Also save/restore clip planes for GLSL.

Eric Anholt eric at anholt.net
Fri Jul 22 11:15:13 PDT 2011


Fixes user-clip on 965 with 3D clears enabled.  I created a separate
flag because I wanted to avoid the overhead of the matrix operations
in this path.
---
 src/mesa/drivers/common/meta.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 887118b..f5973f5 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -97,6 +97,7 @@
 #define META_CLAMP_FRAGMENT_COLOR 0x8000
 #define META_CLAMP_VERTEX_COLOR 0x10000
 #define META_CONDITIONAL_RENDER 0x20000
+#define META_CLIP          0x40000
 /*@}*/
 
 
@@ -165,6 +166,8 @@ struct save_state
    GLfloat ModelviewMatrix[16];
    GLfloat ProjectionMatrix[16];
    GLfloat TextureMatrix[16];
+
+   /** META_CLIP */
    GLbitfield ClipPlanesEnabled;
 
    /** META_TEXTURE */
@@ -547,6 +550,9 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
       _mesa_Ortho(0.0, ctx->DrawBuffer->Width,
                   0.0, ctx->DrawBuffer->Height,
                   -1.0, 1.0);
+   }
+
+   if (state & META_CLIP) {
       save->ClipPlanesEnabled = ctx->Transform.ClipPlanesEnabled;
       if (ctx->Transform.ClipPlanesEnabled) {
          GLuint i;
@@ -846,7 +852,9 @@ _mesa_meta_end(struct gl_context *ctx)
       _mesa_LoadMatrixf(save->ProjectionMatrix);
 
       _mesa_MatrixMode(save->MatrixMode);
+   }
 
+   if (state & META_CLIP) {
       if (save->ClipPlanesEnabled) {
          GLuint i;
          for (i = 0; i < ctx->Const.MaxClipPlanes; i++) {
@@ -1669,6 +1677,7 @@ _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers)
 	       META_STENCIL_TEST |
 	       META_VERTEX |
 	       META_VIEWPORT |
+	       META_CLIP |
 	       META_CLAMP_FRAGMENT_COLOR);
 
    if (!(buffers & BUFFER_BITS_COLOR)) {
@@ -1783,6 +1792,7 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
                           META_SHADER |
                           META_TEXTURE |
                           META_TRANSFORM |
+                          META_CLIP |
                           META_VERTEX |
                           META_VIEWPORT));
 
@@ -2104,6 +2114,7 @@ _mesa_meta_DrawPixels(struct gl_context *ctx,
                           META_SHADER |
                           META_TEXTURE |
                           META_TRANSFORM |
+                          META_CLIP |
                           META_VERTEX |
                           META_VIEWPORT |
 			  META_CLAMP_FRAGMENT_COLOR |
@@ -2313,6 +2324,7 @@ _mesa_meta_Bitmap(struct gl_context *ctx,
                           META_SHADER |
                           META_TEXTURE |
                           META_TRANSFORM |
+                          META_CLIP |
                           META_VERTEX |
                           META_VIEWPORT));
 
-- 
1.7.5.4



More information about the mesa-dev mailing list