Browse Source

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.
tags/mesa_7_7_rc1
Chia-I Wu 16 years ago
parent
commit
301a510092
4 changed files with 70 additions and 50 deletions
  1. 1
    12
      src/mesa/main/api_exec.c
  2. 0
    6
      src/mesa/main/context.c
  3. 27
    12
      src/mesa/main/feedback.c
  4. 42
    20
      src/mesa/main/feedback.h

+ 1
- 12
src/mesa/main/api_exec.c View File

@@ -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);

+ 0
- 6
src/mesa/main/context.c View File

@@ -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 );

+ 27
- 12
src/mesa/main/feedback.c View File

@@ -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
@@ -49,7 +50,7 @@



void GLAPIENTRY
static void GLAPIENTRY
_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
{
GET_CURRENT_CONTEXT(ctx);
@@ -103,7 +104,7 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
}


void GLAPIENTRY
static void GLAPIENTRY
_mesa_PassThrough( GLfloat token )
{
GET_CURRENT_CONTEXT(ctx);
@@ -153,9 +154,6 @@ _mesa_feedback_vertex(GLcontext *ctx,
}


#endif /* _HAVE_FULL_GL */


/**********************************************************************/
/** \name Selection */
/*@{*/
@@ -173,7 +171,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);
@@ -280,7 +278,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);
@@ -311,7 +309,7 @@ _mesa_InitNames( void )
*
* sa __GLcontextRec::Select.
*/
void GLAPIENTRY
static void GLAPIENTRY
_mesa_LoadName( GLuint name )
{
GET_CURRENT_CONTEXT(ctx);
@@ -350,7 +348,7 @@ _mesa_LoadName( GLuint name )
*
* sa __GLcontextRec::Select.
*/
void GLAPIENTRY
static void GLAPIENTRY
_mesa_PushName( GLuint name )
{
GET_CURRENT_CONTEXT(ctx);
@@ -381,7 +379,7 @@ _mesa_PushName( GLuint name )
*
* sa __GLcontextRec::Select.
*/
void GLAPIENTRY
static void GLAPIENTRY
_mesa_PopName( void )
{
GET_CURRENT_CONTEXT(ctx);
@@ -424,7 +422,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);
@@ -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 */
/*@{*/

+ 42
- 20
src/mesa/main/feedback.h View File

@@ -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,
@@ -55,29 +59,47 @@ extern void
_mesa_update_hitflag( GLcontext *ctx, GLfloat z );


extern void GLAPIENTRY
_mesa_PassThrough( GLfloat token );
extern void
_mesa_init_feedback_dispatch(struct _glapi_table *disp);

#else /* FEATURE_feedback */

extern void GLAPIENTRY
_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer );
#define _MESA_INIT_FEEDBACK_FUNCTIONS(driver, impl) do { } while (0)

extern void GLAPIENTRY
_mesa_SelectBuffer( GLsizei size, GLuint *buffer );
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();
}

extern void GLAPIENTRY
_mesa_InitNames( void );

extern void GLAPIENTRY
_mesa_LoadName( GLuint name );
static INLINE void
_mesa_feedback_token( GLcontext *ctx, GLfloat token )
{
/* render mode is always GL_RENDER */
ASSERT_NO_FEATURE();
}

extern void GLAPIENTRY
_mesa_PushName( GLuint name );
static INLINE void
_mesa_update_hitflag( GLcontext *ctx, GLfloat z )
{
/* render mode is always GL_RENDER */
ASSERT_NO_FEATURE();
}

extern void GLAPIENTRY
_mesa_PopName( void );
static INLINE void
_mesa_init_feedback_dispatch(struct _glapi_table *disp)
{
}

extern GLint GLAPIENTRY
_mesa_RenderMode( GLenum mode );
#endif /* FEATURE_feedback */

extern void
_mesa_init_feedback( GLcontext *ctx );

#endif
#endif /* FEEDBACK_H */

Loading…
Cancel
Save