summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-09-09 12:01:19 +0800
committerChia-I Wu <olvaffe@gmail.com>2009-09-12 20:55:59 +0800
commit4132e67e31fa14a1b529a0e16c5951d86db62ba2 (patch)
tree25c091f8743e7b6b0f0c7f9439b4735f4e82912a
parent5c8873a3111031e77934eeedbf81b868617183e1 (diff)
mesa/main: Provide dummy texformats when FEATURE_texture_s3tc is disabled.
Instead of removing the related enums and texture formats, provide dummy ones when the feature is disabled.
-rw-r--r--src/mesa/main/context.c2
-rw-r--r--src/mesa/main/texcompress_s3tc.c40
-rw-r--r--src/mesa/main/texformat.h8
3 files changed, 39 insertions, 11 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 20307926a3..4e637ff44b 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -699,9 +699,7 @@ init_attrib_groups(GLcontext *ctx)
if (!_mesa_init_texture( ctx ))
return GL_FALSE;
-#if FEATURE_texture_s3tc
_mesa_init_texture_s3tc( ctx );
-#endif
_mesa_init_texture_fxt1( ctx );
/* Miscellaneous */
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index a1c0f18f36..754cb33cc0 100644
--- a/src/mesa/main/texcompress_s3tc.c
+++ b/src/mesa/main/texcompress_s3tc.c
@@ -54,6 +54,10 @@
#define DXTN_LIBNAME "libtxc_dxtn.so"
#endif
+
+#if FEATURE_texture_s3tc
+
+
#if FEATURE_EXT_texture_sRGB
/**
* Convert an 8-bit sRGB value from non-linear space to a
@@ -564,7 +568,21 @@ fetch_texel_2d_f_srgba_dxt5( const struct gl_texture_image *texImage,
texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]);
texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]);
}
-#endif
+#endif /* FEATURE_EXT_texture_sRGB */
+
+
+#else /* FEATURE_texture_s3tc */
+
+
+void
+_mesa_init_texture_s3tc( GLcontext *ctx )
+{
+ (void) ctx;
+}
+
+
+#endif /* FEATURE_texture_s3tc */
+
const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
MESA_FORMAT_RGB_DXT1, /* MesaFormat */
@@ -580,6 +598,7 @@ const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
+#if FEATURE_texture_s3tc
texstore_rgb_dxt1, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */
@@ -588,6 +607,10 @@ const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
+#else
+ _mesa_texstore_null,
+ _MESA_TEXFORMAT_NULL_OPS
+#endif
};
const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
@@ -604,6 +627,7 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
+#if FEATURE_texture_s3tc
texstore_rgba_dxt1, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgba_dxt1, /* FetchTexel2D */
@@ -612,6 +636,10 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
+#else
+ _mesa_texstore_null,
+ _MESA_TEXFORMAT_NULL_OPS
+#endif
};
const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
@@ -628,6 +656,7 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
+#if FEATURE_texture_s3tc
texstore_rgba_dxt3, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgba_dxt3, /* FetchTexel2D */
@@ -636,6 +665,10 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
+#else
+ _mesa_texstore_null,
+ _MESA_TEXFORMAT_NULL_OPS
+#endif
};
const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
@@ -652,6 +685,7 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
+#if FEATURE_texture_s3tc
texstore_rgba_dxt5, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgba_dxt5, /* FetchTexel2D */
@@ -660,6 +694,10 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
+#else
+ _mesa_texstore_null,
+ _MESA_TEXFORMAT_NULL_OPS
+#endif
};
#if FEATURE_EXT_texture_sRGB
diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h
index b674301338..a4d8bbf831 100644
--- a/src/mesa/main/texformat.h
+++ b/src/mesa/main/texformat.h
@@ -112,12 +112,10 @@ enum _format {
MESA_FORMAT_SARGB8,
MESA_FORMAT_SL8,
MESA_FORMAT_SLA8,
-#if FEATURE_texture_s3tc
MESA_FORMAT_SRGB_DXT1,
MESA_FORMAT_SRGBA_DXT1,
MESA_FORMAT_SRGBA_DXT3,
MESA_FORMAT_SRGBA_DXT5,
-#endif
/*@}*/
#endif
@@ -127,12 +125,10 @@ enum _format {
/*@{*/
MESA_FORMAT_RGB_FXT1,
MESA_FORMAT_RGBA_FXT1,
-#if FEATURE_texture_s3tc
MESA_FORMAT_RGB_DXT1,
MESA_FORMAT_RGBA_DXT1,
MESA_FORMAT_RGBA_DXT3,
MESA_FORMAT_RGBA_DXT5,
-#endif
/*@}*/
/**
@@ -201,12 +197,10 @@ extern const struct gl_texture_format _mesa_texformat_srgba8;
extern const struct gl_texture_format _mesa_texformat_sargb8;
extern const struct gl_texture_format _mesa_texformat_sl8;
extern const struct gl_texture_format _mesa_texformat_sla8;
-#if FEATURE_texture_s3tc
extern const struct gl_texture_format _mesa_texformat_srgb_dxt1;
extern const struct gl_texture_format _mesa_texformat_srgba_dxt1;
extern const struct gl_texture_format _mesa_texformat_srgba_dxt3;
extern const struct gl_texture_format _mesa_texformat_srgba_dxt5;
-#endif
/*@}*/
#endif
@@ -272,12 +266,10 @@ extern const struct gl_texture_format _mesa_texformat_ycbcr_rev;
/*@{*/
extern const struct gl_texture_format _mesa_texformat_rgb_fxt1;
extern const struct gl_texture_format _mesa_texformat_rgba_fxt1;
-#if FEATURE_texture_s3tc
extern const struct gl_texture_format _mesa_texformat_rgb_dxt1;
extern const struct gl_texture_format _mesa_texformat_rgba_dxt1;
extern const struct gl_texture_format _mesa_texformat_rgba_dxt3;
extern const struct gl_texture_format _mesa_texformat_rgba_dxt5;
-#endif
/*@}*/
/** \name The null format */