mesa: Pass GL context to _mesa_create_save_table
[mesa.git] / src / mesa / main / texcompress_s3tc.c
index 230242c56b26943dd100cfb58e57a67fe274bac7..6476f118e64184fa1ca69df9f1af1102a0d5d994 100644 (file)
@@ -47,9 +47,6 @@
 #include "swrast/s_context.h"
 
 
-#if FEATURE_texture_s3tc
-
-
 #if defined(_WIN32) || defined(WIN32)
 #define DXTN_LIBNAME "dxtn.dll"
 #define RTLD_LAZY 0
@@ -60,7 +57,6 @@
 #define DXTN_LIBNAME "libtxc_dxtn.so"
 #endif
 
-#if FEATURE_EXT_texture_sRGB
 /**
  * Convert an 8-bit sRGB value from non-linear space to a
  * linear RGB value in [0, 1].
@@ -87,14 +83,13 @@ nonlinear_to_linear(GLubyte cs8)
    }
    return table[cs8];
 }
-#endif /* FEATURE_EXT_texture_sRGB */
 
 typedef void (*dxtFetchTexelFuncExt)( GLint srcRowstride, GLubyte *pixdata, GLint col, GLint row, GLvoid *texelOut );
 
-dxtFetchTexelFuncExt fetch_ext_rgb_dxt1 = NULL;
-dxtFetchTexelFuncExt fetch_ext_rgba_dxt1 = NULL;
-dxtFetchTexelFuncExt fetch_ext_rgba_dxt3 = NULL;
-dxtFetchTexelFuncExt fetch_ext_rgba_dxt5 = NULL;
+static dxtFetchTexelFuncExt fetch_ext_rgb_dxt1 = NULL;
+static dxtFetchTexelFuncExt fetch_ext_rgba_dxt1 = NULL;
+static dxtFetchTexelFuncExt fetch_ext_rgba_dxt3 = NULL;
+static dxtFetchTexelFuncExt fetch_ext_rgba_dxt5 = NULL;
 
 typedef void (*dxtCompressTexFuncExt)(GLint srccomps, GLint width,
                                       GLint height, const GLubyte *srcPixData,
@@ -203,8 +198,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
       _mesa_warning(ctx, "external dxt library not available: texstore_rgb_dxt1");
    }
 
-   if (tempImage)
-      free((void *) tempImage);
+   free((void *) tempImage);
 
    return GL_TRUE;
 }
@@ -256,8 +250,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
       _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt1");
    }
 
-   if (tempImage)
-      free((void*) tempImage);
+   free((void*) tempImage);
 
    return GL_TRUE;
 }
@@ -308,8 +301,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
       _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt3");
    }
 
-   if (tempImage)
-      free((void *) tempImage);
+   free((void *) tempImage);
 
    return GL_TRUE;
 }
@@ -360,8 +352,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
       _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt5");
    }
 
-   if (tempImage)
-      free((void *) tempImage);
+   free((void *) tempImage);
 
    return GL_TRUE;
 }
@@ -482,7 +473,6 @@ _mesa_fetch_texel_rgba_dxt5(const struct swrast_texture_image *texImage,
    texel[ACOMP] = UBYTE_TO_FLOAT(rgba[ACOMP]);
 }
 
-#if FEATURE_EXT_texture_sRGB
 void
 _mesa_fetch_texel_srgb_dxt1(const struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, GLfloat *texel)
@@ -534,7 +524,3 @@ _mesa_fetch_texel_srgba_dxt5(const struct swrast_texture_image *texImage,
    texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]);
    texel[ACOMP] = UBYTE_TO_FLOAT(rgba[ACOMP]);
 }
-#endif /* FEATURE_EXT_texture_sRGB */
-
-
-#endif /* FEATURE_texture_s3tc */