summaryrefslogtreecommitdiff
path: root/src/mesa/main/texcompress.c
diff options
context:
space:
mode:
authorDaniel Borca <dborca@users.sourceforge.net>2003-10-29 14:35:31 +0000
committerDaniel Borca <dborca@users.sourceforge.net>2003-10-29 14:35:31 +0000
commit40bd9d0b190e11d39350d1b08d2c2b28e3040bca (patch)
treee41b12cb816b27f7d0380f8b305c582a039ea7a4 /src/mesa/main/texcompress.c
parente96a12101003ffdd61ce37f131631f4e6edaaa91 (diff)
texture compression
Diffstat (limited to 'src/mesa/main/texcompress.c')
-rw-r--r--src/mesa/main/texcompress.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index e6a9695722..1b9daac1e6 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -96,11 +96,20 @@ _mesa_compressed_texture_size( GLcontext *ctx,
{
GLuint size;
+ if (ctx->Driver.CompressedTextureSize) {
+ return ctx->Driver.CompressedTextureSize(ctx, width, height, depth, format);
+ }
+
switch (format) {
case GL_COMPRESSED_RGB_FXT1_3DFX:
case GL_COMPRESSED_RGBA_FXT1_3DFX:
/* round up to multiple of 4 */
size = ((width + 7) / 8) * ((height + 3) / 4) * 16;
+ /* Textures smaller than 4x4 will effectively be made into 4x4 and
+ * take 8 bytes.
+ */
+ if (size < 16)
+ size = 16;
return size;
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
@@ -150,6 +159,10 @@ _mesa_compressed_row_stride(GLenum format, GLsizei width)
GLint bytesPerTile, stride;
switch (format) {
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ bytesPerTile = 8;
+ break;
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
bytesPerTile = 8;
@@ -193,6 +206,10 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img,
(void) img;
switch (format) {
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ bytesPerTile = 8;
+ break;
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
bytesPerTile = 8;