diff options
author | Brian Paul <[email protected]> | 2011-07-31 20:59:16 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-09-27 12:12:07 -0700 |
commit | 429b45e7c0001c0979e0d0fd20c3821c166da4a9 (patch) | |
tree | d6d4f193e74a1aca71e92e3d085f8ad6044548c1 | |
parent | 59348722b7a2a9ec689af0613fa8435f78a90cc4 (diff) |
mesa: Convert depth glGetTexImage() to using MapTextureImage().
Tested-by: Brian Paul <[email protected]>
-rw-r--r-- | src/mesa/main/texgetimage.c | 19 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 3 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index fdf0e1a49de..11494e53ad5 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -71,14 +71,13 @@ type_with_negative_values(GLenum type) static void get_tex_depth(struct gl_context *ctx, GLuint dimensions, GLenum format, GLenum type, GLvoid *pixels, - const struct gl_texture_image *texImage) + struct gl_texture_image *texImage) { const GLint width = texImage->Width; const GLint height = texImage->Height; const GLint depth = texImage->Depth; GLint img, row; GLfloat *depthRow = (GLfloat *) malloc(width * sizeof(GLfloat)); - const GLint texelSize = _mesa_get_format_bytes(texImage->TexFormat); if (!depthRow) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage"); @@ -86,18 +85,24 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions, } for (img = 0; img < depth; img++) { + GLubyte *srcMap; + GLint srcRowStride; + + /* map src texture buffer */ + ctx->Driver.MapTextureImage(ctx, texImage, img, + 0, 0, width, height, GL_MAP_READ_BIT, + &srcMap, &srcRowStride); + for (row = 0; row < height; row++) { void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels, width, height, format, type, img, row, 0); - const GLubyte *src = (GLubyte *) texImage->Data + - (texImage->ImageOffsets[img] + - texImage->RowStride * row) * texelSize; - + const GLubyte *src = srcMap + row * srcRowStride; _mesa_unpack_float_z_row(texImage->TexFormat, width, src, depthRow); - _mesa_pack_depth_span(ctx, width, dest, type, depthRow, &ctx->Pack); } + + ctx->Driver.UnmapTextureImage(ctx, texImage, img); } free(depthRow); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index eb73ce88228..560b6b56172 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -950,7 +950,8 @@ st_GetTexImage(struct gl_context * ctx, GLenum target, GLint level, return; } - if (format == GL_DEPTH_STENCIL_EXT) { + if (format == GL_DEPTH_STENCIL || + format == GL_DEPTH_COMPONENT) { do_map = GL_FALSE; } |