summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-09-08 10:25:22 +0800
committerBrian Paul <brianp@vmware.com>2009-09-30 08:31:55 -0600
commitaefa1f6ab1d9267b223b06ae205ab34c8e0d7c02 (patch)
tree5781879d25d11e6a5ded9c6a951a22a442a479b8 /src/mesa/main
parent42fac11d437d6bf2cb27f9487dedf7fb396616d4 (diff)
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.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_exec.c18
-rw-r--r--src/mesa/main/api_noop.c14
-rw-r--r--src/mesa/main/context.c6
-rw-r--r--src/mesa/main/dlist.c19
-rw-r--r--src/mesa/main/eval.c61
-rw-r--r--src/mesa/main/eval.h84
-rw-r--r--src/mesa/main/vtxfmt.c13
7 files changed, 101 insertions, 114 deletions
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);