summaryrefslogtreecommitdiff
path: root/src/mesa/main/texcompress_s3tc.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-05-08 19:14:38 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-05-08 19:14:38 +0000
commit5999c5b620236fb6a996cf56759aec31f01c126b (patch)
tree393189b44ba4734119159d7a172c4f77eb0097c6 /src/mesa/main/texcompress_s3tc.c
parentc93c18abf1950e1494f11166e3f52973efbd6b75 (diff)
Fix a number of texture compression issues.
Pass the MESA_FORMAT_* token to the _mesa_compressed_row_stride(), _mesa_compressed_texture_size() and _mesa_compressed_image_address() functions since we want to use the driver-chosen format, not the user's internalFormat hint. Consolidate code related to choosing the texture format in texstoree.c
Diffstat (limited to 'src/mesa/main/texcompress_s3tc.c')
-rw-r--r--src/mesa/main/texcompress_s3tc.c64
1 files changed, 40 insertions, 24 deletions
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index 5a6685e0f3..c572e19e49 100644
--- a/src/mesa/main/texcompress_s3tc.c
+++ b/src/mesa/main/texcompress_s3tc.c
@@ -172,11 +172,13 @@ texstore_rgb_dxt1(STORE_PARAMS)
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
+ dstFormat->MesaFormat,
texWidth, (GLubyte *) dstAddr);
if (ext_tx_compress_dxtn) {
- (*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, dst, dstRowStride);
+ (*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels,
+ GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
+ dst, dstRowStride);
}
else {
_mesa_problem(ctx, "external dxt library not available");
@@ -232,10 +234,12 @@ texstore_rgba_dxt1(STORE_PARAMS)
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
+ dstFormat->MesaFormat,
texWidth, (GLubyte *) dstAddr);
if (ext_tx_compress_dxtn) {
- (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, dst, dstRowStride);
+ (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
+ GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
+ dst, dstRowStride);
}
else {
_mesa_problem(ctx, "external dxt library not available");
@@ -290,10 +294,12 @@ texstore_rgba_dxt3(STORE_PARAMS)
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
+ dstFormat->MesaFormat,
texWidth, (GLubyte *) dstAddr);
if (ext_tx_compress_dxtn) {
- (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, dst, dstRowStride);
+ (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
+ GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
+ dst, dstRowStride);
}
else {
_mesa_problem(ctx, "external dxt library not available");
@@ -348,10 +354,12 @@ texstore_rgba_dxt5(STORE_PARAMS)
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
- GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
+ dstFormat->MesaFormat,
texWidth, (GLubyte *) dstAddr);
if (ext_tx_compress_dxtn) {
- (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, dst, dstRowStride);
+ (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,
+ GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
+ dst, dstRowStride);
}
else {
_mesa_problem(ctx, "external dxt library not available");
@@ -368,12 +376,14 @@ static void
fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
- (void) k;
- if (fetch_ext_rgb_dxt1) {
- ASSERT (sizeof(GLchan) == sizeof(GLubyte));
- (*fetch_ext_rgb_dxt1)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
- }
- else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
+ (void) k;
+ if (fetch_ext_rgb_dxt1) {
+ ASSERT (sizeof(GLchan) == sizeof(GLubyte));
+ fetch_ext_rgb_dxt1(texImage->RowStride,
+ (GLubyte *)(texImage)->Data, i, j, texel);
+ }
+ else
+ _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
}
@@ -397,9 +407,11 @@ fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
{
(void) k;
if (fetch_ext_rgba_dxt1) {
- (*fetch_ext_rgba_dxt1)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
- }
- else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
+ fetch_ext_rgba_dxt1(texImage->RowStride,
+ (GLubyte *)(texImage)->Data, i, j, texel);
+ }
+ else
+ _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
}
@@ -423,10 +435,12 @@ fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
{
(void) k;
if (fetch_ext_rgba_dxt3) {
- ASSERT (sizeof(GLchan) == sizeof(GLubyte));
- (*fetch_ext_rgba_dxt3)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
- }
- else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
+ ASSERT (sizeof(GLchan) == sizeof(GLubyte));
+ fetch_ext_rgba_dxt3(texImage->RowStride, (GLubyte *)(texImage)->Data,
+ i, j, texel);
+ }
+ else
+ _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
}
@@ -450,9 +464,11 @@ fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
{
(void) k;
if (fetch_ext_rgba_dxt5) {
- (*fetch_ext_rgba_dxt5)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
- }
- else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
+ fetch_ext_rgba_dxt5(texImage->RowStride, (GLubyte *)(texImage)->Data,
+ i, j, texel);
+ }
+ else
+ _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
}