[Mesa-dev] [PATCH 07/14] mesa: remove _NEW_PACKUNPACK

Marek Olšák maraeo at gmail.com
Mon Apr 15 06:17:32 PDT 2013


No driver checks the flag. Nobody uses it.

I also removed the FLUSH_VERTICES calls, because PixelStorei has no effect
on rendering.
---
 src/mesa/drivers/dri/i965/brw_state_upload.c |    1 -
 src/mesa/main/attrib.c                       |    2 --
 src/mesa/main/debug.c                        |    3 +--
 src/mesa/main/mtypes.h                       |    2 +-
 src/mesa/main/pixelstore.c                   |   17 -----------------
 src/mesa/state_tracker/st_atom.c             |    6 +-----
 6 files changed, 3 insertions(+), 28 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 083b619..d40ff66 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -335,7 +335,6 @@ static struct dirty_bit_map mesa_bits[] = {
    DEFINE_BIT(_NEW_TEXTURE),
    DEFINE_BIT(_NEW_TRANSFORM),
    DEFINE_BIT(_NEW_VIEWPORT),
-   DEFINE_BIT(_NEW_PACKUNPACK),
    DEFINE_BIT(_NEW_ARRAY),
    DEFINE_BIT(_NEW_RENDERMODE),
    DEFINE_BIT(_NEW_BUFFERS),
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index a672845..fa7b862 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1578,7 +1578,6 @@ _mesa_PopClientAttrib(void)
                copy_pixelstore(ctx, &ctx->Pack, store);
                _mesa_reference_buffer_object(ctx, &store->BufferObj, NULL);
             }
-	    ctx->NewState |= _NEW_PACKUNPACK;
             break;
          case GL_CLIENT_UNPACK_BIT:
             {
@@ -1587,7 +1586,6 @@ _mesa_PopClientAttrib(void)
                copy_pixelstore(ctx, &ctx->Unpack, store);
                _mesa_reference_buffer_object(ctx, &store->BufferObj, NULL);
             }
-	    ctx->NewState |= _NEW_PACKUNPACK;
             break;
          case GL_CLIENT_VERTEX_ARRAY_BIT: {
 	    struct gl_array_attrib * attr =
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index aee8ae2..98d6a5e 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -66,7 +66,7 @@ void
 _mesa_print_state( const char *msg, GLuint state )
 {
    _mesa_debug(NULL,
-	   "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+	   "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
 	   msg,
 	   state,
 	   (state & _NEW_MODELVIEW)       ? "ctx->ModelView, " : "",
@@ -88,7 +88,6 @@ _mesa_print_state( const char *msg, GLuint state )
 	   (state & _NEW_TEXTURE)         ? "ctx->Texture, " : "",
 	   (state & _NEW_TRANSFORM)       ? "ctx->Transform, " : "",
 	   (state & _NEW_VIEWPORT)        ? "ctx->Viewport, " : "",
-	   (state & _NEW_PACKUNPACK)      ? "ctx->Pack/Unpack, " : "",
 	   (state & _NEW_ARRAY)           ? "ctx->Array, " : "",
 	   (state & _NEW_RENDERMODE)      ? "ctx->RenderMode, " : "",
 	   (state & _NEW_BUFFERS)         ? "ctx->Visual, ctx->DrawBuffer,, " : "");
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 87ed89f..3a58a61 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3138,7 +3138,7 @@ struct gl_matrix_stack
 #define _NEW_TEXTURE           (1 << 16)  /**< gl_context::Texture */
 #define _NEW_TRANSFORM         (1 << 17)  /**< gl_context::Transform */
 #define _NEW_VIEWPORT          (1 << 18)  /**< gl_context::Viewport */
-#define _NEW_PACKUNPACK        (1 << 19)  /**< gl_context::Pack, Unpack */
+/* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */
 #define _NEW_ARRAY             (1 << 20)  /**< gl_context::Array */
 #define _NEW_RENDERMODE        (1 << 21)  /**< gl_context::RenderMode, etc */
 #define _NEW_BUFFERS           (1 << 22)  /**< gl_context::Visual, DrawBuffer, */
diff --git a/src/mesa/main/pixelstore.c b/src/mesa/main/pixelstore.c
index 01068e8..bb31d06 100644
--- a/src/mesa/main/pixelstore.c
+++ b/src/mesa/main/pixelstore.c
@@ -48,7 +48,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
             goto invalid_enum_error;
 	 if (param == (GLint)ctx->Pack.SwapBytes)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
          ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE;
 	 break;
       case GL_PACK_LSB_FIRST:
@@ -56,7 +55,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
             goto invalid_enum_error;
 	 if (param == (GLint)ctx->Pack.LsbFirst)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
          ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE;
 	 break;
       case GL_PACK_ROW_LENGTH:
@@ -68,7 +66,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	 }
 	 if (ctx->Pack.RowLength == param)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Pack.RowLength = param;
 	 break;
       case GL_PACK_IMAGE_HEIGHT:
@@ -80,7 +77,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	 }
 	 if (ctx->Pack.ImageHeight == param)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Pack.ImageHeight = param;
          break;
       case GL_PACK_SKIP_PIXELS:
