summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-09-28 18:25:00 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-09-28 18:25:00 +0000
commit2f095b9b0945ce9982ddef2d622fc8d70fa91bd7 (patch)
tree526dbac3642bd861892fc321921085e49dcfa937
parent94b61f99c47ae71262d6fb74ad4b1b2d52958dde (diff)
new params for SpecificCompressedTexFormat() (Bill White)
-rw-r--r--src/mesa/main/dd.h13
-rw-r--r--src/mesa/main/teximage.c48
2 files changed, 38 insertions, 23 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 992bf5a4331..e83cbb9a9c5 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1,4 +1,4 @@
-/* $Id: dd.h,v 1.26.4.3 2000/09/07 15:30:48 brianp Exp $ */
+/* $Id: dd.h,v 1.26.4.4 2000/09/28 18:25:00 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -723,8 +723,15 @@ struct dd_function_table {
*/
GLint (*SpecificCompressedTexFormat)(GLcontext *ctx,
- GLint internalFormat,
- GLint numDimensions);
+ GLint internalFormat,
+ GLint numDimensions,
+ GLint *levelp,
+ GLsizei *widthp,
+ GLsizei *heightp,
+ GLsizei *depthp,
+ GLint *borderp,
+ GLenum *formatp,
+ GLenum *typep);
/* Called to turn a generic texture format into a specific
* texture format. For example, if a driver implements
* GL_3DFX_texture_compression_FXT1, this would map
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 28d967d72ca..b817b84bd3d 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1,3 +1,4 @@
+/* $Id: teximage.c,v 1.39.4.6 2000/09/28 18:25:00 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1348,7 +1349,14 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions,
*/
static GLint
get_specific_compressed_tex_format(GLcontext *ctx,
- GLint ifmt, GLint numDimensions)
+ GLint ifmt, GLint numDimensions,
+ GLint *levelp,
+ GLsizei *widthp,
+ GLsizei *heightp,
+ GLsizei *depthp,
+ GLint *borderp,
+ GLenum *formatp,
+ GLenum *typep)
{
char message[100];
GLint internalFormat = ifmt;
@@ -1357,22 +1365,14 @@ get_specific_compressed_tex_format(GLcontext *ctx,
&& ctx->Driver.SpecificCompressedTexFormat) {
/*
* First, ask the driver for the specific format.
+ * We do this for all formats, since we may want to
+ * fake one compressed format for another.
*/
- switch (internalFormat) {
- case GL_COMPRESSED_ALPHA_ARB:
- case GL_COMPRESSED_LUMINANCE_ARB:
- case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
- case GL_COMPRESSED_INTENSITY_ARB:
- case GL_COMPRESSED_RGB_ARB:
- case GL_COMPRESSED_RGBA_ARB:
- internalFormat = (*ctx->Driver.SpecificCompressedTexFormat)
- (ctx, internalFormat, numDimensions);
- /* XXX shouldn't we return now? */
- break;
- default:
- /* silence compiler warnings */
- ;
- }
+ internalFormat = (*ctx->Driver.SpecificCompressedTexFormat)
+ (ctx, internalFormat, numDimensions,
+ levelp,
+ widthp, heightp, depthp,
+ borderp, formatp, typep);
}
/*
@@ -1438,7 +1438,6 @@ get_specific_compressed_tex_format(GLcontext *ctx,
}
-
/*
* Called from the API. Note that width includes the border.
*/
@@ -1456,7 +1455,10 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_image *texImage;
GLint ifmt;
- ifmt = get_specific_compressed_tex_format(ctx, internalFormat, 1);
+ ifmt = get_specific_compressed_tex_format(ctx, internalFormat, 1,
+ &level,
+ &width, 0, 0,
+ &border, &format, &type);
if (ifmt < 0) {
/*
* The error here is that we were sent a generic compressed
@@ -1582,7 +1584,10 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_image *texImage;
GLint ifmt;
- ifmt = get_specific_compressed_tex_format(ctx, internalFormat, 2);
+ ifmt = get_specific_compressed_tex_format(ctx, internalFormat, 2,
+ &level,
+ &width, &height, 0,
+ &border, &format, &type);
if (ifmt < 0) {
/*
* The error here is that we were sent a generic compressed
@@ -1721,7 +1726,10 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_image *texImage;
GLint ifmt;
- ifmt = get_specific_compressed_tex_format(ctx, internalFormat, 3);
+ ifmt = get_specific_compressed_tex_format(ctx, internalFormat, 3,
+ &level,
+ &width, &height, &depth,
+ &border, &format, &type);
if (ifmt < 0) {
/*
* The error here is that we were sent a generic compressed