summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-09-08 10:25:22 +0800
committerChia-I Wu <olvaffe@gmail.com>2009-09-12 20:55:58 +0800
commit17f2649e269b9d98abd6a66f687ffa29904bf4a0 (patch)
treeac6322916e350b280b326327b749d063d48686f7 /src/mesa
parent57ce3ab32382d08ac8f0aeca13677612af3adfc0 (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. It is renamed to FEATURE_eval along the way.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/api_exec.c18
-rw-r--r--src/mesa/main/api_noop.c18
-rw-r--r--src/mesa/main/context.c6
-rw-r--r--src/mesa/main/dlist.c19
-rw-r--r--src/mesa/main/eval.c39
-rw-r--r--src/mesa/main/eval.h49
-rw-r--r--src/mesa/main/mfeatures.h2
-rw-r--r--src/mesa/main/vtxfmt.c13
-rw-r--r--src/mesa/vbo/vbo_exec_api.c17
-rw-r--r--src/mesa/vbo/vbo_save_api.c11
10 files changed, 109 insertions, 83 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..f9ec69b511 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"
@@ -624,7 +625,7 @@ static void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLf
}
-#if FEATURE_evaluators
+#if FEATURE_eval
/* Similarly, these have no effect outside begin/end:
*/
static void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a )
@@ -656,7 +657,7 @@ static void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b )
{
(void) a; (void) b;
}
-#endif /* FEATURE_evaluators */
+#endif /* FEATURE_eval */
/* Begin -- call into driver, should result in the vtxfmt being
@@ -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 25a2819783..b0dcfe9055 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -1824,7 +1824,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;
@@ -1842,7 +1842,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;
@@ -7820,8 +7820,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);
@@ -8643,12 +8643,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;
@@ -8697,8 +8694,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..47f99270ce 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_eval
/*
@@ -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_eval */
+
/**********************************************************************/
/***** Initialization *****/
diff --git a/src/mesa/main/eval.h b/src/mesa/main/eval.h
index b3ff0a96f8..49fd37a057 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_eval
+#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 );
@@ -115,14 +124,32 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v );
extern void GLAPIENTRY
_mesa_GetMapiv( GLenum target, GLenum query, GLint *v );
-#else
+extern void
+_mesa_install_eval_vtxfmt(struct _glapi_table *disp,
+ const GLvertexformat *vfmt);
+
+extern void
+_mesa_init_eval_dispatch(struct _glapi_table *disp);
+
+#else /* FEATURE_eval */
+
+#define _MESA_INIT_EVAL_VTXFMT(vfmt, impl) do { } while (0)
-/** No-op */
-#define _mesa_init_eval( c ) ((void)0)
+static INLINE void
+_mesa_install_eval_vtxfmt(struct _glapi_table *disp,
+ const GLvertexformat *vfmt)
+{
+}
-/** No-op */
-#define _mesa_free_eval_data( c ) ((void)0)
+static INLINE void
+_mesa_init_eval_dispatch(struct _glapi_table *disp)
+{
+}
+
+#endif /* FEATURE_eval */
+
+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/mfeatures.h b/src/mesa/main/mfeatures.h
index cd39f5bd24..a89b760774 100644
--- a/src/mesa/main/mfeatures.h
+++ b/src/mesa/main/mfeatures.h
@@ -78,7 +78,7 @@
#define FEATURE_dlist (_HAVE_FULL_GL && FEATURE_arrayelt)
#define FEATURE_draw_read_buffer _HAVE_FULL_GL
#define FEATURE_drawpix _HAVE_FULL_GL
-#define FEATURE_evaluators _HAVE_FULL_GL
+#define FEATURE_eval _HAVE_FULL_GL
#define FEATURE_feedback _HAVE_FULL_GL
#define FEATURE_fixedpt 0
#define FEATURE_histogram _HAVE_FULL_GL
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..27baebe3a7 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_eval
/* Eval
*/
static void GLAPIENTRY vbo_exec_EvalCoord1f( GLfloat u )
@@ -484,6 +486,7 @@ static void GLAPIENTRY vbo_exec_EvalPoint2( GLint i, GLint j )
vbo_exec_EvalCoord2f( u, v );
}
+#endif /* FEATURE_eval */
/* Build a list of primitives on the fly. Keep
@@ -565,17 +568,13 @@ 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;
+ /* use noop eval mesh */
+#define vbo_exec_EvalMesh1 _mesa_noop_EvalMesh1
+#define vbo_exec_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;