diff options
author | Dave Airlie <airlied@linux.ie> | 2008-04-16 20:25:08 +1000 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2008-04-16 20:25:08 +1000 |
commit | 09df5eaff2ba2694b82d1211fd24410cb2997e25 (patch) | |
tree | 0028ffd43d1895bb9e7d1ab0f5906629b0fa4825 /src/mesa/swrast/s_readpix.c | |
parent | 9566cf0e2f326d8fe638748d0bc10626e8c0387e (diff) | |
parent | b64448b3e4026d3f11f366515b7544a6581403f3 (diff) |
Merge branch 'master' into r500test
Conflicts:
src/mesa/drivers/dri/r300/r300_cmdbuf.c
src/mesa/drivers/dri/r300/r300_ioctl.c
Diffstat (limited to 'src/mesa/swrast/s_readpix.c')
-rw-r--r-- | src/mesa/swrast/s_readpix.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 8df15c8704..9140d12ea0 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -574,28 +574,10 @@ _swrast_ReadPixels( GLcontext *ctx, return; } - if (clippedPacking.BufferObj->Name) { - /* pack into PBO */ - GLubyte *buf; - if (!_mesa_validate_pbo_access(2, &clippedPacking, width, height, 1, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glReadPixels(invalid PBO access)"); - RENDER_FINISH(swrast, ctx); - return; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - GL_WRITE_ONLY_ARB, - clippedPacking.BufferObj); - if (!buf) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); - RENDER_FINISH(swrast, ctx); - return; - } - pixels = ADD_POINTERS(buf, pixels); - } - + pixels = _mesa_map_readpix_pbo(ctx, &clippedPacking, pixels); + if (!pixels) + return; + switch (format) { case GL_COLOR_INDEX: read_index_pixels(ctx, x, y, width, height, type, pixels, @@ -634,9 +616,5 @@ _swrast_ReadPixels( GLcontext *ctx, RENDER_FINISH(swrast, ctx); - if (clippedPacking.BufferObj->Name) { - /* done with PBO so unmap it now */ - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - clippedPacking.BufferObj); - } + _mesa_unmap_readpix_pbo(ctx, &clippedPacking); } |