aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-09-08 20:16:18 -0600
committerBrian Paul <[email protected]>2011-09-08 20:16:18 -0600
commitc6ca3ca5520289572859a4a874f69366f76ad421 (patch)
treeeb5dffc28c1105961c2dbb07bfad5df27429e8c6 /src/mesa
parent0386d9ac7782f51996ce8417083d32493b377003 (diff)
mesa: use _mesa_unpack_float_z_row in get_tex_depth()
Removes another use of the gl_texture_image::FetchTexelf() function.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/texgetimage.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index a39ac593384..4ab39a4dd57 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -77,8 +77,9 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions,
const GLint width = texImage->Width;
const GLint height = texImage->Height;
const GLint depth = texImage->Depth;
- GLint img, row, col;
+ 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");
@@ -90,11 +91,12 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions,
void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
width, height, format, type,
img, row, 0);
- assert(dest);
+ const GLubyte *src = (GLubyte *) texImage->Data +
+ (texImage->ImageOffsets[img] +
+ texImage->RowStride * row) * texelSize;
+
+ _mesa_unpack_float_z_row(texImage->TexFormat, width, src, depthRow);
- for (col = 0; col < width; col++) {
- texImage->FetchTexelf(texImage, col, row, img, depthRow + col);
- }
_mesa_pack_depth_span(ctx, width, dest, type, depthRow, &ctx->Pack);
}
}