From 93c3911ca836187a99f28de3301b7957299dd75e Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 7 Sep 2009 18:06:00 +0800 Subject: 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. --- src/mesa/main/api_exec.c | 15 +-------------- src/mesa/main/context.c | 4 ---- src/mesa/main/histogram.c | 21 +++++++++++++++++++++ src/mesa/main/histogram.h | 22 +++++++++++++--------- 4 files changed, 35 insertions(+), 27 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index b363d4340e..6b529db5ec 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -76,9 +76,7 @@ #include "ffvertex_prog.h" #include "framebuffer.h" #include "hint.h" -#if FEATURE_histogram #include "histogram.h" -#endif #include "imports.h" #include "light.h" #include "lines.h" @@ -375,18 +373,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) _mesa_init_colortable_dispatch(exec); _mesa_init_convolve_dispatch(exec); -#if FEATURE_histogram - 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 + _mesa_init_histogram_dispatch(exec); /* OpenGL 2.0 */ SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 53a21ba4f5..a546e37b5f 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -106,9 +106,7 @@ #include "fog.h" #include "framebuffer.h" #include "get.h" -#if FEATURE_histogram #include "histogram.h" -#endif #include "hint.h" #include "hash.h" #include "light.h" @@ -693,9 +691,7 @@ init_attrib_groups(GLcontext *ctx) ctx->RenderMode = GL_RENDER; #endif _mesa_init_fog( ctx ); -#if FEATURE_histogram _mesa_init_histogram( ctx ); -#endif _mesa_init_hint( ctx ); _mesa_init_line( ctx ); _mesa_init_lighting( ctx ); diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index ceb0d5a6a8..3632adc03e 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -29,8 +29,11 @@ #include "context.h" #include "image.h" #include "histogram.h" +#include "glapi/dispatch.h" +#if FEATURE_histogram + /* * XXX the packed pixel formats haven't been tested. @@ -1043,6 +1046,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 *****/ diff --git a/src/mesa/main/histogram.h b/src/mesa/main/histogram.h index 367e9b11ba..ce3246baf4 100644 --- a/src/mesa/main/histogram.h +++ b/src/mesa/main/histogram.h @@ -36,10 +36,9 @@ #ifndef HISTOGRAM_H #define HISTOGRAM_H -#include "glheader.h" -#include "mtypes.h" +#include "main/mtypes.h" -#if _HAVE_FULL_GL +#if FEATURE_histogram extern void GLAPIENTRY _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values); @@ -71,13 +70,18 @@ _mesa_ResetHistogram(GLenum target); extern void GLAPIENTRY _mesa_ResetMinmax(GLenum target); -extern void _mesa_init_histogram( GLcontext * ctx ); +extern void +_mesa_init_histogram_dispatch(struct _glapi_table *disp); + +#else /* FEATURE_histogram */ -#else +static INLINE void +_mesa_init_histogram_dispatch(struct _glapi_table *disp) +{ +} -/** No-op */ -#define _mesa_init_histogram( c ) ((void) 0) +#endif /* FEATURE_histogram */ -#endif +extern void _mesa_init_histogram( GLcontext * ctx ); -#endif +#endif /* HISTOGRAM_H */ -- cgit v1.2.3