[Mesa-dev] [PATCH 2/2] vbo: call UpdateState directly when notifying a driver about _NEW_ARRAY

Marek Olšák maraeo at gmail.com
Sun Apr 22 10:50:35 PDT 2012


Core Mesa doesn't need to know about this.

This also removes the hack in recalculate_input_bindings.
---
 src/mesa/vbo/vbo_exec.h       |    3 ++-
 src/mesa/vbo/vbo_exec_array.c |   12 +-----------
 src/mesa/vbo/vbo_exec_draw.c  |    2 +-
 src/mesa/vbo/vbo_save_draw.c  |    2 +-
 4 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h
index 5cdf5ce..be9f3d7 100644
--- a/src/mesa/vbo/vbo_exec.h
+++ b/src/mesa/vbo/vbo_exec.h
@@ -189,7 +189,8 @@ static inline void
 vbo_draw_method(struct vbo_exec_context *exec, enum draw_method method)
 {
    if (exec->last_draw_method != method) {
-      exec->ctx->NewState |= _NEW_ARRAY;
+      struct gl_context *ctx = exec->ctx;
+      ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
       exec->last_draw_method = method;
    }
 }
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 28019af..2dcfb8e 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -438,14 +438,6 @@ recalculate_input_bindings(struct gl_context *ctx)
 	 inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i];
          const_inputs |= VERT_BIT_GENERIC(i);
       }
-
-      /* There is no need to make _NEW_ARRAY dirty here for the TnL program,
-       * because it already takes care of invalidating the state necessary
-       * to revalidate vertex arrays. Not marking the state as dirty also
-       * improves performance (quite significantly in some apps).
-       */
-      if (!ctx->VertexProgram._MaintainTnlProgram)
-         ctx->NewState |= _NEW_ARRAY;
       break;
 
    case VP_NV:
@@ -472,8 +464,6 @@ recalculate_input_bindings(struct gl_context *ctx)
 	 inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i];
          const_inputs |= VERT_BIT_GENERIC(i);
       }
-
-      ctx->NewState |= _NEW_ARRAY;
       break;
 
    case VP_ARB:
@@ -512,11 +502,11 @@ recalculate_input_bindings(struct gl_context *ctx)
       }
 
       inputs[VERT_ATTRIB_GENERIC0] = inputs[0];
-      ctx->NewState |= _NEW_ARRAY;
       break;
    }
 
    _mesa_set_varying_vp_inputs( ctx, VERT_BIT_ALL & (~const_inputs) );
+   ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
 }
 
 
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 5cc6586..da5ca69 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -253,11 +253,11 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
 	 arrays[attr]._MaxElement = count; /* ??? */
 
          varying_inputs |= VERT_BIT(attr);
-         ctx->NewState |= _NEW_ARRAY;
       }
    }
 
    _mesa_set_varying_vp_inputs( ctx, varying_inputs );
+   ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
 }
 
 
diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
index 57186de..88a9a7e 100644
--- a/src/mesa/vbo/vbo_save_draw.c
+++ b/src/mesa/vbo/vbo_save_draw.c
@@ -209,11 +209,11 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
 
 	 buffer_offset += node_attrsz[src] * sizeof(GLfloat);
          varying_inputs |= VERT_BIT(attr);
-         ctx->NewState |= _NEW_ARRAY;
       }
    }
 
    _mesa_set_varying_vp_inputs( ctx, varying_inputs );
+   ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
 }
 
 
-- 
1.7.5.4



More information about the mesa-dev mailing list