From 5bcfe4b5c81f850d68d3100b8bcd2f2b74a258a6 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 7 Sep 2009 17:17:11 +0800 Subject: mesa/main: Make FEATURE_colortable follow feature conventions. As shown in mfeatures.h, this allows users of colortab.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 14 +------------- src/mesa/main/colortab.c | 23 +++++++++++++++++++++++ src/mesa/main/colortab.h | 41 +++++++++++++++++++++++------------------ src/mesa/main/context.c | 6 ------ src/mesa/main/texobj.c | 4 ---- src/mesa/main/texstate.c | 6 ------ 6 files changed, 47 insertions(+), 47 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 39941a1b03..30c142e53a 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -54,9 +54,7 @@ #endif #include "clear.h" #include "clip.h" -#if FEATURE_colortable #include "colortab.h" -#endif #include "context.h" #if FEATURE_convolve #include "convolve.h" @@ -385,17 +383,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_BlendEquation(exec, _mesa_BlendEquation); SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT); -#if FEATURE_colortable - SET_ColorSubTable(exec, _mesa_ColorSubTable); - SET_ColorTable(exec, _mesa_ColorTable); - SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv); - SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv); - SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable); - SET_CopyColorTable(exec, _mesa_CopyColorTable); - SET_GetColorTable(exec, _mesa_GetColorTable); - SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv); - SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv); -#endif + _mesa_init_colortable_dispatch(exec); #if FEATURE_convolve SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D); diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 5a7de5f209..d6f3121cb4 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -31,6 +31,10 @@ #include "macros.h" #include "state.h" #include "teximage.h" +#include "glapi/dispatch.h" + + +#if FEATURE_colortable /** @@ -1044,6 +1048,25 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) } } + +void +_mesa_init_colortable_dispatch(struct _glapi_table *disp) +{ + SET_ColorSubTable(disp, _mesa_ColorSubTable); + SET_ColorTable(disp, _mesa_ColorTable); + SET_ColorTableParameterfv(disp, _mesa_ColorTableParameterfv); + SET_ColorTableParameteriv(disp, _mesa_ColorTableParameteriv); + SET_CopyColorSubTable(disp, _mesa_CopyColorSubTable); + SET_CopyColorTable(disp, _mesa_CopyColorTable); + SET_GetColorTable(disp, _mesa_GetColorTable); + SET_GetColorTableParameterfv(disp, _mesa_GetColorTableParameterfv); + SET_GetColorTableParameteriv(disp, _mesa_GetColorTableParameteriv); +} + + +#endif /* FEATURE_colortable */ + + /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ diff --git a/src/mesa/main/colortab.h b/src/mesa/main/colortab.h index b6ff737a65..ec28ceca9d 100644 --- a/src/mesa/main/colortab.h +++ b/src/mesa/main/colortab.h @@ -27,9 +27,16 @@ #define COLORTAB_H -#include "mtypes.h" +#include "main/mtypes.h" -#if _HAVE_FULL_GL +#if FEATURE_colortable + +#define _MESA_INIT_COLORTABLE_FUNCTIONS(driver, impl) \ + do { \ + (driver)->CopyColorTable = impl ## CopyColorTable; \ + (driver)->CopyColorSubTable = impl ## CopyColorSubTable; \ + (driver)->UpdateTexturePalette = impl ## UpdateTexturePalette; \ + } while (0) extern void GLAPIENTRY _mesa_ColorTable( GLenum target, GLenum internalformat, @@ -67,6 +74,19 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ); extern void GLAPIENTRY _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ); +extern void +_mesa_init_colortable_dispatch(struct _glapi_table *disp); + +#else /* FEATURE_colortable */ + +#define _MESA_INIT_COLORTABLE_FUNCTIONS(driver, impl) do { } while (0) + +static INLINE void +_mesa_init_colortable_dispatch(struct _glapi_table *disp) +{ +} + +#endif /* FEATURE_colortable */ extern void @@ -81,20 +101,5 @@ _mesa_init_colortables( GLcontext *ctx ); extern void _mesa_free_colortables_data( GLcontext *ctx ); -#else - -/** No-op */ -#define _mesa_init_colortable( p ) ((void) 0) - -/** No-op */ -#define _mesa_free_colortable_data( p ) ((void) 0) - -/** No-op */ -#define _mesa_init_colortables( p ) ((void)0) - -/** No-op */ -#define _mesa_free_colortables_data( p ) ((void)0) - -#endif -#endif +#endif /* COLORTAB_H */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index f6d4ac4595..1907c799df 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -90,9 +90,7 @@ #include "blend.h" #include "buffers.h" #include "bufferobj.h" -#if FEATURE_colortable #include "colortab.h" -#endif #include "context.h" #include "cpuinfo.h" #include "debug.h" @@ -686,9 +684,7 @@ init_attrib_groups(GLcontext *ctx) #endif _mesa_init_buffer_objects( ctx ); _mesa_init_color( ctx ); -#if FEATURE_colortable _mesa_init_colortables( ctx ); -#endif _mesa_init_current( ctx ); _mesa_init_depth( ctx ); _mesa_init_debug( ctx ); @@ -1015,9 +1011,7 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_texture_data( ctx ); _mesa_free_matrix_data( ctx ); _mesa_free_viewport_data( ctx ); -#if FEATURE_colortable _mesa_free_colortables_data( ctx ); -#endif _mesa_free_program_data(ctx); _mesa_free_shader_state(ctx); #if FEATURE_ARB_occlusion_query diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index d09c439250..678845ece0 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -29,9 +29,7 @@ #include "mfeatures.h" -#if FEATURE_colortable #include "colortab.h" -#endif #include "context.h" #include "enums.h" #include "fbobject.h" @@ -194,9 +192,7 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) */ texObj->Target = 0x99; -#if FEATURE_colortable _mesa_free_colortable_data(&texObj->Palette); -#endif /* free the texture images */ for (face = 0; face < 6; face++) { diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 861c5f37c4..b9311d0ffc 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -31,9 +31,7 @@ #include "glheader.h" #include "mfeatures.h" #include "colormac.h" -#if FEATURE_colortable #include "colortab.h" -#endif #include "context.h" #include "enums.h" #include "macros.h" @@ -753,9 +751,7 @@ _mesa_init_texture(GLcontext *ctx) ctx->Texture.CurrentUnit = 0; /* multitexture */ ctx->Texture._EnabledUnits = 0x0; ctx->Texture.SharedPalette = GL_FALSE; -#if FEATURE_colortable _mesa_init_colortable(&ctx->Texture.Palette); -#endif for (u = 0; u < MAX_TEXTURE_UNITS; u++) init_texture_unit(ctx, u); @@ -796,10 +792,8 @@ _mesa_free_texture_data(GLcontext *ctx) for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]); -#if FEATURE_colortable for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) _mesa_free_colortable_data(&ctx->Texture.Unit[u].ColorTable); -#endif } -- cgit v1.2.3