aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-09-30 08:15:30 -0600
committerBrian Paul <[email protected]>2011-09-30 08:15:30 -0600
commit4368a657670f1f3f13d8497f749cb5439f91529e (patch)
tree71965b364e065ee9cc360eb0a0e99cd3be0e7553 /src/mesa/main
parentd742a64909b2b414fc94b6f525a13ce09ca7f9f7 (diff)
mesa: simplify parameters to GetTexImage() driver hook
The target, level and texObj can be obtained through the texImage parameter. We could make similar changes for the TexImage() hooks too. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/dd.h3
-rw-r--r--src/mesa/main/debug.c4
-rw-r--r--src/mesa/main/mipmap.c5
-rw-r--r--src/mesa/main/texgetimage.c22
-rw-r--r--src/mesa/main/texgetimage.h3
5 files changed, 16 insertions, 21 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 720e4f53d6a..91ecc0be03f 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -284,9 +284,8 @@ struct dd_function_table {
/**
* Called by glGetTexImage().
*/
- void (*GetTexImage)( struct gl_context *ctx, GLenum target, GLint level,
+ void (*GetTexImage)( struct gl_context *ctx,
GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_object *texObj,
struct gl_texture_image *texImage );
/**
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 0a393e5fa29..6e695d1474c 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -268,9 +268,7 @@ write_texture_image(struct gl_texture_object *texObj,
store = ctx->Pack; /* save */
ctx->Pack = ctx->DefaultPacking;
- ctx->Driver.GetTexImage(ctx, texObj->Target, level,
- GL_RGBA, GL_UNSIGNED_BYTE,
- buffer, texObj, img);
+ ctx->Driver.GetTexImage(ctx, GL_RGBA, GL_UNSIGNED_BYTE, buffer, img);
/* make filename */
_mesa_snprintf(s, sizeof(s), "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face);
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index e0cc6a2ad5f..7325a420f0e 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -2032,9 +2032,10 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
ctx->Pack = ctx->DefaultPacking;
/* Get the uncompressed image */
- ctx->Driver.GetTexImage(ctx, target, texObj->BaseLevel,
+ assert(srcImage->Level == texObj->BaseLevel);
+ ctx->Driver.GetTexImage(ctx,
temp_base_format, temp_datatype,
- temp_src, texObj, srcImage);
+ temp_src, srcImage);
/* restore packing mode */
ctx->Pack = save;
}
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index d2f25b9f802..62a55dff8ba 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -373,9 +373,9 @@ get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
static GLboolean
get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type,
GLvoid *pixels,
- struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
+ const GLenum target = texImage->TexObject->Target;
GLboolean memCopy = GL_FALSE;
/*
@@ -384,11 +384,11 @@ get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type,
* so we don't have to worry about those.
* XXX more format combinations could be supported here.
*/
- if ((texObj->Target == GL_TEXTURE_1D ||
- texObj->Target == GL_TEXTURE_2D ||
- texObj->Target == GL_TEXTURE_RECTANGLE ||
- (texObj->Target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
- texObj->Target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) {
+ if ((target == GL_TEXTURE_1D ||
+ target == GL_TEXTURE_2D ||
+ target == GL_TEXTURE_RECTANGLE ||
+ (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) {
if ((texImage->TexFormat == MESA_FORMAT_ARGB8888 ||
texImage->TexFormat == MESA_FORMAT_SARGB8) &&
format == GL_BGRA &&
@@ -471,14 +471,13 @@ get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type,
* unmap with ctx->Driver.UnmapTextureImage().
*/
void
-_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_get_teximage(struct gl_context *ctx,
GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
GLuint dimensions;
- switch (target) {
+ switch (texImage->TexObject->Target) {
case GL_TEXTURE_1D:
dimensions = 1;
break;
@@ -511,7 +510,7 @@ _mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
pixels = ADD_POINTERS(buf, pixels);
}
- if (get_tex_memcpy(ctx, format, type, pixels, texObj, texImage)) {
+ if (get_tex_memcpy(ctx, format, type, pixels, texImage)) {
/* all done */
}
else if (format == GL_DEPTH_COMPONENT) {
@@ -772,8 +771,7 @@ _mesa_GetnTexImageARB( GLenum target, GLint level, GLenum format,
_mesa_lock_texture(ctx, texObj);
{
- ctx->Driver.GetTexImage(ctx, target, level, format, type, pixels,
- texObj, texImage);
+ ctx->Driver.GetTexImage(ctx, format, type, pixels, texImage);
}
_mesa_unlock_texture(ctx, texObj);
}
diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h
index 8612705ca88..02b1cf4599c 100644
--- a/src/mesa/main/texgetimage.h
+++ b/src/mesa/main/texgetimage.h
@@ -34,9 +34,8 @@ struct gl_texture_image;
struct gl_texture_object;
extern void
-_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_get_teximage(struct gl_context *ctx,
GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_object *texObj,
struct gl_texture_image *texImage);