mesa: Add BeginVertices driver call

Provides notification to the VBO modules prior to the first immediate call.
Pairs with FlushVertices()
This commit is contained in:
Keith Whitwell
2009-03-03 10:41:57 +00:00
parent 050ce17799
commit c64a2b7089
5 changed files with 25 additions and 3 deletions
+6
View File
@@ -947,6 +947,12 @@ struct dd_function_table {
GLuint NeedFlush;
GLuint SaveNeedFlush;
/* Called prior to any of the GLvertexformat functions being
* called. Paired with Driver.FlushVertices().
*/
void (*BeginVertices)( GLcontext *ctx );
/**
* If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
* FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
+6 -3
View File
@@ -54,9 +54,12 @@
ASSERT( tnl->Current ); \
ASSERT( tnl->SwapCount < NUM_VERTEX_FORMAT_ENTRIES ); \
ASSERT( tmp_offset >= 0 ); \
\
/* Save the swapped function's dispatch entry so it can be */ \
/* restored later. */ \
\
if (tnl->SwapCount == 0) \
ctx->Driver.BeginVertices( ctx ); \
\
/* Save the swapped function's dispatch entry so it can be */ \
/* restored later. */ \
tnl->Swapped[tnl->SwapCount].location = & (((_glapi_proc *)ctx->Exec)[tmp_offset]); \
tnl->Swapped[tnl->SwapCount].function = (_glapi_proc)TAG(FUNC); \
tnl->SwapCount++; \
+1
View File
@@ -57,6 +57,7 @@ void vbo_exec_init( GLcontext *ctx )
ctx->Driver.NeedFlush = 0;
ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
ctx->Driver.BeginVertices = vbo_exec_BeginVertices;
ctx->Driver.FlushVertices = vbo_exec_FlushVertices;
vbo_exec_invalidate_state( ctx, ~0 );
+2
View File
@@ -140,6 +140,8 @@ struct vbo_exec_context
void vbo_exec_init( GLcontext *ctx );
void vbo_exec_destroy( GLcontext *ctx );
void vbo_exec_invalidate_state( GLcontext *ctx, GLuint new_state );
void vbo_exec_BeginVertices( GLcontext *ctx );
void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags );
+10
View File
@@ -748,6 +748,12 @@ void vbo_exec_vtx_destroy( struct vbo_exec_context *exec )
}
}
void vbo_exec_BeginVertices( GLcontext *ctx )
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
if (0) _mesa_printf("%s\n", __FUNCTION__);
// vbo_exec_vtx_map( exec );
}
void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags )
{
@@ -765,6 +771,10 @@ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags )
reset_attrfv( exec );
}
/* Need to do this to ensure BeginVertices gets called again:
*/
_mesa_restore_exec_vtxfmt( ctx );
exec->ctx->Driver.NeedFlush = 0;
}