X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fvtxfmt.c;h=c35e4dabe3b34b80ebb9d5060d13cb952c11f01e;hb=aefa1f6ab1d9267b223b06ae205ab34c8e0d7c02;hp=dcb684837c8dda620e49f1ce7f9735014f1576d2;hpb=1585c234e0db4bfb7cd85c4111594f6da1582e6f;p=mesa.git diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index dcb684837c8..c35e4dabe3b 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -27,12 +27,14 @@ */ #include "glheader.h" +#include "api_arrayelt.h" #include "api_loopback.h" #include "context.h" #include "imports.h" #include "mtypes.h" #include "state.h" #include "vtxfmt.h" +#include "eval.h" /* The neutral vertex format. This wraps all tnl module functions, @@ -48,14 +50,19 @@ #define PRE_LOOPBACK( FUNC ) \ { \ GET_CURRENT_CONTEXT(ctx); \ - struct gl_tnl_module *tnl = &(ctx->TnlModule); \ + struct gl_tnl_module * const tnl = &(ctx->TnlModule); \ + const int tmp_offset = _gloffset_ ## FUNC ; \ \ ASSERT( tnl->Current ); \ ASSERT( tnl->SwapCount < NUM_VERTEX_FORMAT_ENTRIES ); \ - \ - /* Save the swapped function's dispatch entry so it can be */ \ - /* restored later. */ \ - tnl->Swapped[tnl->SwapCount].location = (_glapi_proc *) & (GET_ ## FUNC (ctx->Exec)); \ + ASSERT( tmp_offset >= 0 ); \ + \ + 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++; \ \ @@ -70,23 +77,23 @@ #include "vtxfmt_tmp.h" - +/** + * Use the per-vertex functions found in to initialze the given + * API dispatch table. + */ static void install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) { - SET_ArrayElement(tab, vfmt->ArrayElement); + _mesa_install_arrayelt_vtxfmt(tab, vfmt); + SET_Color3f(tab, vfmt->Color3f); SET_Color3fv(tab, vfmt->Color3fv); SET_Color4f(tab, vfmt->Color4f); SET_Color4fv(tab, vfmt->Color4fv); SET_EdgeFlag(tab, vfmt->EdgeFlag); - SET_EdgeFlagv(tab, vfmt->EdgeFlagv); - SET_EvalCoord1f(tab, vfmt->EvalCoord1f); - SET_EvalCoord1fv(tab, vfmt->EvalCoord1fv); - SET_EvalCoord2f(tab, vfmt->EvalCoord2f); - SET_EvalCoord2fv(tab, vfmt->EvalCoord2fv); - SET_EvalPoint1(tab, vfmt->EvalPoint1); - SET_EvalPoint2(tab, vfmt->EvalPoint2); + + _mesa_install_eval_vtxfmt(tab, vfmt); + SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT); SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT); SET_Indexf(tab, vfmt->Indexf); @@ -122,6 +129,16 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_CallLists(tab, vfmt->CallLists); SET_Begin(tab, vfmt->Begin); SET_End(tab, vfmt->End); + SET_Rectf(tab, vfmt->Rectf); + SET_DrawArrays(tab, vfmt->DrawArrays); + SET_DrawElements(tab, vfmt->DrawElements); + SET_DrawRangeElements(tab, vfmt->DrawRangeElements); + SET_MultiDrawElementsEXT(tab, vfmt->MultiDrawElementsEXT); + SET_DrawElementsBaseVertex(tab, vfmt->DrawElementsBaseVertex); + SET_DrawRangeElementsBaseVertex(tab, vfmt->DrawRangeElementsBaseVertex); + SET_MultiDrawElementsBaseVertex(tab, vfmt->MultiDrawElementsBaseVertex); + + /* GL_NV_vertex_program */ SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV); SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV); SET_VertexAttrib2fNV(tab, vfmt->VertexAttrib2fNV); @@ -130,6 +147,7 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_VertexAttrib3fvNV(tab, vfmt->VertexAttrib3fvNV); SET_VertexAttrib4fNV(tab, vfmt->VertexAttrib4fNV); SET_VertexAttrib4fvNV(tab, vfmt->VertexAttrib4fvNV); +#if FEATURE_ARB_vertex_program SET_VertexAttrib1fARB(tab, vfmt->VertexAttrib1fARB); SET_VertexAttrib1fvARB(tab, vfmt->VertexAttrib1fvARB); SET_VertexAttrib2fARB(tab, vfmt->VertexAttrib2fARB); @@ -138,13 +156,7 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_VertexAttrib3fvARB(tab, vfmt->VertexAttrib3fvARB); SET_VertexAttrib4fARB(tab, vfmt->VertexAttrib4fARB); SET_VertexAttrib4fvARB(tab, vfmt->VertexAttrib4fvARB); - SET_Rectf(tab, vfmt->Rectf); - SET_DrawArrays(tab, vfmt->DrawArrays); - SET_DrawElements(tab, vfmt->DrawElements); - SET_DrawRangeElements(tab, vfmt->DrawRangeElements); - SET_EvalMesh1(tab, vfmt->EvalMesh1); - SET_EvalMesh2(tab, vfmt->EvalMesh2); - ASSERT(tab->EvalMesh2); +#endif }