Mesa (master): mesa: Switch ycbcr glGetTexImage() to using MapTextureImage( ).
Eric Anholt
anholt at kemper.freedesktop.org
Tue Sep 27 19:12:54 UTC 2011
Module: Mesa
Branch: master
Commit: 0c513a9c1b5125ba647c17f330635ded46d4d174
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c513a9c1b5125ba647c17f330635ded46d4d174
Author: Brian Paul <brianp at vmware.com>
Date: Sun Jul 31 20:39:14 2011 -0700
mesa: Switch ycbcr glGetTexImage() to using MapTextureImage().
Tested-by: Brian Paul <brianp at vmware.com>
---
src/mesa/main/texgetimage.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index e568607..199fb5c 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -141,17 +141,24 @@ get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions,
static void
get_tex_ycbcr(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 GLushort *src = (const GLushort *) 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);
@@ -168,9 +175,9 @@ get_tex_ycbcr(struct gl_context *ctx, GLuint dimensions,
else if (ctx->Pack.SwapBytes) {
_mesa_swap2((GLushort *) dest, width);
}
-
- src += rowstride;
}
+
+ ctx->Driver.UnmapTextureImage(ctx, texImage, img);
}
}
More information about the mesa-commit
mailing list