@@ -92,7 +88,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	 }
 	 if (ctx->Pack.SkipPixels == param)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Pack.SkipPixels = param;
 	 break;
       case GL_PACK_SKIP_ROWS:
@@ -104,7 +99,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	 }
 	 if (ctx->Pack.SkipRows == param)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Pack.SkipRows = param;
 	 break;
       case GL_PACK_SKIP_IMAGES:
@@ -116,7 +110,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	 }
 	 if (ctx->Pack.SkipImages == param)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Pack.SkipImages = param;
 	 break;
       case GL_PACK_ALIGNMENT:
@@ -126,7 +119,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	 }
 	 if (ctx->Pack.Alignment == param)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Pack.Alignment = param;
 	 break;
       case GL_PACK_INVERT_MESA:
@@ -138,7 +130,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
          }
          if (ctx->Pack.Invert == param)
             return;
-         FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
          ctx->Pack.Invert = param;
          break;
 
@@ -149,7 +140,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	    return;
 	 if ((GLint)ctx->Unpack.SwapBytes == param)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE;
          break;
       case GL_UNPACK_LSB_FIRST:
@@ -159,7 +149,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	    return;
 	 if ((GLint)ctx->Unpack.LsbFirst == param)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE;
 	 break;
       case GL_UNPACK_ROW_LENGTH:
@@ -171,7 +160,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	 }
 	 if (ctx->Unpack.RowLength == param)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Unpack.RowLength = param;
 	 break;
       case GL_UNPACK_IMAGE_HEIGHT:
@@ -184,7 +172,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	 if (ctx->Unpack.ImageHeight == param)
 	    return;
 
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Unpack.ImageHeight = param;
          break;
       case GL_UNPACK_SKIP_PIXELS:
@@ -196,7 +183,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	 }
 	 if (ctx->Unpack.SkipPixels == param)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Unpack.SkipPixels = param;
 	 break;
       case GL_UNPACK_SKIP_ROWS:
@@ -208,7 +194,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	 }
 	 if (ctx->Unpack.SkipRows == param)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Unpack.SkipRows = param;
 	 break;
       case GL_UNPACK_SKIP_IMAGES:
@@ -220,7 +205,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	 }
 	 if (ctx->Unpack.SkipImages == param)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Unpack.SkipImages = param;
 	 break;
       case GL_UNPACK_ALIGNMENT:
@@ -230,7 +214,6 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 	 }
 	 if (ctx->Unpack.Alignment == param)
 	    return;
-	 FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
 	 ctx->Unpack.Alignment = param;
 	 break;
       default:
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 32bcc26..89c4ffb 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -160,11 +160,7 @@ void st_validate_state( struct st_context *st )
 
    check_attrib_edgeflag(st);
 
-   /* The bitmap cache is immune to pixel unpack changes.
-    * Note that GLUT makes several calls to glPixelStore for each
-    * bitmap char it draws so this is an important check.
-    */
-   if (state->mesa & ~_NEW_PACKUNPACK)
+   if (state->mesa)
       st_flush_bitmap_cache(st);
 
    check_program_state( st );
-- 
1.7.10.4



More information about the mesa-dev mailing list