summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2011-08-29 21:23:19 -0600
committerBrian Paul <brianp@vmware.com>2011-08-29 21:36:51 -0600
commitf239b869e8b8a62547fe76f9f73d87e1ced16086 (patch)
tree1d835bc0f59b50fc2f49d57441d45c005a60a8db
parent56828f3a4f8b75cf79b13a367679bf1f8c3c632c (diff)
downloadmesa-f239b869e8b8a62547fe76f9f73d87e1ced16086.tar.gz
mesa: use ctx->Driver.GetTexImage() to decompress base texture image
This is a simple way to do the job and it removes one more use of the soon-to-be-removed gl_texture_image::FetchTexelc() function.
-rw-r--r--src/mesa/main/mipmap.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index cf9d522f2f1..9bf683f166a 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1985,14 +1985,13 @@ generate_mipmap_uncompressed(struct gl_context *ctx, GLenum target,
static void
generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj,
- const struct gl_texture_image *srcImage,
+ struct gl_texture_image *srcImage,
GLuint maxLevel)
{
GLint level;
gl_format temp_format;
GLenum datatype;
GLuint comps;
- GLuint row;
GLint components;
GLuint temp_src_stride, temp_dst_stride; /* in bytes */
GLchan *temp_src = NULL, *temp_dst = NULL;
@@ -2036,13 +2035,17 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
}
/* decompress base image to the temporary */
- for (row = 0; row < srcImage->Height; row++) {
- GLuint col;
- GLchan *dst = (GLchan *) temp_src + temp_src_stride * row;
- for (col = 0; col < srcImage->Width; col++) {
- srcImage->FetchTexelc(srcImage, col, row, 0, dst);
- dst += components;
- }
+ {
+ /* save pixel packing mode */
+ struct gl_pixelstore_attrib save = ctx->Pack;
+ /* use default/tight packing parameters */
+ ctx->Pack = ctx->DefaultPacking;
+ /* Get the uncompressed image */
+ ctx->Driver.GetTexImage(ctx, target, texObj->BaseLevel,
+ srcImage->_BaseFormat, GL_UNSIGNED_BYTE,
+ temp_src, texObj, srcImage);
+ /* restore packing mode */
+ ctx->Pack = save;
}
_mesa_format_to_type_and_comps(temp_format, &datatype, &comps);
@@ -2130,7 +2133,7 @@ void
_mesa_generate_mipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj)
{
- const struct gl_texture_image *srcImage;
+ struct gl_texture_image *srcImage;
GLint maxLevel;
ASSERT(texObj);