mesa/main: Make FEATURE_histogram follow feature conventions.

As shown in mfeatures.h, this allows users of histogram.h to work without
knowing if the feature is available.
This commit is contained in:
Chia-I Wu
2009-09-07 18:06:00 +08:00
committed by Brian Paul
parent 2b36db496d
commit cab7ea0368
4 changed files with 47 additions and 65 deletions

View File

@@ -76,9 +76,7 @@
#include "ffvertex_prog.h" #include "ffvertex_prog.h"
#include "framebuffer.h" #include "framebuffer.h"
#include "hint.h" #include "hint.h"
#if FEATURE_histogram
#include "histogram.h" #include "histogram.h"
#endif
#include "imports.h" #include "imports.h"
#include "light.h" #include "light.h"
#include "lines.h" #include "lines.h"
@@ -375,18 +373,7 @@ _mesa_init_exec_table(struct _glapi_table *exec)
_mesa_init_colortable_dispatch(exec); _mesa_init_colortable_dispatch(exec);
_mesa_init_convolve_dispatch(exec); _mesa_init_convolve_dispatch(exec);
#if FEATURE_histogram _mesa_init_histogram_dispatch(exec);
SET_GetHistogram(exec, _mesa_GetHistogram);
SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv);
SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv);
SET_GetMinmax(exec, _mesa_GetMinmax);
SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv);
SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv);
SET_Histogram(exec, _mesa_Histogram);
SET_Minmax(exec, _mesa_Minmax);
SET_ResetHistogram(exec, _mesa_ResetHistogram);
SET_ResetMinmax(exec, _mesa_ResetMinmax);
#endif
/* OpenGL 2.0 */ /* OpenGL 2.0 */
SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate); SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate);

View File

@@ -106,9 +106,7 @@
#include "fog.h" #include "fog.h"
#include "framebuffer.h" #include "framebuffer.h"
#include "get.h" #include "get.h"
#if FEATURE_histogram
#include "histogram.h" #include "histogram.h"
#endif
#include "hint.h" #include "hint.h"
#include "hash.h" #include "hash.h"
#include "light.h" #include "light.h"
@@ -693,9 +691,7 @@ init_attrib_groups(GLcontext *ctx)
ctx->RenderMode = GL_RENDER; ctx->RenderMode = GL_RENDER;
#endif #endif
_mesa_init_fog( ctx ); _mesa_init_fog( ctx );
#if FEATURE_histogram
_mesa_init_histogram( ctx ); _mesa_init_histogram( ctx );
#endif
_mesa_init_hint( ctx ); _mesa_init_hint( ctx );
_mesa_init_line( ctx ); _mesa_init_line( ctx );
_mesa_init_lighting( ctx ); _mesa_init_lighting( ctx );

View File

@@ -29,8 +29,11 @@
#include "context.h" #include "context.h"
#include "image.h" #include "image.h"
#include "histogram.h" #include "histogram.h"
#include "glapi/dispatch.h"
#if FEATURE_histogram
/* /*
* XXX the packed pixel formats haven't been tested. * XXX the packed pixel formats haven't been tested.
@@ -614,7 +617,11 @@ base_histogram_format( GLenum format )
*/ */
void GLAPIENTRY /* this is defined below */
static void GLAPIENTRY _mesa_ResetMinmax(GLenum target);
static void GLAPIENTRY
_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
@@ -677,7 +684,7 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo
} }
void GLAPIENTRY static void GLAPIENTRY
_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
@@ -737,7 +744,7 @@ _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, G
} }
void GLAPIENTRY static void GLAPIENTRY
_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
@@ -784,7 +791,7 @@ _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
} }
void GLAPIENTRY static void GLAPIENTRY
_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
@@ -831,7 +838,7 @@ _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
} }
void GLAPIENTRY static void GLAPIENTRY
_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
@@ -857,7 +864,7 @@ _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
} }
void GLAPIENTRY static void GLAPIENTRY
_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
@@ -883,7 +890,7 @@ _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
} }
void GLAPIENTRY static void GLAPIENTRY
_mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink)
{ {
GLuint i; GLuint i;
@@ -966,7 +973,7 @@ _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean s
} }
void GLAPIENTRY static void GLAPIENTRY
_mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
@@ -994,7 +1001,7 @@ _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
} }
void GLAPIENTRY static void GLAPIENTRY
_mesa_ResetHistogram(GLenum target) _mesa_ResetHistogram(GLenum target)
{ {
GLuint i; GLuint i;
@@ -1020,7 +1027,7 @@ _mesa_ResetHistogram(GLenum target)
} }
void GLAPIENTRY static void GLAPIENTRY
_mesa_ResetMinmax(GLenum target) _mesa_ResetMinmax(GLenum target)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
@@ -1043,6 +1050,24 @@ _mesa_ResetMinmax(GLenum target)
} }
void
_mesa_init_histogram_dispatch(struct _glapi_table *disp)
{
SET_GetHistogram(disp, _mesa_GetHistogram);
SET_GetHistogramParameterfv(disp, _mesa_GetHistogramParameterfv);
SET_GetHistogramParameteriv(disp, _mesa_GetHistogramParameteriv);
SET_GetMinmax(disp, _mesa_GetMinmax);
SET_GetMinmaxParameterfv(disp, _mesa_GetMinmaxParameterfv);
SET_GetMinmaxParameteriv(disp, _mesa_GetMinmaxParameteriv);
SET_Histogram(disp, _mesa_Histogram);
SET_Minmax(disp, _mesa_Minmax);
SET_ResetHistogram(disp, _mesa_ResetHistogram);
SET_ResetMinmax(disp, _mesa_ResetMinmax);
}
#endif /* FEATURE_histogram */
/**********************************************************************/ /**********************************************************************/
/***** Initialization *****/ /***** Initialization *****/

View File

@@ -36,48 +36,22 @@
#ifndef HISTOGRAM_H #ifndef HISTOGRAM_H
#define HISTOGRAM_H #define HISTOGRAM_H
#include "glheader.h" #include "main/mtypes.h"
#include "mtypes.h"
#if _HAVE_FULL_GL #if FEATURE_histogram
extern void GLAPIENTRY extern void
_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values); _mesa_init_histogram_dispatch(struct _glapi_table *disp);
extern void GLAPIENTRY #else /* FEATURE_histogram */
_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
extern void GLAPIENTRY static INLINE void
_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params); _mesa_init_histogram_dispatch(struct _glapi_table *disp)
{
}
extern void GLAPIENTRY #endif /* FEATURE_histogram */
_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params);
extern void GLAPIENTRY
_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params);
extern void GLAPIENTRY
_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params);
extern void GLAPIENTRY
_mesa_Histogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
extern void GLAPIENTRY
_mesa_Minmax(GLenum target, GLenum internalformat, GLboolean sink);
extern void GLAPIENTRY
_mesa_ResetHistogram(GLenum target);
extern void GLAPIENTRY
_mesa_ResetMinmax(GLenum target);
extern void _mesa_init_histogram( GLcontext * ctx ); extern void _mesa_init_histogram( GLcontext * ctx );
#else #endif /* HISTOGRAM_H */
/** No-op */
#define _mesa_init_histogram( c ) ((void) 0)
#endif
#endif