Mesa (master): mesa: move gl_array_attrib::NewState to gl_array_object:: NewArrays

Brian Paul brianp at kemper.freedesktop.org
Fri Apr 20 13:34:50 UTC 2012


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Apr 18 10:47:10 2012 -0600

mesa: move gl_array_attrib::NewState to gl_array_object::NewArrays

The field wasn't actually used before and it's not used now either.
But this is a more logical place for it and will hopefully allow
doing smarter draw/array validation (per array object) in the future.

Reviewed-by: Mathias Fröhlich <Mathias.Froehlich at web.de>

---

 src/mesa/main/arrayobj.c |    1 -
 src/mesa/main/attrib.c   |    7 -------
 src/mesa/main/enable.c   |    3 ++-
 src/mesa/main/mtypes.h   |    5 +++--
 src/mesa/main/state.c    |    2 +-
 src/mesa/main/varray.c   |   10 ++++------
 6 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index c7584d9..4c50066 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -389,7 +389,6 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
    }
 
    ctx->NewState |= _NEW_ARRAY;
-   ctx->Array.NewState |= VERT_BIT_ALL;
    _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, newObj);
 
    /* Pass BindVertexArray call to device driver */
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 9b90b05..b114ec9 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1447,13 +1447,6 @@ restore_array_attrib(struct gl_context *ctx,
        || _mesa_IsBufferARB(src->ArrayObj->ElementArrayBufferObj->Name))
       _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
 			  src->ArrayObj->ElementArrayBufferObj->Name);
-
-   /* FIXME: Should some bits in ctx->Array->NewState also be set
-    * FIXME: here?  It seems like it should be set to inclusive-or
-    * FIXME: of the old ArrayObj->_Enabled and the new _Enabled.
-    * ... just do it.
-    */
-   dest->NewState |= src->ArrayObj->_Enabled | dest->ArrayObj->_Enabled;
 }
 
 /**
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index f6d37fe..d0b4625 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -142,7 +142,6 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
       return;
 
    FLUSH_VERTICES(ctx, _NEW_ARRAY);
-   ctx->Array.NewState |= flag;
 
    _ae_invalidate_state(ctx, _NEW_ARRAY);
 
@@ -153,6 +152,8 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
    else
       arrayObj->_Enabled &= ~flag;
 
+   arrayObj->NewArrays |= flag;
+
    if (ctx->Driver.Enable) {
       ctx->Driver.Enable( ctx, cap, state );
    }
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index f277307..2b709de 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1599,6 +1599,9 @@ struct gl_array_object
    /** Mask of VERT_BIT_* values indicating which arrays are enabled */
    GLbitfield64 _Enabled;
 
+   /** Mask of VERT_BIT_* values indicating changed/dirty arrays */
+   GLbitfield64 NewArrays;
+
    /**
     * Min of all enabled arrays' _MaxElement.  When arrays reside inside VBOs
     * we can determine the max legal (in bounds) glDrawElements array index.
@@ -1631,8 +1634,6 @@ struct gl_array_attrib
    GLboolean PrimitiveRestart;
    GLuint RestartIndex;
 
-   GLbitfield64 NewState;		/**< mask of VERT_BIT_* values */
-
    /* GL_ARB_vertex_buffer_object */
    struct gl_buffer_object *ArrayBufferObj;
 };
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index f82e4a2..db0cc30 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -580,7 +580,7 @@ _mesa_update_state_locked( struct gl_context *ctx )
    new_state = ctx->NewState | new_prog_state;
    ctx->NewState = 0;
    ctx->Driver.UpdateState(ctx, new_state);
-   ctx->Array.NewState = 0;
+   ctx->Array.ArrayObj->NewArrays = 0x0;
 }
 
 
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 1c14843..efa63b0 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -221,7 +221,7 @@ update_array(struct gl_context *ctx,
                                  ctx->Array.ArrayBufferObj);
 
    ctx->NewState |= _NEW_ARRAY;
-   ctx->Array.NewState |= VERT_BIT(attrib);
+   ctx->Array.ArrayObj->NewArrays |= VERT_BIT(attrib);
 }
 
 
@@ -502,7 +502,7 @@ _mesa_EnableVertexAttribArrayARB(GLuint index)
       FLUSH_VERTICES(ctx, _NEW_ARRAY);
       arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE;
       arrayObj->_Enabled |= VERT_BIT_GENERIC(index);
-      ctx->Array.NewState |= VERT_BIT_GENERIC(index);
+      arrayObj->NewArrays |= VERT_BIT_GENERIC(index);
    }
 }
 
@@ -529,7 +529,7 @@ _mesa_DisableVertexAttribArrayARB(GLuint index)
       FLUSH_VERTICES(ctx, _NEW_ARRAY);
       arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_FALSE;
       arrayObj->_Enabled &= ~VERT_BIT_GENERIC(index);
-      ctx->Array.NewState |= VERT_BIT_GENERIC(index);
+      arrayObj->NewArrays |= VERT_BIT_GENERIC(index);
    }
 }
 
@@ -1001,7 +1001,6 @@ _mesa_LockArraysEXT(GLint first, GLsizei count)
    ctx->Array.LockCount = count;
 
    ctx->NewState |= _NEW_ARRAY;
-   ctx->Array.NewState |= VERT_BIT_ALL;
 }
 
 
@@ -1022,7 +1021,6 @@ _mesa_UnlockArraysEXT( void )
    ctx->Array.LockFirst = 0;
    ctx->Array.LockCount = 0;
    ctx->NewState |= _NEW_ARRAY;
-   ctx->Array.NewState |= VERT_BIT_ALL;
 }
 
 
@@ -1138,7 +1136,7 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
    if (array->InstanceDivisor != divisor) {
       FLUSH_VERTICES(ctx, _NEW_ARRAY);
       array->InstanceDivisor = divisor;
-      ctx->Array.NewState |= VERT_BIT(VERT_ATTRIB_GENERIC(index));
+      ctx->Array.ArrayObj->NewArrays |= VERT_BIT(VERT_ATTRIB_GENERIC(index));
    }
 }
 




More information about the mesa-commit mailing list