X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fvtxfmt.c;h=8ec6bb3b7cc51d13aa719c5b659bbaf169890ca5;hb=195bbe8ce218533569dde1368d04da0fd229913d;hp=91412f138a5c82d9e6d1b9f59955dc3af7e9ab16;hpb=8fda97afb8b7a03415dbca6d83691d2d6461126c;p=mesa.git diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index 91412f138a5..8ec6bb3b7cc 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -27,73 +27,35 @@ */ #include "glheader.h" -#include "api_loopback.h" +#include "api_arrayelt.h" #include "context.h" #include "imports.h" #include "mtypes.h" -#include "state.h" #include "vtxfmt.h" +#include "eval.h" +#include "dlist.h" +#include "main/dispatch.h" -/* The neutral vertex format. This wraps all tnl module functions, - * verifying that the currently-installed module is valid and then - * installing the function pointers in a lazy fashion. It records the - * function pointers that have been swapped out, which allows a fast - * restoration of the neutral module in almost all cases -- a typical - * app might only require 4-6 functions to be modified from the neutral - * baseline, and only restoring these is certainly preferable to doing - * the entire module's 60 or so function pointers. - */ - -#define PRE_LOOPBACK( FUNC ) \ -{ \ - GET_CURRENT_CONTEXT(ctx); \ - struct gl_tnl_module * const tnl = &(ctx->TnlModule); \ - const int tmp_offset = _gloffset_ ## FUNC ; \ - \ - ASSERT( tnl->Current ); \ - ASSERT( tnl->SwapCount < NUM_VERTEX_FORMAT_ENTRIES ); \ - 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++; \ - \ - if ( 0 ) \ - _mesa_debug(ctx, " swapping gl" #FUNC"...\n" ); \ - \ - /* Install the tnl function pointer. */ \ - SET_ ## FUNC(ctx->Exec, tnl->Current->FUNC); \ -} - -#define TAG(x) neutral_##x -#include "vtxfmt_tmp.h" - +#if FEATURE_beginend /** - * Use the per-vertex functions found in to initialze the given + * Use the per-vertex functions found in to initialoze 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_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); @@ -125,11 +87,15 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_Vertex3fv(tab, vfmt->Vertex3fv); SET_Vertex4f(tab, vfmt->Vertex4f); SET_Vertex4fv(tab, vfmt->Vertex4fv); - SET_CallList(tab, vfmt->CallList); - SET_CallLists(tab, vfmt->CallLists); + + _mesa_install_dlist_vtxfmt(tab, vfmt); /* glCallList / glCallLists */ + SET_Begin(tab, vfmt->Begin); SET_End(tab, vfmt->End); + SET_PrimitiveRestartNV(tab, vfmt->PrimitiveRestartNV); + SET_Rectf(tab, vfmt->Rectf); + SET_DrawArrays(tab, vfmt->DrawArrays); SET_DrawElements(tab, vfmt->DrawElements); SET_DrawRangeElements(tab, vfmt->DrawRangeElements); @@ -137,9 +103,8 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_DrawElementsBaseVertex(tab, vfmt->DrawElementsBaseVertex); SET_DrawRangeElementsBaseVertex(tab, vfmt->DrawRangeElementsBaseVertex); SET_MultiDrawElementsBaseVertex(tab, vfmt->MultiDrawElementsBaseVertex); - SET_EvalMesh1(tab, vfmt->EvalMesh1); - SET_EvalMesh2(tab, vfmt->EvalMesh2); - ASSERT(tab->EvalMesh2); + SET_DrawArraysInstanced(tab, vfmt->DrawArraysInstanced); + SET_DrawElementsInstanced(tab, vfmt->DrawElementsInstanced); /* GL_NV_vertex_program */ SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV); @@ -160,39 +125,47 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_VertexAttrib4fARB(tab, vfmt->VertexAttrib4fARB); SET_VertexAttrib4fvARB(tab, vfmt->VertexAttrib4fvARB); #endif -} - -void _mesa_init_exec_vtxfmt( GLcontext *ctx ) -{ - install_vtxfmt( ctx->Exec, &neutral_vtxfmt ); - ctx->TnlModule.SwapCount = 0; + /* GL_EXT_gpu_shader4 / OpenGL 3.0 */ + SET_VertexAttribI1iEXT(tab, vfmt->VertexAttribI1i); + SET_VertexAttribI2iEXT(tab, vfmt->VertexAttribI2i); + SET_VertexAttribI3iEXT(tab, vfmt->VertexAttribI3i); + SET_VertexAttribI4iEXT(tab, vfmt->VertexAttribI4i); + SET_VertexAttribI2ivEXT(tab, vfmt->VertexAttribI2iv); + SET_VertexAttribI3ivEXT(tab, vfmt->VertexAttribI3iv); + SET_VertexAttribI4ivEXT(tab, vfmt->VertexAttribI4iv); + + SET_VertexAttribI1uiEXT(tab, vfmt->VertexAttribI1ui); + SET_VertexAttribI2uiEXT(tab, vfmt->VertexAttribI2ui); + SET_VertexAttribI3uiEXT(tab, vfmt->VertexAttribI3ui); + SET_VertexAttribI4uiEXT(tab, vfmt->VertexAttribI4ui); + SET_VertexAttribI2uivEXT(tab, vfmt->VertexAttribI2uiv); + SET_VertexAttribI3uivEXT(tab, vfmt->VertexAttribI3uiv); + SET_VertexAttribI4uivEXT(tab, vfmt->VertexAttribI4uiv); } -void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) +/** + * Install per-vertex functions into the API dispatch table for execution. + */ +void +_mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt) { - ctx->TnlModule.Current = vfmt; - _mesa_restore_exec_vtxfmt( ctx ); + if (ctx->API == API_OPENGL) + install_vtxfmt( ctx->Exec, vfmt ); } -void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) +/** + * Install per-vertex functions into the API dispatch table for display + * list compilation. + */ +void +_mesa_install_save_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt) { - install_vtxfmt( ctx->Save, vfmt ); + if (ctx->API == API_OPENGL) + install_vtxfmt( ctx->Save, vfmt ); } -void _mesa_restore_exec_vtxfmt( GLcontext *ctx ) -{ - struct gl_tnl_module *tnl = &(ctx->TnlModule); - GLuint i; - - /* Restore the neutral tnl module wrapper. - */ - for ( i = 0 ; i < tnl->SwapCount ; i++ ) { - *(tnl->Swapped[i].location) = tnl->Swapped[i].function; - } - - tnl->SwapCount = 0; -} +#endif /* FEATURE_beginend */