Fix/improve framebuffer object reference counting.
[mesa.git] / src / mesa / main / texcompress_fxt1.c
index 58d4298dd659a90843ea797350d0c83641f94106..d3011cedce4987bb568ad7750d3945f4e04688cd 100644 (file)
@@ -35,6 +35,7 @@
 #include "context.h"
 #include "convolve.h"
 #include "image.h"
+#include "mipmap.h"
 #include "texcompress.h"
 #include "texformat.h"
 #include "texstore.h"
@@ -45,7 +46,7 @@ fxt1_encode (GLuint width, GLuint height, GLint comps,
              const void *source, GLint srcRowStride,
              void *dest, GLint destRowStride);
 
-static void
+void
 fxt1_decode_1 (const void *texture, GLint stride,
                GLint i, GLint j, GLchan *rgba);
 
@@ -64,7 +65,7 @@ _mesa_init_texture_fxt1( GLcontext *ctx )
  * Called via TexFormat->StoreImage to store an RGB_FXT1 texture.
  */
 static GLboolean
-texstore_rgb_fxt1(STORE_PARAMS)
+texstore_rgb_fxt1(TEXSTORE_PARAMS)
 {
    const GLchan *pixels;
    GLint srcRowStride;
@@ -76,7 +77,8 @@ texstore_rgb_fxt1(STORE_PARAMS)
    ASSERT(dstXoffset % 8 == 0);
    ASSERT(dstYoffset % 4 == 0);
    ASSERT(dstZoffset     == 0);
-   (void) dstZoffset; (void) dstImageStride;
+   (void) dstZoffset;
+   (void) dstImageOffsets;
 
    if (srcFormat != GL_RGB ||
        srcType != CHAN_TYPE ||
@@ -103,7 +105,7 @@ texstore_rgb_fxt1(STORE_PARAMS)
    }
 
    dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
-                                        GL_COMPRESSED_RGB_FXT1_3DFX,
+                                        dstFormat->MesaFormat,
                                         texWidth, (GLubyte *) dstAddr);
 
    fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride,
@@ -120,7 +122,7 @@ texstore_rgb_fxt1(STORE_PARAMS)
  * Called via TexFormat->StoreImage to store an RGBA_FXT1 texture.
  */
 static GLboolean
-texstore_rgba_fxt1(STORE_PARAMS)
+texstore_rgba_fxt1(TEXSTORE_PARAMS)
 {
    const GLchan *pixels;
    GLint srcRowStride;
@@ -132,7 +134,8 @@ texstore_rgba_fxt1(STORE_PARAMS)
    ASSERT(dstXoffset % 8 == 0);
    ASSERT(dstYoffset % 4 == 0);
    ASSERT(dstZoffset     == 0);
-   (void) dstZoffset; (void) dstImageStride;
+   (void) dstZoffset;
+   (void) dstImageOffsets;
 
    if (srcFormat != GL_RGBA ||
        srcType != CHAN_TYPE ||
@@ -159,7 +162,7 @@ texstore_rgba_fxt1(STORE_PARAMS)
    }
 
    dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
-                                        GL_COMPRESSED_RGBA_FXT1_3DFX,
+                                        dstFormat->MesaFormat,
                                         texWidth, (GLubyte *) dstAddr);
 
    fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride,
@@ -243,6 +246,7 @@ const struct gl_texture_format _mesa_texformat_rgb_fxt1 = {
    NULL, /*impossible*/                /* FetchTexel1Df */
    fetch_texel_2d_f_rgb_fxt1,          /* FetchTexel2Df */
    NULL, /*impossible*/                /* FetchTexel3Df */
+   NULL                                        /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
@@ -266,6 +270,7 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
    NULL, /*impossible*/                /* FetchTexel1Df */
    fetch_texel_2d_f_rgba_fxt1,                 /* FetchTexel2Df */
    NULL, /*impossible*/                /* FetchTexel3Df */
+   NULL                                        /* StoreTexel */
 };
 
 
@@ -1679,7 +1684,7 @@ fxt1_decode_1ALPHA (const GLubyte *code, GLint t, GLchan *rgba)
 }
 
 
-static void
+void
 fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */
                GLint i, GLint j, GLchan *rgba)
 {