From 80630d1fed6cd32e75f5e97e2cd27509be21d093 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 8 Sep 2009 14:32:08 +0800 Subject: mesa/main: New feature FEATURE_arrayelt. This allows the removal of AEcontext. --- src/mesa/main/vtxfmt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mesa/main/vtxfmt.c') diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index 91412f138a..de9479d6b0 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -27,6 +27,7 @@ */ #include "glheader.h" +#include "api_arrayelt.h" #include "api_loopback.h" #include "context.h" #include "imports.h" @@ -82,7 +83,8 @@ 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); -- cgit v1.2.3 From aefa1f6ab1d9267b223b06ae205ab34c8e0d7c02 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 8 Sep 2009 10:25:22 +0800 Subject: mesa/main: Make FEATURE_evaluators follow feature conventions. As shown in mfeatures.h, this allows users of eval.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 18 ++-------- src/mesa/main/api_noop.c | 14 +++----- src/mesa/main/context.c | 6 ---- src/mesa/main/dlist.c | 19 ++++------ src/mesa/main/eval.c | 61 ++++++++++++++++++++++++++------ src/mesa/main/eval.h | 84 ++++++++++++++++++--------------------------- src/mesa/main/vtxfmt.c | 13 +++---- src/mesa/vbo/vbo_exec_api.c | 19 +++++----- src/mesa/vbo/vbo_save_api.c | 11 ++---- 9 files changed, 114 insertions(+), 131 deletions(-) (limited to 'src/mesa/main/vtxfmt.c') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 3fe10f1207..fc4de3c14c 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -60,9 +60,7 @@ #include "drawpix.h" #include "rastpos.h" #include "enable.h" -#if FEATURE_evaluators #include "eval.h" -#endif #include "get.h" #include "feedback.h" #include "fog.h" @@ -238,19 +236,9 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_Lighti(exec, _mesa_Lighti); SET_Lightiv(exec, _mesa_Lightiv); SET_LoadMatrixd(exec, _mesa_LoadMatrixd); -#if FEATURE_evaluators - SET_GetMapdv(exec, _mesa_GetMapdv); - SET_GetMapfv(exec, _mesa_GetMapfv); - SET_GetMapiv(exec, _mesa_GetMapiv); - SET_Map1d(exec, _mesa_Map1d); - SET_Map1f(exec, _mesa_Map1f); - SET_Map2d(exec, _mesa_Map2d); - SET_Map2f(exec, _mesa_Map2f); - SET_MapGrid1d(exec, _mesa_MapGrid1d); - SET_MapGrid1f(exec, _mesa_MapGrid1f); - SET_MapGrid2d(exec, _mesa_MapGrid2d); - SET_MapGrid2f(exec, _mesa_MapGrid2f); -#endif + + _mesa_init_eval_dispatch(exec); + SET_MultMatrixd(exec, _mesa_MultMatrixd); _mesa_init_pixel_dispatch(exec); diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 162b685b02..23c52177d8 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -33,6 +33,7 @@ #if FEATURE_dlist #include "dlist.h" #endif +#include "eval.h" #include "glapi/dispatch.h" @@ -1005,14 +1006,9 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) vfmt->Color4fv = _mesa_noop_Color4fv; vfmt->EdgeFlag = _mesa_noop_EdgeFlag; vfmt->End = _mesa_noop_End; -#if FEATURE_evaluators - vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f; - vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv; - vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f; - vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv; - vfmt->EvalPoint1 = _mesa_noop_EvalPoint1; - vfmt->EvalPoint2 = _mesa_noop_EvalPoint2; -#endif + + _MESA_INIT_EVAL_VTXFMT(vfmt, _mesa_noop_); + vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT; vfmt->Indexf = _mesa_noop_Indexf; @@ -1070,6 +1066,4 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) vfmt->DrawElementsBaseVertex = _mesa_noop_DrawElementsBaseVertex; vfmt->DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex; vfmt->MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex; - vfmt->EvalMesh1 = _mesa_noop_EvalMesh1; - vfmt->EvalMesh2 = _mesa_noop_EvalMesh2; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 6994f98504..03ee7fb04d 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -94,9 +94,7 @@ #if FEATURE_dlist #include "dlist.h" #endif -#if FEATURE_evaluators #include "eval.h" -#endif #include "enums.h" #include "extensions.h" #include "fbobject.h" @@ -675,9 +673,7 @@ init_attrib_groups(GLcontext *ctx) #if FEATURE_dlist _mesa_init_display_list( ctx ); #endif -#if FEATURE_evaluators _mesa_init_eval( ctx ); -#endif _mesa_init_fbobjects( ctx ); _mesa_init_feedback( ctx ); _mesa_init_fog( ctx ); @@ -977,9 +973,7 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_attrib_data(ctx); _mesa_free_lighting_data( ctx ); -#if FEATURE_evaluators _mesa_free_eval_data( ctx ); -#endif _mesa_free_texture_data( ctx ); _mesa_free_matrix_data( ctx ); _mesa_free_viewport_data( ctx ); diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 35f9a3cf03..189743e5f5 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1876,7 +1876,7 @@ save_Enable(GLenum cap) static void GLAPIENTRY -_mesa_save_EvalMesh1(GLenum mode, GLint i1, GLint i2) +save_EvalMesh1(GLenum mode, GLint i1, GLint i2) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1894,7 +1894,7 @@ _mesa_save_EvalMesh1(GLenum mode, GLint i1, GLint i2) static void GLAPIENTRY -_mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) +save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -8451,8 +8451,8 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_DrawPixels(table, save_DrawPixels); SET_Enable(table, save_Enable); SET_EndList(table, _mesa_EndList); - SET_EvalMesh1(table, _mesa_save_EvalMesh1); - SET_EvalMesh2(table, _mesa_save_EvalMesh2); + SET_EvalMesh1(table, save_EvalMesh1); + SET_EvalMesh2(table, save_EvalMesh2); SET_Finish(table, exec_Finish); SET_Flush(table, exec_Flush); SET_Fogf(table, save_Fogf); @@ -9302,12 +9302,9 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt) vfmt->Color4fv = save_Color4fv; vfmt->EdgeFlag = save_EdgeFlag; vfmt->End = save_End; - vfmt->EvalCoord1f = save_EvalCoord1f; - vfmt->EvalCoord1fv = save_EvalCoord1fv; - vfmt->EvalCoord2f = save_EvalCoord2f; - vfmt->EvalCoord2fv = save_EvalCoord2fv; - vfmt->EvalPoint1 = save_EvalPoint1; - vfmt->EvalPoint2 = save_EvalPoint2; + + _MESA_INIT_EVAL_VTXFMT(vfmt, save_); + vfmt->FogCoordfEXT = save_FogCoordfEXT; vfmt->FogCoordfvEXT = save_FogCoordfvEXT; vfmt->Indexf = save_Indexf; @@ -9356,8 +9353,6 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt) vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB; vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB; - vfmt->EvalMesh1 = _mesa_save_EvalMesh1; - vfmt->EvalMesh2 = _mesa_save_EvalMesh2; vfmt->Rectf = save_Rectf; /* The driver is required to implement these as diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c index 3f89f9c1ea..95d6e23187 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -44,6 +44,10 @@ #include "eval.h" #include "macros.h" #include "mtypes.h" +#include "glapi/dispatch.h" + + +#if FEATURE_evaluators /* @@ -417,7 +421,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, -void GLAPIENTRY +static void GLAPIENTRY _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points ) { @@ -425,7 +429,7 @@ _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, } -void GLAPIENTRY +static void GLAPIENTRY _mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points ) { @@ -516,7 +520,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, } -void GLAPIENTRY +static void GLAPIENTRY _mesa_Map2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, @@ -527,7 +531,7 @@ _mesa_Map2f( GLenum target, } -void GLAPIENTRY +static void GLAPIENTRY _mesa_Map2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, @@ -539,7 +543,7 @@ _mesa_Map2d( GLenum target, -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) { GET_CURRENT_CONTEXT(ctx); @@ -604,7 +608,7 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); @@ -669,7 +673,7 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) { GET_CURRENT_CONTEXT(ctx); @@ -735,7 +739,7 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) -void GLAPIENTRY +static void GLAPIENTRY _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) { GET_CURRENT_CONTEXT(ctx); @@ -753,14 +757,14 @@ _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ) { _mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 ); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) { @@ -788,7 +792,7 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, } -void GLAPIENTRY +static void GLAPIENTRY _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ) { @@ -797,6 +801,41 @@ _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, } +void +_mesa_install_eval_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt) +{ + SET_EvalCoord1f(disp, vfmt->EvalCoord1f); + SET_EvalCoord1fv(disp, vfmt->EvalCoord1fv); + SET_EvalCoord2f(disp, vfmt->EvalCoord2f); + SET_EvalCoord2fv(disp, vfmt->EvalCoord2fv); + SET_EvalPoint1(disp, vfmt->EvalPoint1); + SET_EvalPoint2(disp, vfmt->EvalPoint2); + + SET_EvalMesh1(disp, vfmt->EvalMesh1); + SET_EvalMesh2(disp, vfmt->EvalMesh2); +} + + +void +_mesa_init_eval_dispatch(struct _glapi_table *disp) +{ + SET_GetMapdv(disp, _mesa_GetMapdv); + SET_GetMapfv(disp, _mesa_GetMapfv); + SET_GetMapiv(disp, _mesa_GetMapiv); + SET_Map1d(disp, _mesa_Map1d); + SET_Map1f(disp, _mesa_Map1f); + SET_Map2d(disp, _mesa_Map2d); + SET_Map2f(disp, _mesa_Map2f); + SET_MapGrid1d(disp, _mesa_MapGrid1d); + SET_MapGrid1f(disp, _mesa_MapGrid1f); + SET_MapGrid2d(disp, _mesa_MapGrid2d); + SET_MapGrid2f(disp, _mesa_MapGrid2f); +} + + +#endif /* FEATURE_evaluators */ + /**********************************************************************/ /***** Initialization *****/ diff --git a/src/mesa/main/eval.h b/src/mesa/main/eval.h index b3ff0a96f8..ffd1bab76d 100644 --- a/src/mesa/main/eval.h +++ b/src/mesa/main/eval.h @@ -37,13 +37,22 @@ #define EVAL_H -#include "mtypes.h" +#include "main/mtypes.h" -#if _HAVE_FULL_GL -extern void _mesa_init_eval( GLcontext *ctx ); -extern void _mesa_free_eval_data( GLcontext *ctx ); +#if FEATURE_evaluators +#define _MESA_INIT_EVAL_VTXFMT(vfmt, impl) \ + do { \ + (vfmt)->EvalCoord1f = impl ## EvalCoord1f; \ + (vfmt)->EvalCoord1fv = impl ## EvalCoord1fv; \ + (vfmt)->EvalCoord2f = impl ## EvalCoord2f; \ + (vfmt)->EvalCoord2fv = impl ## EvalCoord2fv; \ + (vfmt)->EvalPoint1 = impl ## EvalPoint1; \ + (vfmt)->EvalPoint2 = impl ## EvalPoint2; \ + (vfmt)->EvalMesh1 = impl ## EvalMesh1; \ + (vfmt)->EvalMesh2 = impl ## EvalMesh2; \ + } while (0) extern GLuint _mesa_evaluator_components( GLenum target ); @@ -70,59 +79,32 @@ extern GLfloat *_mesa_copy_map_points2d(GLenum target, GLint vstride, GLint vorder, const GLdouble *points ); +extern void +_mesa_install_eval_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt); +extern void +_mesa_init_eval_dispatch(struct _glapi_table *disp); -extern void GLAPIENTRY -_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, - GLint order, const GLfloat *points ); - -extern void GLAPIENTRY -_mesa_Map2f( GLenum target, - GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, - GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, - const GLfloat *points ); - -extern void GLAPIENTRY -_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, - GLint order, const GLdouble *points ); - -extern void GLAPIENTRY -_mesa_Map2d( GLenum target, - GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, - GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, - const GLdouble *points ); - -extern void GLAPIENTRY -_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); +#else /* FEATURE_evaluators */ -extern void GLAPIENTRY -_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); +#define _MESA_INIT_EVAL_VTXFMT(vfmt, impl) do { } while (0) -extern void GLAPIENTRY -_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, - GLint vn, GLfloat v1, GLfloat v2 ); +static INLINE void +_mesa_install_eval_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt) +{ +} -extern void GLAPIENTRY -_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, - GLint vn, GLdouble v1, GLdouble v2 ); +static INLINE void +_mesa_init_eval_dispatch(struct _glapi_table *disp) +{ +} -extern void GLAPIENTRY -_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ); +#endif /* FEATURE_evaluators */ -extern void GLAPIENTRY -_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ); - -extern void GLAPIENTRY -_mesa_GetMapiv( GLenum target, GLenum query, GLint *v ); - -#else - -/** No-op */ -#define _mesa_init_eval( c ) ((void)0) - -/** No-op */ -#define _mesa_free_eval_data( c ) ((void)0) +extern void _mesa_init_eval( GLcontext *ctx ); +extern void _mesa_free_eval_data( GLcontext *ctx ); -#endif -#endif +#endif /* EVAL_H */ diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index de9479d6b0..c35e4dabe3 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -34,6 +34,7 @@ #include "mtypes.h" #include "state.h" #include "vtxfmt.h" +#include "eval.h" /* The neutral vertex format. This wraps all tnl module functions, @@ -90,12 +91,9 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) 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); @@ -139,9 +137,6 @@ 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); /* GL_NV_vertex_program */ SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV); diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 238beee030..cfe8be77e5 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -38,6 +38,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #if FEATURE_dlist #include "main/dlist.h" #endif +#include "main/eval.h" #include "main/state.h" #include "main/light.h" #include "main/api_arrayelt.h" @@ -392,6 +393,7 @@ do { \ +#if FEATURE_evaluators /* Eval */ static void GLAPIENTRY vbo_exec_EvalCoord1f( GLfloat u ) @@ -485,6 +487,12 @@ static void GLAPIENTRY vbo_exec_EvalPoint2( GLint i, GLint j ) vbo_exec_EvalCoord2f( u, v ); } +/* use noop eval mesh */ +#define vbo_exec_EvalMesh1 _mesa_noop_EvalMesh1 +#define vbo_exec_EvalMesh2 _mesa_noop_EvalMesh2 + +#endif /* FEATURE_evaluators */ + /* Build a list of primitives on the fly. Keep * ctx->Driver.CurrentExecPrimitive uptodate as well. @@ -565,17 +573,10 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) vfmt->CallLists = _mesa_CallLists; #endif vfmt->End = vbo_exec_End; - vfmt->EvalCoord1f = vbo_exec_EvalCoord1f; - vfmt->EvalCoord1fv = vbo_exec_EvalCoord1fv; - vfmt->EvalCoord2f = vbo_exec_EvalCoord2f; - vfmt->EvalCoord2fv = vbo_exec_EvalCoord2fv; - vfmt->EvalPoint1 = vbo_exec_EvalPoint1; - vfmt->EvalPoint2 = vbo_exec_EvalPoint2; - vfmt->Rectf = _mesa_noop_Rectf; - vfmt->EvalMesh1 = _mesa_noop_EvalMesh1; - vfmt->EvalMesh2 = _mesa_noop_EvalMesh2; + _MESA_INIT_EVAL_VTXFMT(vfmt, vbo_exec_); + vfmt->Rectf = _mesa_noop_Rectf; /* from attrib_tmp.h: */ diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 6e11344380..611460dc7b 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -72,6 +72,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/context.h" #include "main/dlist.h" #include "main/enums.h" +#include "main/eval.h" #include "main/macros.h" #include "main/api_noop.h" #include "main/api_validate.h" @@ -1050,18 +1051,12 @@ static void _save_vtxfmt_init( GLcontext *ctx ) */ vfmt->CallList = _save_CallList; /* inside begin/end */ vfmt->CallLists = _save_CallLists; /* inside begin/end */ - vfmt->EvalCoord1f = _save_EvalCoord1f; - vfmt->EvalCoord1fv = _save_EvalCoord1fv; - vfmt->EvalCoord2f = _save_EvalCoord2f; - vfmt->EvalCoord2fv = _save_EvalCoord2fv; - vfmt->EvalPoint1 = _save_EvalPoint1; - vfmt->EvalPoint2 = _save_EvalPoint2; + + _MESA_INIT_EVAL_VTXFMT(vfmt, _save_); /* These are all errors as we at least know we are in some sort of * begin/end pair: */ - vfmt->EvalMesh1 = _save_EvalMesh1; - vfmt->EvalMesh2 = _save_EvalMesh2; vfmt->Begin = _save_Begin; vfmt->Rectf = _save_Rectf; vfmt->DrawArrays = _save_DrawArrays; -- cgit v1.2.3 From a73ba2d31b87e974f6846a8aaced704634f6f657 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 9 Sep 2009 15:00:08 +0800 Subject: mesa/main: Make FEATURE_dlist follow feature conventions. As shown in mfeatures.h, this allows users of dlist.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 13 +------ src/mesa/main/api_noop.c | 9 ++--- src/mesa/main/context.c | 8 ++--- src/mesa/main/dlist.c | 64 ++++++++++++++++++++++++++--------- src/mesa/main/dlist.h | 82 ++++++++++++++++++++++++++------------------- src/mesa/main/shared.c | 4 --- src/mesa/main/vtxfmt.c | 6 ++-- src/mesa/vbo/vbo_exec_api.c | 7 +--- src/mesa/vbo/vbo_save_api.c | 3 +- 9 files changed, 110 insertions(+), 86 deletions(-) (limited to 'src/mesa/main/vtxfmt.c') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index fc4de3c14c..1559984f43 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -54,9 +54,7 @@ #include "context.h" #include "convolve.h" #include "depth.h" -#if FEATURE_dlist #include "dlist.h" -#endif #include "drawpix.h" #include "rastpos.h" #include "enable.h" @@ -179,17 +177,8 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_Viewport(exec, _mesa_Viewport); _mesa_init_accum_dispatch(exec); + _mesa_init_dlist_dispatch(exec); -#if FEATURE_dlist - SET_CallList(exec, _mesa_CallList); - SET_CallLists(exec, _mesa_CallLists); - SET_DeleteLists(exec, _mesa_DeleteLists); - SET_EndList(exec, _mesa_EndList); - SET_GenLists(exec, _mesa_GenLists); - SET_IsList(exec, _mesa_IsList); - SET_ListBase(exec, _mesa_ListBase); - SET_NewList(exec, _mesa_NewList); -#endif SET_ClearDepth(exec, _mesa_ClearDepth); SET_ClearIndex(exec, _mesa_ClearIndex); SET_ClipPlane(exec, _mesa_ClipPlane); diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 23c52177d8..06c287fd19 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -30,9 +30,7 @@ #include "context.h" #include "light.h" #include "macros.h" -#if FEATURE_dlist #include "dlist.h" -#endif #include "eval.h" #include "glapi/dispatch.h" @@ -996,10 +994,9 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); vfmt->Begin = _mesa_noop_Begin; -#if FEATURE_dlist - vfmt->CallList = _mesa_CallList; - vfmt->CallLists = _mesa_CallLists; -#endif + + _MESA_INIT_DLIST_VTXFMT(vfmt, _mesa_); + vfmt->Color3f = _mesa_noop_Color3f; vfmt->Color3fv = _mesa_noop_Color3fv; vfmt->Color4f = _mesa_noop_Color4f; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 03ee7fb04d..11b1d24453 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -91,9 +91,7 @@ #include "cpuinfo.h" #include "debug.h" #include "depth.h" -#if FEATURE_dlist #include "dlist.h" -#endif #include "eval.h" #include "enums.h" #include "extensions.h" @@ -670,9 +668,7 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_current( ctx ); _mesa_init_depth( ctx ); _mesa_init_debug( ctx ); -#if FEATURE_dlist _mesa_init_display_list( ctx ); -#endif _mesa_init_eval( ctx ); _mesa_init_fbobjects( ctx ); _mesa_init_feedback( ctx ); @@ -869,10 +865,12 @@ _mesa_initialize_context(GLcontext *ctx, _mesa_init_exec_table(ctx->Exec); #endif ctx->CurrentDispatch = ctx->Exec; + #if FEATURE_dlist - _mesa_init_dlist_table(ctx->Save); + _mesa_init_save_table(ctx->Save); _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); #endif + /* Neutral tnl module stuff */ _mesa_init_exec_vtxfmt( ctx ); ctx->TnlModule.Current = NULL; diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 189743e5f5..6354ed7474 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -73,6 +73,7 @@ #include "texstate.h" #include "mtypes.h" #include "varray.h" +#include "vtxfmt.h" #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program #include "shader/arbprogram.h" #include "shader/program.h" @@ -438,6 +439,10 @@ typedef union gl_dlist_node Node; */ static GLuint InstSize[OPCODE_END_OF_LIST + 1]; + +#if FEATURE_dlist + + void mesa_print_display_list(GLuint list); @@ -1047,8 +1052,8 @@ static void invalidate_saved_current_state( GLcontext *ctx ) ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; } -void GLAPIENTRY -_mesa_save_CallList(GLuint list) +static void GLAPIENTRY +save_CallList(GLuint list) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1070,8 +1075,8 @@ _mesa_save_CallList(GLuint list) } -void GLAPIENTRY -_mesa_save_CallLists(GLsizei num, GLenum type, const GLvoid * lists) +static void GLAPIENTRY +save_CallLists(GLsizei num, GLenum type, const GLvoid * lists) { GET_CURRENT_CONTEXT(ctx); GLint i; @@ -7426,7 +7431,7 @@ execute_list(GLcontext *ctx, GLuint list) /** * Test if a display list number is valid. */ -GLboolean GLAPIENTRY +static GLboolean GLAPIENTRY _mesa_IsList(GLuint list) { GET_CURRENT_CONTEXT(ctx); @@ -7439,7 +7444,7 @@ _mesa_IsList(GLuint list) /** * Delete a sequence of consecutive display lists. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_DeleteLists(GLuint list, GLsizei range) { GET_CURRENT_CONTEXT(ctx); @@ -7461,7 +7466,7 @@ _mesa_DeleteLists(GLuint list, GLsizei range) * Return a display list number, n, such that lists n through n+range-1 * are free. */ -GLuint GLAPIENTRY +static GLuint GLAPIENTRY _mesa_GenLists(GLsizei range) { GET_CURRENT_CONTEXT(ctx); @@ -7501,7 +7506,7 @@ _mesa_GenLists(GLsizei range) /** * Begin a new display list. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_NewList(GLuint name, GLenum mode) { GET_CURRENT_CONTEXT(ctx); @@ -7551,7 +7556,7 @@ _mesa_NewList(GLuint name, GLenum mode) /** * End definition of current display list. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_EndList(void) { GET_CURRENT_CONTEXT(ctx); @@ -7685,7 +7690,7 @@ _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists) /** * Set the offset added to list numbers in glCallLists. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_ListBase(GLuint base) { GET_CURRENT_CONTEXT(ctx); @@ -8420,7 +8425,7 @@ exec_MultiModeDrawElementsIBM(const GLenum * mode, * struct. */ void -_mesa_init_dlist_table(struct _glapi_table *table) +_mesa_init_save_table(struct _glapi_table *table) { _mesa_loopback_init_api_table(table); @@ -8429,8 +8434,8 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_AlphaFunc(table, save_AlphaFunc); SET_Bitmap(table, save_Bitmap); SET_BlendFunc(table, save_BlendFunc); - SET_CallList(table, _mesa_save_CallList); - SET_CallLists(table, _mesa_save_CallLists); + SET_CallList(table, save_CallList); + SET_CallLists(table, save_CallLists); SET_Clear(table, save_Clear); SET_ClearAccum(table, save_ClearAccum); SET_ClearColor(table, save_ClearColor); @@ -9294,8 +9299,9 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt) _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); vfmt->Begin = save_Begin; - vfmt->CallList = _mesa_save_CallList; - vfmt->CallLists = _mesa_save_CallLists; + + _MESA_INIT_DLIST_VTXFMT(vfmt, save_); + vfmt->Color3f = save_Color3f; vfmt->Color3fv = save_Color3fv; vfmt->Color4f = save_Color4f; @@ -9373,6 +9379,32 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt) } +void +_mesa_install_dlist_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt) +{ + SET_CallList(disp, vfmt->CallList); + SET_CallLists(disp, vfmt->CallLists); +} + + +void _mesa_init_dlist_dispatch(struct _glapi_table *disp) +{ + SET_CallList(disp, _mesa_CallList); + SET_CallLists(disp, _mesa_CallLists); + + SET_DeleteLists(disp, _mesa_DeleteLists); + SET_EndList(disp, _mesa_EndList); + SET_GenLists(disp, _mesa_GenLists); + SET_IsList(disp, _mesa_IsList); + SET_ListBase(disp, _mesa_ListBase); + SET_NewList(disp, _mesa_NewList); +} + + +#endif /* FEATURE_dlist */ + + /** * Initialize display list state for given context. */ @@ -9397,5 +9429,7 @@ _mesa_init_display_list(GLcontext *ctx) /* Display List group */ ctx->List.ListBase = 0; +#if FEATURE_dlist _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt); +#endif } diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h index ab7ec2c8db..af36991d5e 100644 --- a/src/mesa/main/dlist.h +++ b/src/mesa/main/dlist.h @@ -33,41 +33,34 @@ #define DLIST_H -#include "mtypes.h" +#include "main/mtypes.h" -#if _HAVE_FULL_GL +#if FEATURE_dlist -extern void -_mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist); +#define _MESA_INIT_DLIST_FUNCTIONS(driver, impl) \ + do { \ + (driver)->NewList = impl ## NewList; \ + (driver)->EndList = impl ## EndList; \ + (driver)->BeginCallList = impl ## BeginCallList; \ + (driver)->EndCallList = impl ## EndCallList; \ + (driver)->SaveFlushVertices = impl ## SaveFlushVertices; \ + (driver)->NotifySaveBegin = impl ## NotifyBegin; \ + } while (0) + +#define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) \ + do { \ + (vfmt)->CallList = impl ## CallList; \ + (vfmt)->CallLists = impl ## CallLists; \ + } while (0) extern void GLAPIENTRY _mesa_CallList( GLuint list ); extern void GLAPIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); -extern void GLAPIENTRY _mesa_DeleteLists( GLuint list, GLsizei range ); - -extern void GLAPIENTRY _mesa_EndList( void ); - -extern GLuint GLAPIENTRY _mesa_GenLists( GLsizei range ); - -extern GLboolean GLAPIENTRY _mesa_IsList( GLuint list ); - -extern void GLAPIENTRY _mesa_ListBase( GLuint base ); - -extern void GLAPIENTRY _mesa_NewList( GLuint list, GLenum mode ); - -extern void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); - -extern void GLAPIENTRY _mesa_save_CallList( GLuint list ); - - - -extern void _mesa_init_dlist_table( struct _glapi_table *table ); extern void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ); - extern void *_mesa_alloc_instruction(GLcontext *ctx, GLuint opcode, GLuint sz); extern GLint _mesa_alloc_opcode( GLcontext *ctx, GLuint sz, @@ -75,22 +68,43 @@ extern GLint _mesa_alloc_opcode( GLcontext *ctx, GLuint sz, void (*destroy)( GLcontext *, void * ), void (*print)( GLcontext *, void * ) ); -extern void _mesa_init_display_list( GLcontext * ctx ); +extern void _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist); extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt ); +extern void _mesa_init_save_table( struct _glapi_table *table ); + +extern void _mesa_install_dlist_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt); + +extern void _mesa_init_dlist_dispatch(struct _glapi_table *disp); -#else +#else /* FEATURE_dlist */ -/** No-op */ -#define _mesa_init_dlist_table(t,ts) ((void)0) +#define _MESA_INIT_DLIST_FUNCTIONS(driver, impl) do { } while (0) +#define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) do { } while (0) -/** No-op */ -#define _mesa_init_display_list(c) ((void)0) +static INLINE void +_mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) +{ + /* there should be no list to delete */ + ASSERT_NO_FEATURE(); +} -/** No-op */ -#define _mesa_save_vtxfmt_init(v) ((void)0) +static INLINE void +_mesa_install_dlist_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt) +{ +} + +static INLINE void +_mesa_init_dlist_dispatch(struct _glapi_table *disp) +{ +} + +#endif /* FEATURE_dlist */ + +extern void _mesa_init_display_list( GLcontext * ctx ); -#endif -#endif +#endif /* DLIST_H */ diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index 643ad3354e..4d01e8abc6 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -37,9 +37,7 @@ #include "shared.h" #include "shader/program.h" #include "shader/shader_api.h" -#if FEATURE_dlist #include "dlist.h" -#endif #if FEATURE_ATI_fragment_shader #include "shader/atifragshader.h" #endif @@ -143,11 +141,9 @@ _mesa_alloc_shared_state(GLcontext *ctx) static void delete_displaylist_cb(GLuint id, void *data, void *userData) { -#if FEATURE_dlist struct gl_display_list *list = (struct gl_display_list *) data; GLcontext *ctx = (GLcontext *) userData; _mesa_delete_list(ctx, list); -#endif } diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index c35e4dabe3..8336ff34d2 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -35,6 +35,7 @@ #include "state.h" #include "vtxfmt.h" #include "eval.h" +#include "dlist.h" /* The neutral vertex format. This wraps all tnl module functions, @@ -125,8 +126,9 @@ 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); + SET_Begin(tab, vfmt->Begin); SET_End(tab, vfmt->End); SET_Rectf(tab, vfmt->Rectf); diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index cfe8be77e5..3eb85789fa 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -35,9 +35,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/context.h" #include "main/macros.h" #include "main/vtxfmt.h" -#if FEATURE_dlist #include "main/dlist.h" -#endif #include "main/eval.h" #include "main/state.h" #include "main/light.h" @@ -568,12 +566,9 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); vfmt->Begin = vbo_exec_Begin; -#if FEATURE_dlist - vfmt->CallList = _mesa_CallList; - vfmt->CallLists = _mesa_CallLists; -#endif vfmt->End = vbo_exec_End; + _MESA_INIT_DLIST_VTXFMT(vfmt, _mesa_); _MESA_INIT_EVAL_VTXFMT(vfmt, vbo_exec_); vfmt->Rectf = _mesa_noop_Rectf; diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 611460dc7b..4da248e2b8 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -1049,8 +1049,7 @@ static void _save_vtxfmt_init( GLcontext *ctx ) /* This will all require us to fallback to saving the list as opcodes: */ - vfmt->CallList = _save_CallList; /* inside begin/end */ - vfmt->CallLists = _save_CallLists; /* inside begin/end */ + _MESA_INIT_DLIST_VTXFMT(vfmt, _save_); /* inside begin/end */ _MESA_INIT_EVAL_VTXFMT(vfmt, _save_); -- cgit v1.2.3 From cef97267d696d37f4dccb22951499ca25d5d87ad Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 12 Sep 2009 18:59:13 +0800 Subject: mesa/main: New feature FEATURE_beginend. This feature corresponds to the Begin/End paradigm. Disabling this feature also eliminates the use of GLvertexformat completely. --- src/mesa/main/api_loopback.c | 7 ++++ src/mesa/main/api_loopback.h | 16 ++++++-- src/mesa/main/api_noop.c | 6 +++ src/mesa/main/api_noop.h | 9 +++-- src/mesa/main/mfeatures.h | 4 +- src/mesa/main/vtxfmt.c | 6 +++ src/mesa/main/vtxfmt.h | 28 ++++++++++++- src/mesa/vbo/vbo_exec.h | 18 +++++++++ src/mesa/vbo/vbo_exec_api.c | 94 +++++++++++++++++++++++++++++++++++++++++++- src/mesa/vbo/vbo_exec_draw.c | 6 +++ 10 files changed, 184 insertions(+), 10 deletions(-) (limited to 'src/mesa/main/vtxfmt.c') diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c index 0e3f5ff957..3d466ac44a 100644 --- a/src/mesa/main/api_loopback.c +++ b/src/mesa/main/api_loopback.c @@ -77,6 +77,10 @@ #define FOGCOORDF(x) CALL_FogCoordfEXT(GET_DISPATCH(), (x)) #define SECONDARYCOLORF(a,b,c) CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c)) + +#if FEATURE_beginend + + static void GLAPIENTRY loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue ) { @@ -1655,3 +1659,6 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest ) SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB); SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB); } + + +#endif /* FEATURE_beginend */ diff --git a/src/mesa/main/api_loopback.h b/src/mesa/main/api_loopback.h index 6f85bbc1d9..3140eb515e 100644 --- a/src/mesa/main/api_loopback.h +++ b/src/mesa/main/api_loopback.h @@ -27,11 +27,19 @@ #ifndef API_LOOPBACK_H #define API_LOOPBACK_H -#include "glheader.h" +#include "main/mtypes.h" - -struct _glapi_table; +#if FEATURE_beginend extern void _mesa_loopback_init_api_table( struct _glapi_table *dest ); -#endif +#else /* FEATURE_beginend */ + +static INLINE void +_mesa_loopback_init_api_table( struct _glapi_table *dest ) +{ +} + +#endif /* FEATURE_beginend */ + +#endif /* API_LOOPBACK_H */ diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 06c287fd19..f72f957300 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -43,6 +43,9 @@ */ +#if FEATURE_beginend + + static void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b ) { GET_CURRENT_CONTEXT(ctx); @@ -1064,3 +1067,6 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) vfmt->DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex; vfmt->MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex; } + + +#endif /* FEATURE_beginend */ diff --git a/src/mesa/main/api_noop.h b/src/mesa/main/api_noop.h index 1150984d64..e7fd49bafb 100644 --- a/src/mesa/main/api_noop.h +++ b/src/mesa/main/api_noop.h @@ -25,8 +25,9 @@ #ifndef _API_NOOP_H #define _API_NOOP_H -#include "mtypes.h" -#include "context.h" +#include "main/mtypes.h" + +#if FEATURE_beginend extern void GLAPIENTRY _mesa_noop_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); @@ -54,4 +55,6 @@ _mesa_noop_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, extern void _mesa_noop_vtxfmt_init(GLvertexformat *vfmt); -#endif +#endif /* FEATURE_beginend */ + +#endif /* _API_NOOP_H */ diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 27799771a5..c2fb8404b1 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -71,10 +71,12 @@ #define FEATURE_accum _HAVE_FULL_GL #define FEATURE_arrayelt _HAVE_FULL_GL #define FEATURE_attrib_stack _HAVE_FULL_GL +/* this disables vtxfmt, api_loopback, and api_noop completely */ +#define FEATURE_beginend _HAVE_FULL_GL #define FEATURE_colortable _HAVE_FULL_GL #define FEATURE_convolve _HAVE_FULL_GL #define FEATURE_dispatch _HAVE_FULL_GL -#define FEATURE_dlist (_HAVE_FULL_GL && FEATURE_arrayelt) +#define FEATURE_dlist (_HAVE_FULL_GL && FEATURE_arrayelt && FEATURE_beginend) #define FEATURE_draw_read_buffer _HAVE_FULL_GL #define FEATURE_drawpix _HAVE_FULL_GL #define FEATURE_evaluators _HAVE_FULL_GL diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index 8336ff34d2..c9eea8ab83 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -38,6 +38,9 @@ #include "dlist.h" +#if FEATURE_beginend + + /* 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 @@ -195,3 +198,6 @@ void _mesa_restore_exec_vtxfmt( GLcontext *ctx ) tnl->SwapCount = 0; } + + +#endif /* FEATURE_beginend */ diff --git a/src/mesa/main/vtxfmt.h b/src/mesa/main/vtxfmt.h index 76f108e023..fb6c23abe9 100644 --- a/src/mesa/main/vtxfmt.h +++ b/src/mesa/main/vtxfmt.h @@ -33,6 +33,8 @@ #ifndef _VTXFMT_H_ #define _VTXFMT_H_ +#if FEATURE_beginend + extern void _mesa_init_exec_vtxfmt( GLcontext *ctx ); extern void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ); @@ -40,4 +42,28 @@ extern void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfm extern void _mesa_restore_exec_vtxfmt( GLcontext *ctx ); -#endif +#else /* FEATURE_beginend */ + +static INLINE void +_mesa_init_exec_vtxfmt( GLcontext *ctx ) +{ +} + +static INLINE void +_mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) +{ +} + +static INLINE void +_mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) +{ +} + +static INLINE void +_mesa_restore_exec_vtxfmt( GLcontext *ctx ) +{ +} + +#endif /* FEATURE_beginend */ + +#endif /* _VTXFMT_H_ */ diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h index e0f44892cf..516be0995b 100644 --- a/src/mesa/vbo/vbo_exec.h +++ b/src/mesa/vbo/vbo_exec.h @@ -161,8 +161,26 @@ void vbo_exec_array_destroy( struct vbo_exec_context *exec ); void vbo_exec_vtx_init( struct vbo_exec_context *exec ); void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ); + +#if FEATURE_beginend + void vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap ); void vbo_exec_vtx_map( struct vbo_exec_context *exec ); + +#else /* FEATURE_beginend */ + +static INLINE void +vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap ) +{ +} + +static INLINE void +vbo_exec_vtx_map( struct vbo_exec_context *exec ) +{ +} + +#endif /* FEATURE_beginend */ + void vbo_exec_vtx_wrap( struct vbo_exec_context *exec ); void vbo_exec_eval_update( struct vbo_exec_context *exec ); diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 3eb85789fa..bfa6d76886 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -348,7 +348,7 @@ static void vbo_exec_fixup_vertex( GLcontext *ctx, } - +#if FEATURE_beginend /* */ @@ -635,6 +635,98 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) } +#else /* FEATURE_beginend */ + + +#define ATTR( A, N, V0, V1, V2, V3 ) \ +do { \ + struct vbo_exec_context *exec = &vbo_context(ctx)->exec; \ + \ + /* FLUSH_UPDATE_CURRENT needs to be set manually */ \ + exec->ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \ + \ + if (exec->vtx.active_sz[A] != N) \ + vbo_exec_fixup_vertex(ctx, A, N); \ + \ + { \ + GLfloat *dest = exec->vtx.attrptr[A]; \ + if (N>0) dest[0] = V0; \ + if (N>1) dest[1] = V1; \ + if (N>2) dest[2] = V2; \ + if (N>3) dest[3] = V3; \ + } \ +} while (0) + +#define ERROR() _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ) +#define TAG(x) vbo_##x + +#include "vbo_attrib_tmp.h" + +static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) +{ + /* silence warnings */ + (void) vbo_Color3f; + (void) vbo_Color3fv; + (void) vbo_Color4f; + (void) vbo_Color4fv; + (void) vbo_FogCoordfEXT; + (void) vbo_FogCoordfvEXT; + (void) vbo_MultiTexCoord1f; + (void) vbo_MultiTexCoord1fv; + (void) vbo_MultiTexCoord2f; + (void) vbo_MultiTexCoord2fv; + (void) vbo_MultiTexCoord3f; + (void) vbo_MultiTexCoord3fv; + (void) vbo_MultiTexCoord4f; + (void) vbo_MultiTexCoord4fv; + (void) vbo_Normal3f; + (void) vbo_Normal3fv; + (void) vbo_SecondaryColor3fEXT; + (void) vbo_SecondaryColor3fvEXT; + (void) vbo_TexCoord1f; + (void) vbo_TexCoord1fv; + (void) vbo_TexCoord2f; + (void) vbo_TexCoord2fv; + (void) vbo_TexCoord3f; + (void) vbo_TexCoord3fv; + (void) vbo_TexCoord4f; + (void) vbo_TexCoord4fv; + (void) vbo_Vertex2f; + (void) vbo_Vertex2fv; + (void) vbo_Vertex3f; + (void) vbo_Vertex3fv; + (void) vbo_Vertex4f; + (void) vbo_Vertex4fv; + + (void) vbo_VertexAttrib1fARB; + (void) vbo_VertexAttrib1fvARB; + (void) vbo_VertexAttrib2fARB; + (void) vbo_VertexAttrib2fvARB; + (void) vbo_VertexAttrib3fARB; + (void) vbo_VertexAttrib3fvARB; + (void) vbo_VertexAttrib4fARB; + (void) vbo_VertexAttrib4fvARB; + + (void) vbo_VertexAttrib1fNV; + (void) vbo_VertexAttrib1fvNV; + (void) vbo_VertexAttrib2fNV; + (void) vbo_VertexAttrib2fvNV; + (void) vbo_VertexAttrib3fNV; + (void) vbo_VertexAttrib3fvNV; + (void) vbo_VertexAttrib4fNV; + (void) vbo_VertexAttrib4fvNV; + + (void) vbo_Materialfv; + + (void) vbo_EdgeFlag; + (void) vbo_Indexf; + (void) vbo_Indexfv; +} + + +#endif /* FEATURE_beginend */ + + /** * Tell the VBO module to use a real OpenGL vertex buffer object to * store accumulated immediate-mode vertex data. diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 0c258c535e..ee148df4a1 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -35,6 +35,9 @@ #include "vbo_context.h" +#if FEATURE_beginend + + static void vbo_exec_debug_verts( struct vbo_exec_context *exec ) { @@ -411,3 +414,6 @@ vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap ) exec->vtx.prim_count = 0; exec->vtx.vert_count = 0; } + + +#endif /* FEATURE_beginend */ -- cgit v1.2.3