summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-09-09 15:00:08 +0800
committerChia-I Wu <olvaffe@gmail.com>2009-09-12 20:55:58 +0800
commit1c497bd4c652de95deaaed0c704c3b776b69aded (patch)
tree6ee35e48d235b25dbb68de51e9174eb422d63417
parent17f2649e269b9d98abd6a66f687ffa29904bf4a0 (diff)
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.
-rw-r--r--src/mesa/main/api_exec.c13
-rw-r--r--src/mesa/main/api_noop.c9
-rw-r--r--src/mesa/main/context.c10
-rw-r--r--src/mesa/main/dlist.c40
-rw-r--r--src/mesa/main/dlist.h71
-rw-r--r--src/mesa/main/shared.c4
-rw-r--r--src/mesa/main/vtxfmt.c9
-rw-r--r--src/mesa/vbo/vbo_exec_api.c8
-rw-r--r--src/mesa/vbo/vbo_save_api.c3
9 files changed, 107 insertions, 60 deletions
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 f9ec69b511..a30c47da77 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..2869a722ec 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,10 @@ _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 b0dcfe9055..f793b60284 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"
@@ -410,6 +411,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);
@@ -7789,7 +7794,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);
@@ -8635,8 +8640,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, _mesa_save_);
+
vfmt->Color3f = save_Color3f;
vfmt->Color3fv = save_Color3fv;
vfmt->Color4f = save_Color4f;
@@ -8714,6 +8720,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.
*/
@@ -8738,5 +8770,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..6e1059eac2 100644
--- a/src/mesa/main/dlist.h
+++ b/src/mesa/main/dlist.h
@@ -33,13 +33,26 @@
#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 );
@@ -62,12 +75,8 @@ extern void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoi
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 +84,48 @@ 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);
-#else
+extern void _mesa_init_dlist_dispatch(struct _glapi_table *disp);
-/** No-op */
-#define _mesa_init_dlist_table(t,ts) ((void)0)
+#else /* FEATURE_dlist */
-/** No-op */
-#define _mesa_init_display_list(c) ((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_save_vtxfmt_init(v) ((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();
+}
+
+static INLINE void
+_mesa_init_save_table(struct _glapi_table *disp)
+{
+}
+
+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..8ba1af6de1 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);
@@ -176,7 +178,10 @@ void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
{
+ /* vfmt is empty when dlist is disabled */
+#if FEATURE_dlist
install_vtxfmt( ctx->Save, vfmt );
+#endif
}
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 27baebe3a7..a81bd39eb1 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"
@@ -563,12 +561,10 @@ 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_);
+
/* use noop eval mesh */
#define vbo_exec_EvalMesh1 _mesa_noop_EvalMesh1
#define vbo_exec_EvalMesh2 _mesa_noop_EvalMesh2
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_);