summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-09-08 10:52:01 +0800
committerChia-I Wu <olvaffe@gmail.com>2009-09-12 20:55:57 +0800
commitb04d58c0b1bd66ea59c5277a13e83e4306a6d740 (patch)
treeab25cbcd9d3ec0f1ab6163d99df60e50d904b4bf
parent8df670164f9bd735a6212741c0178899d3462e0c (diff)
mesa/main: Make FEATURE_feedback follow feature conventions.
As shown in mfeatures.h, this allows users of feedback.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/context.c6
-rw-r--r--src/mesa/main/feedback.c23
-rw-r--r--src/mesa/main/feedback.h54
4 files changed, 70 insertions, 26 deletions
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index 5ddbf49759..a2f0dfabda 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -64,9 +64,7 @@
#include "eval.h"
#endif
#include "get.h"
-#if FEATURE_feedback
#include "feedback.h"
-#endif
#include "fog.h"
#if FEATURE_EXT_framebuffer_object
#include "fbobject.h"
@@ -209,17 +207,8 @@ _mesa_init_exec_table(struct _glapi_table *exec)
SET_DepthRange(exec, _mesa_DepthRange);
_mesa_init_drawpix_dispatch(exec);
+ _mesa_init_feedback_dispatch(exec);
-#if FEATURE_feedback
- SET_InitNames(exec, _mesa_InitNames);
- SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer);
- SET_LoadName(exec, _mesa_LoadName);
- SET_PassThrough(exec, _mesa_PassThrough);
- SET_PopName(exec, _mesa_PopName);
- SET_PushName(exec, _mesa_PushName);
- SET_SelectBuffer(exec, _mesa_SelectBuffer);
- SET_RenderMode(exec, _mesa_RenderMode);
-#endif
SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
SET_Fogf(exec, _mesa_Fogf);
SET_Fogfv(exec, _mesa_Fogfv);
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index cd8fe0df8f..17e98ffa30 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -100,9 +100,7 @@
#include "enums.h"
#include "extensions.h"
#include "fbobject.h"
-#if FEATURE_feedback
#include "feedback.h"
-#endif
#include "fog.h"
#include "framebuffer.h"
#include "get.h"
@@ -683,11 +681,7 @@ init_attrib_groups(GLcontext *ctx)
_mesa_init_eval( ctx );
#endif
_mesa_init_fbobjects( ctx );
-#if FEATURE_feedback
_mesa_init_feedback( ctx );
-#else
- ctx->RenderMode = GL_RENDER;
-#endif
_mesa_init_fog( ctx );
_mesa_init_histogram( ctx );
_mesa_init_hint( ctx );
diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c
index 818a804540..46759dc99e 100644
--- a/src/mesa/main/feedback.c
+++ b/src/mesa/main/feedback.c
@@ -36,9 +36,10 @@
#include "feedback.h"
#include "macros.h"
#include "mtypes.h"
+#include "glapi/dispatch.h"
-#if _HAVE_FULL_GL
+#if FEATURE_feedback
#define FB_3D 0x01
@@ -153,9 +154,6 @@ _mesa_feedback_vertex(GLcontext *ctx,
}
-#endif /* _HAVE_FULL_GL */
-
-
/**********************************************************************/
/** \name Selection */
/*@{*/
@@ -507,6 +505,23 @@ _mesa_RenderMode( GLenum mode )
/*@}*/
+void
+_mesa_init_feedback_dispatch(struct _glapi_table *disp)
+{
+ SET_InitNames(disp, _mesa_InitNames);
+ SET_FeedbackBuffer(disp, _mesa_FeedbackBuffer);
+ SET_LoadName(disp, _mesa_LoadName);
+ SET_PassThrough(disp, _mesa_PassThrough);
+ SET_PopName(disp, _mesa_PopName);
+ SET_PushName(disp, _mesa_PushName);
+ SET_SelectBuffer(disp, _mesa_SelectBuffer);
+ SET_RenderMode(disp, _mesa_RenderMode);
+}
+
+
+#endif /* FEATURE_feedback */
+
+
/**********************************************************************/
/** \name Initialization */
/*@{*/
diff --git a/src/mesa/main/feedback.h b/src/mesa/main/feedback.h
index 72c2acd5ed..6ed1a12525 100644
--- a/src/mesa/main/feedback.h
+++ b/src/mesa/main/feedback.h
@@ -27,11 +27,15 @@
#define FEEDBACK_H
-#include "mtypes.h"
+#include "main/mtypes.h"
-extern void
-_mesa_init_feedback( GLcontext *ctx );
+#if FEATURE_feedback
+
+#define _MESA_INIT_FEEDBACK_FUNCTIONS(driver, impl) \
+ do { \
+ (driver)->RenderMode = impl ## RenderMode; \
+ } while (0)
extern void
_mesa_feedback_vertex( GLcontext *ctx,
@@ -79,5 +83,47 @@ _mesa_PopName( void );
extern GLint GLAPIENTRY
_mesa_RenderMode( GLenum mode );
+extern void
+_mesa_init_feedback_dispatch(struct _glapi_table *disp);
+
+#else /* FEATURE_feedback */
+
+#define _MESA_INIT_FEEDBACK_FUNCTIONS(driver, impl) do { } while (0)
+
+static INLINE void
+_mesa_feedback_vertex( GLcontext *ctx,
+ const GLfloat win[4],
+ const GLfloat color[4],
+ GLfloat index,
+ const GLfloat texcoord[4] )
+{
+ /* render mode is always GL_RENDER */
+ ASSERT_NO_FEATURE();
+}
+
+
+static INLINE void
+_mesa_feedback_token( GLcontext *ctx, GLfloat token )
+{
+ /* render mode is always GL_RENDER */
+ ASSERT_NO_FEATURE();
+}
+
+static INLINE void
+_mesa_update_hitflag( GLcontext *ctx, GLfloat z )
+{
+ /* render mode is always GL_RENDER */
+ ASSERT_NO_FEATURE();
+}
+
+static INLINE void
+_mesa_init_feedback_dispatch(struct _glapi_table *disp)
+{
+}
+
+#endif /* FEATURE_feedback */
+
+extern void
+_mesa_init_feedback( GLcontext *ctx );
-#endif
+#endif /* FEEDBACK_H */