summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-04-22 00:27:31 +0000
committerBrian Paul <[email protected]>2004-04-22 00:27:31 +0000
commitf959f6e1dc27c71fc0ccc56e09b29101b3bf3b97 (patch)
tree15b4171c2b3396e3a05f2776cc24d90cb37c8f84 /src/mesa/drivers/dri
parent05a6f2fd484bab59c6e6a381f58808adc26619f1 (diff)
New glTexImage code.
The gl_texture_format struct now has a StoreTexImageFunc that's called by glTex[Sub]Image[123]D to convert the user's texture data into the specific texture format layout. Now it's much easier to add new texture formats (like the 16/32-bit floating point formats). The texutil.[ch] and texutil_tmp.h files are obsolete.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/r200/r200_tex.c11
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_tex.c40
2 files changed, 43 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c
index 2a5603b4d5c..6ce143dacea 100644
--- a/src/mesa/drivers/dri/r200/r200_tex.c
+++ b/src/mesa/drivers/dri/r200/r200_tex.c
@@ -445,7 +445,6 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target,
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
- int texelBytes;
if (0)
fprintf(stderr, "intformat %s format %s type %s\n",
@@ -468,7 +467,6 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target,
case GL_RGBA:
if ( format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV ) {
texImage->TexFormat = &_mesa_texformat_argb8888;
- texelBytes = 4;
}
else
return 0;
@@ -477,7 +475,6 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target,
case GL_RGB:
if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
texImage->TexFormat = &_mesa_texformat_rgb565;
- texelBytes = 2;
}
else
return 0;
@@ -487,19 +484,16 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target,
if ( format == GL_YCBCR_MESA &&
type == GL_UNSIGNED_SHORT_8_8_REV_APPLE ) {
texImage->TexFormat = &_mesa_texformat_ycbcr_rev;
- texelBytes = 2;
}
else if ( format == GL_YCBCR_MESA &&
(type == GL_UNSIGNED_SHORT_8_8_APPLE ||
type == GL_UNSIGNED_BYTE)) {
texImage->TexFormat = &_mesa_texformat_ycbcr;
- texelBytes = 2;
}
else
return 0;
break;
-
-
+
default:
return 0;
}
@@ -538,7 +532,8 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target,
*/
texImage->Data = (void *)pixels;
texImage->IsClientData = GL_TRUE;
- texImage->RowStride = srcRowStride / texelBytes;
+ texImage->RowStride = srcRowStride / texImage->TexFormat->TexelBytes;
+
return 1;
}
}
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c
index 8c4ea2d46d5..608111032f1 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c
@@ -963,6 +963,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
return;
}
/* unpack image, apply transfer ops and store in tempImage */
+#if !NEWTEXSTORE
_mesa_transfer_teximage(ctx, 2, texImage->Format,
texImage->TexFormat,
tempImage,
@@ -970,6 +971,15 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
width * texelBytes,
0, /* dstImageStride */
format, type, pixels, packing);
+#else
+ texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
+ texImage->Format, tempImage,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ width * texelBytes, /* dstRowStride */
+ 0, /* dstImageStride */
+ width, height, 1,
+ format, type, pixels, packing);
+#endif
assert(!texImage->Data);
texImage->Data = MESA_PBUFFER_ALLOC(mml->width * mml->height * texelBytes);
if (!texImage->Data) {
@@ -993,6 +1003,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
return;
}
/* unpack image, apply transfer ops and store in texImage->Data */
+#if !NEWTEXSTORE
_mesa_transfer_teximage(ctx, 2, texImage->Format,
texImage->TexFormat, texImage->Data,
width, height, 1, 0, 0, 0,
@@ -1000,6 +1011,15 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
0, /* dstImageStride */
format, type, pixels, packing);
}
+#else
+ texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
+ texImage->Format, texImage->Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ width * texelBytes, /* dstRowStride */
+ 0, /* dstImageStride */
+ width, height, 1,
+ format, type, pixels, packing);
+#endif
RevalidateTexture(ctx, texObj);
@@ -1050,6 +1070,7 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
return;
}
+#if !NEWTEXSTORE
_mesa_transfer_teximage(ctx, 2, texImage->Format,/* Tex int format */
texImage->TexFormat, /* dest format */
(GLubyte *) tempImage, /* dest */
@@ -1058,6 +1079,15 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
width * texelBytes, /* dest row stride */
0, /* dst image stride */
format, type, pixels, packing);
+#else
+ texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
+ texImage->Format, texImage->Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ width * texelBytes, /* dstRowStride */
+ 0, /* dstImageStride */
+ width, height, 1,
+ format, type, pixels, packing);
+#endif
/* now rescale */
scaledImage = MALLOC(newWidth * newHeight * texelBytes);
@@ -1083,6 +1113,7 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
}
else {
/* no rescaling needed */
+#if !NEWTEXSTORE
_mesa_transfer_teximage(ctx, 2, texImage->Format, /* Tex int format */
texImage->TexFormat, /* dest format */
(GLubyte *) texImage->Data,/* dest */
@@ -1091,6 +1122,15 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
mml->width * texelBytes, /* dest row stride */
0, /* dst image stride */
format, type, pixels, packing);
+#else
+ texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
+ texImage->Format, texImage->Data,
+ xoffset, yoffset, 0,
+ mml->width * texelBytes, /* dstRowStride */
+ 0, /* dstImageStride */
+ width, height, 1,
+ format, type, pixels, packing);
+#endif
}
ti->reloadImages = GL_TRUE; /* signal the image needs to be reloaded */