From 59348722b7a2a9ec689af0613fa8435f78a90cc4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 31 Jul 2011 20:48:24 -0700 Subject: mesa: Convert depth/stencil glGetTexImage() to using MapTextureImage(). Note that the implementation before and after appears to be broken in its handling of Z24_S8 vs S8_Z24. Tested-by: Brian Paul --- src/mesa/main/texgetimage.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 199fb5cb900..fdf0e1a49de 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -110,27 +110,35 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions, static void get_tex_depth_stencil(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; - const GLint rowstride = texImage->RowStride; - const GLuint *src = (const GLuint *) texImage->Data; GLint img, row; for (img = 0; img < depth; img++) { + GLubyte *srcMap; + GLint rowstride; + + /* map src texture buffer */ + ctx->Driver.MapTextureImage(ctx, texImage, img, + 0, 0, width, height, GL_MAP_READ_BIT, + &srcMap, &rowstride); + for (row = 0; row < height; row++) { + const GLubyte *src = srcMap + row * rowstride; void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels, width, height, format, type, img, row, 0); + /* XXX Z24_S8 vs. S8_Z24??? */ memcpy(dest, src, width * sizeof(GLuint)); if (ctx->Pack.SwapBytes) { _mesa_swap4((GLuint *) dest, width); } - - src += rowstride; } + + ctx->Driver.UnmapTextureImage(ctx, texImage, img); } } -- cgit v1.2.3