diff options
author | Brian Paul <brianp@vmware.com> | 2009-08-13 14:00:21 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-08-13 14:00:21 -0600 |
commit | 36df6a6e91988590900a879b88eac7c7acc0a86d (patch) | |
tree | 6f96664967893f0ef33b223de8297e1f8f61f380 /src/mesa | |
parent | ad8a6937ae9933ab92f2b775410c27ec7a9afe42 (diff) |
mesa: add missing PBO mapping code in unpack_image()
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/dlist.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 9d0a2dca0d..2e36eee3de 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -681,7 +681,6 @@ translate_id(GLsizei n, GLenum type, const GLvoid * list) /** * Wrapper for _mesa_unpack_image() that handles pixel buffer objects. * If we run out of memory, GL_OUT_OF_MEMORY will be recorded. - * \todo This won't suffice when the PBO is really in VRAM/GPU memory. */ static GLvoid * unpack_image(GLcontext *ctx, GLuint dimensions, @@ -698,12 +697,27 @@ unpack_image(GLcontext *ctx, GLuint dimensions, } return image; } - else - if (_mesa_validate_pbo_access - (dimensions, unpack, width, height, depth, format, type, pixels)) { - const GLubyte *src = ADD_POINTERS(unpack->BufferObj->Data, pixels); - GLvoid *image = _mesa_unpack_image(dimensions, width, height, depth, - format, type, src, unpack); + else if (_mesa_validate_pbo_access(dimensions, unpack, width, height, depth, + format, type, pixels)) { + const GLubyte *map, *src; + GLvoid *image; + + map = (GLubyte *) + ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, unpack->BufferObj); + if (!map) { + /* unable to map src buffer! */ + _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO"); + return NULL; + } + + src = ADD_POINTERS(map, pixels); + image = _mesa_unpack_image(dimensions, width, height, depth, + format, type, src, unpack); + + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + unpack->BufferObj); + if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction"); } |