From 5c8873a3111031e77934eeedbf81b868617183e1 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 9 Sep 2009 11:12:49 +0800 Subject: mesa/main: Provide dummy texformats when FEATURE_texture_fxt1 is disabled. Instead of removing the related enums and texture formats, provide dummy ones when the feature is disabled. --- src/mesa/main/context.c | 2 -- src/mesa/main/texcompress_fxt1.c | 41 ++++++++++++++++++++++++++++++---------- src/mesa/main/texformat.h | 4 ---- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 2869a722ec..20307926a3 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -702,9 +702,7 @@ init_attrib_groups(GLcontext *ctx) #if FEATURE_texture_s3tc _mesa_init_texture_s3tc( ctx ); #endif -#if FEATURE_texture_fxt1 _mesa_init_texture_fxt1( ctx ); -#endif /* Miscellaneous */ ctx->NewState = _NEW_ALL; diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index fc151605c9..14de935e71 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -41,6 +41,9 @@ #include "texstore.h" +#if FEATURE_texture_fxt1 + + static void fxt1_encode (GLuint width, GLuint height, GLint comps, const void *source, GLint srcRowStride, @@ -51,16 +54,6 @@ fxt1_decode_1 (const void *texture, GLint stride, GLint i, GLint j, GLchan *rgba); -/** - * Called during context initialization. - */ -void -_mesa_init_texture_fxt1( GLcontext *ctx ) -{ - (void) ctx; -} - - /** * Called via TexFormat->StoreImage to store an RGB_FXT1 texture. */ @@ -224,6 +217,8 @@ fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage, } +#endif /* FEATURE_texture_fxt1 */ + const struct gl_texture_format _mesa_texformat_rgb_fxt1 = { MESA_FORMAT_RGB_FXT1, /* MesaFormat */ @@ -239,6 +234,7 @@ const struct gl_texture_format _mesa_texformat_rgb_fxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ +#if FEATURE_texture_fxt1 texstore_rgb_fxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ fetch_texel_2d_rgb_fxt1, /* FetchTexel2D */ @@ -247,6 +243,10 @@ const struct gl_texture_format _mesa_texformat_rgb_fxt1 = { fetch_texel_2d_f_rgb_fxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ +#else + _mesa_texstore_null, + _MESA_TEXFORMAT_NULL_OPS +#endif }; const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { @@ -263,6 +263,7 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ +#if FEATURE_texture_fxt1 texstore_rgba_fxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ fetch_texel_2d_rgba_fxt1, /* FetchTexel2D */ @@ -271,9 +272,16 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { fetch_texel_2d_f_rgba_fxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ +#else + _mesa_texstore_null, + _MESA_TEXFORMAT_NULL_OPS +#endif }; +#if FEATURE_texture_fxt1 + + /***************************************************************************\ * FXT1 encoder * @@ -1722,3 +1730,16 @@ fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */ decode_1[mode](code, t, rgba); } + + +#endif /* FEATURE_texture_fxt1 */ + + +/** + * Called during context initialization. + */ +void +_mesa_init_texture_fxt1( GLcontext *ctx ) +{ + (void) ctx; +} diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index b029fd8a74..b674301338 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -125,10 +125,8 @@ enum _format { * \name Compressed texture formats. */ /*@{*/ -#if FEATURE_texture_fxt1 MESA_FORMAT_RGB_FXT1, MESA_FORMAT_RGBA_FXT1, -#endif #if FEATURE_texture_s3tc MESA_FORMAT_RGB_DXT1, MESA_FORMAT_RGBA_DXT1, @@ -272,10 +270,8 @@ extern const struct gl_texture_format _mesa_texformat_ycbcr_rev; /** \name Compressed formats */ /*@{*/ -#if FEATURE_texture_fxt1 extern const struct gl_texture_format _mesa_texformat_rgb_fxt1; extern const struct gl_texture_format _mesa_texformat_rgba_fxt1; -#endif #if FEATURE_texture_s3tc extern const struct gl_texture_format _mesa_texformat_rgb_dxt1; extern const struct gl_texture_format _mesa_texformat_rgba_dxt1; -- cgit v1.2.3