diff options
author | Brian Paul <[email protected]> | 2015-07-21 18:35:38 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2015-07-21 18:35:38 -0600 |
commit | e693fc299f1f78502b9201f1e1e8f333566c9fb6 (patch) | |
tree | 07139006583e68e73a2c6dbce2e44d83f444cca0 /src/mesa/main | |
parent | 096371879098c315bc054b6fe1ef6f4b8f18554f (diff) |
mesa: replace Driver.GetTexImage with GetTexSubImage()
The new driver hook has x/y/zoffset and width/height/depth parameters
for the new glGetTextureSubImage() function.
The meta code and gallium state tracker are updated to handle the
new parameters.
Callers to Driver.GetTexSubImage() pass in offsets=0 and sizes equal
to the whole texture size.
v2: update i965 driver code, s/GLint/GLsizei/ in GetTexSubImage hook
Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/dd.h | 10 | ||||
-rw-r--r-- | src/mesa/main/debug.c | 4 | ||||
-rw-r--r-- | src/mesa/main/mipmap.c | 9 | ||||
-rw-r--r-- | src/mesa/main/texgetimage.c | 15 | ||||
-rw-r--r-- | src/mesa/main/texgetimage.h | 9 |
5 files changed, 30 insertions, 17 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index d783e34222f..12e54de8b08 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -232,11 +232,13 @@ struct dd_function_table { /** - * Called by glGetTexImage(). + * Called by glGetTexImage(), glGetTextureSubImage(). */ - void (*GetTexImage)( struct gl_context *ctx, - GLenum format, GLenum type, GLvoid *pixels, - struct gl_texture_image *texImage ); + void (*GetTexSubImage)(struct gl_context *ctx, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLenum type, GLvoid *pixels, + struct gl_texture_image *texImage); /** * Called by glClearTex[Sub]Image diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 3090a007707..5ca7d5ce500 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -272,7 +272,9 @@ write_texture_image(struct gl_texture_object *texObj, store = ctx->Pack; /* save */ ctx->Pack = ctx->DefaultPacking; - ctx->Driver.GetTexImage(ctx, GL_RGBA, GL_UNSIGNED_BYTE, buffer, img); + ctx->Driver.GetTexSubImage(ctx, + 0, 0, 0, img->Width, img->Height, img->Depth, + 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 7732d09b2ec..1e22f930092 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -2077,9 +2077,12 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, /* Get the uncompressed image */ assert(srcImage->Level == texObj->BaseLevel); - ctx->Driver.GetTexImage(ctx, - temp_base_format, temp_datatype, - temp_src, srcImage); + ctx->Driver.GetTexSubImage(ctx, + 0, 0, 0, + srcImage->Width, srcImage->Height, + srcImage->Depth, + temp_base_format, temp_datatype, + temp_src, srcImage); /* restore packing mode */ ctx->Pack = save; } diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index de6db44ac26..a067aa57975 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -684,15 +684,17 @@ get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type, /** - * This is the software fallback for Driver.GetTexImage(). + * This is the software fallback for Driver.GetTexSubImage(). * All error checking will have been done before this routine is called. * We'll call ctx->Driver.MapTextureImage() to access the data, then * unmap with ctx->Driver.UnmapTextureImage(). */ void -_mesa_GetTexImage_sw(struct gl_context *ctx, - GLenum format, GLenum type, GLvoid *pixels, - struct gl_texture_image *texImage) +_mesa_GetTexSubImage_sw(struct gl_context *ctx, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLint depth, + GLenum format, GLenum type, GLvoid *pixels, + struct gl_texture_image *texImage) { const GLuint dimensions = _mesa_get_texture_dimensions(texImage->TexObject->Target); @@ -1022,7 +1024,10 @@ _mesa_get_texture_image(struct gl_context *ctx, _mesa_lock_texture(ctx, texObj); { - ctx->Driver.GetTexImage(ctx, format, type, pixels, texImage); + ctx->Driver.GetTexSubImage(ctx, 0, 0, 0, + texImage->Width, texImage->Height, + texImage->Depth, + format, type, pixels, texImage); } _mesa_unlock_texture(ctx, texObj); } diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h index 1fa2f59dcdc..611b1bd053f 100644 --- a/src/mesa/main/texgetimage.h +++ b/src/mesa/main/texgetimage.h @@ -37,10 +37,11 @@ extern GLenum _mesa_base_pack_format(GLenum format); extern void -_mesa_GetTexImage_sw(struct gl_context *ctx, - GLenum format, GLenum type, GLvoid *pixels, - struct gl_texture_image *texImage); - +_mesa_GetTexSubImage_sw(struct gl_context *ctx, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLint depth, + GLenum format, GLenum type, GLvoid *pixels, + struct gl_texture_image *texImage); extern void _mesa_GetCompressedTexImage_sw(struct gl_context *ctx, |