From c64a2b708944ec671b1104067245500fcfc6ed94 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 3 Mar 2009 10:41:57 +0000 Subject: mesa: Add BeginVertices driver call Provides notification to the VBO modules prior to the first immediate call. Pairs with FlushVertices() --- src/mesa/main/dd.h | 6 ++++++ src/mesa/main/vtxfmt.c | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 7fb0a211d7..b1e006901b 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -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 diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index 0204979003..1f807dc3dc 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -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++; \ -- cgit v1.2.3