mesa: Remove unnecessary header.
[mesa.git] / src / mesa / main / feedback.c
index 5073ccbef596d7ab3d36dfdd7aa88981c9f81917..c72b91280ed174c3bd3c50ea356df984ac49a06d 100644 (file)
 #include "feedback.h"
 #include "macros.h"
 #include "mtypes.h"
+#include "main/dispatch.h"
 
 
-#if _HAVE_FULL_GL
+#if FEATURE_feedback
 
 
 #define FB_3D          0x01
 #define FB_4D          0x02
-#define FB_INDEX       0x04
-#define FB_COLOR       0x08
-#define FB_TEXTURE     0X10
+#define FB_COLOR       0x04
+#define FB_TEXTURE     0X08
 
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -77,18 +77,13 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
         ctx->Feedback._Mask = FB_3D;
         break;
       case GL_3D_COLOR:
-        ctx->Feedback._Mask = (FB_3D |
-                               (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX));
+        ctx->Feedback._Mask = (FB_3D | FB_COLOR);
         break;
       case GL_3D_COLOR_TEXTURE:
-        ctx->Feedback._Mask = (FB_3D |
-                               (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX) |
-                               FB_TEXTURE);
+        ctx->Feedback._Mask = (FB_3D | FB_COLOR | FB_TEXTURE);
         break;
       case GL_4D_COLOR_TEXTURE:
-        ctx->Feedback._Mask = (FB_3D | FB_4D |
-                               (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX) |
-                               FB_TEXTURE);
+        ctx->Feedback._Mask = (FB_3D | FB_4D | FB_COLOR | FB_TEXTURE);
         break;
       default:
          _mesa_error( ctx, GL_INVALID_ENUM, "glFeedbackBuffer" );
@@ -103,7 +98,7 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
 }
 
 
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_PassThrough( GLfloat token )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -124,7 +119,6 @@ void
 _mesa_feedback_vertex(GLcontext *ctx,
                       const GLfloat win[4],
                       const GLfloat color[4],
-                      GLfloat index,
                       const GLfloat texcoord[4])
 {
    _mesa_feedback_token( ctx, win[0] );
@@ -135,9 +129,6 @@ _mesa_feedback_vertex(GLcontext *ctx,
    if (ctx->Feedback._Mask & FB_4D) {
       _mesa_feedback_token( ctx, win[3] );
    }
-   if (ctx->Feedback._Mask & FB_INDEX) {
-      _mesa_feedback_token( ctx, (GLfloat) index );
-   }
    if (ctx->Feedback._Mask & FB_COLOR) {
       _mesa_feedback_token( ctx, color[0] );
       _mesa_feedback_token( ctx, color[1] );
@@ -153,9 +144,6 @@ _mesa_feedback_vertex(GLcontext *ctx,
 }
 
 
-#endif /* _HAVE_FULL_GL */
-
-
 /**********************************************************************/
 /** \name Selection */
 /*@{*/
@@ -173,7 +161,7 @@ _mesa_feedback_vertex(GLcontext *ctx,
  * Verifies we're not in selection mode, flushes the vertices and initialize
  * the fields in __GLcontextRec::Select with the given buffer.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_SelectBuffer( GLsizei size, GLuint *buffer )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -197,17 +185,20 @@ _mesa_SelectBuffer( GLsizei size, GLuint *buffer )
 /**
  * Write a value of a record into the selection buffer.
  * 
- * \param CTX GL context.
- * \param V value.
+ * \param ctx GL context.
+ * \param value value.
  *
  * Verifies there is free space in the buffer to write the value and
  * increments the pointer.
  */
-#define WRITE_RECORD( CTX, V )                                 \
-       if (CTX->Select.BufferCount < CTX->Select.BufferSize) { \
-          CTX->Select.Buffer[CTX->Select.BufferCount] = (V);   \
-       }                                                       \
-       CTX->Select.BufferCount++;
+static INLINE void
+write_record(GLcontext *ctx, GLuint value)
+{
+   if (ctx->Select.BufferCount < ctx->Select.BufferSize) {
+      ctx->Select.Buffer[ctx->Select.BufferCount] = value;
+   }
+   ctx->Select.BufferCount++;
+}
 
 
 /**
@@ -256,11 +247,11 @@ write_hit_record(GLcontext *ctx)
    zmin = (GLuint) ((GLfloat) zscale * ctx->Select.HitMinZ);
    zmax = (GLuint) ((GLfloat) zscale * ctx->Select.HitMaxZ);
 
-   WRITE_RECORD( ctx, ctx->Select.NameStackDepth );
-   WRITE_RECORD( ctx, zmin );
-   WRITE_RECORD( ctx, zmax );
+   write_record( ctx, ctx->Select.NameStackDepth );
+   write_record( ctx, zmin );
+   write_record( ctx, zmax );
    for (i = 0; i < ctx->Select.NameStackDepth; i++) {
-      WRITE_RECORD( ctx, ctx->Select.NameStack[i] );
+      write_record( ctx, ctx->Select.NameStack[i] );
    }
 
    ctx->Select.Hits++;
@@ -277,7 +268,7 @@ write_hit_record(GLcontext *ctx)
  * the hit record data in gl_selection. Marks new render mode in
  * __GLcontextRec::NewState.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_InitNames( void )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -308,7 +299,7 @@ _mesa_InitNames( void )
  *
  * sa __GLcontextRec::Select.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_LoadName( GLuint name )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -347,7 +338,7 @@ _mesa_LoadName( GLuint name )
  *
  * sa __GLcontextRec::Select.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_PushName( GLuint name )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -378,7 +369,7 @@ _mesa_PushName( GLuint name )
  *
  * sa __GLcontextRec::Select.
  */
-void GLAPIENTRY
+static void GLAPIENTRY
 _mesa_PopName( void )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -421,7 +412,7 @@ _mesa_PopName( void )
  * __GLcontextRec::RenderMode and notifies the driver via the
  * dd_function_table::RenderMode callback.
  */
-GLint GLAPIENTRY
+static GLint GLAPIENTRY
 _mesa_RenderMode( GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -504,6 +495,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 */
 /*@{*/