diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-03-21 13:41:00 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-03-21 13:41:00 -0600 |
commit | a429a25cd55b8c16356a60452de92228bb6c71b0 (patch) | |
tree | f743a3bc4e3a9a52582e8e4bbaf8545de132fb6c /src/mesa/swrast/s_drawpix.c | |
parent | 85ea7ff25cec703a00d79246df49a4ae6192c395 (diff) |
add a number of PBO validate/map/unmap functions
Helper functions for (some) drivers, including swrast.
Diffstat (limited to 'src/mesa/swrast/s_drawpix.c')
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 4733d10bb5..09ff96fd32 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -817,7 +817,6 @@ draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y, } - /** * Execute software-based glDrawPixels. * By time we get here, all error checking will have been done. @@ -840,27 +839,10 @@ _swrast_DrawPixels( GLcontext *ctx, if (swrast->NewState) _swrast_validate_derived( ctx ); - if (unpack->BufferObj->Name) { - /* unpack from PBO */ - GLubyte *buf; - if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawPixels(invalid PBO access)"); - RENDER_FINISH(swrast, ctx); - return; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - GL_READ_ONLY_ARB, - unpack->BufferObj); - if (!buf) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); - RENDER_FINISH(swrast, ctx); - return; - } - pixels = ADD_POINTERS(buf, pixels); - } + pixels = _mesa_validate_and_map_drawpix_pbo(ctx, width, height, + format, type, unpack, pixels); + if (!pixels) + return; switch (format) { case GL_STENCIL_INDEX: @@ -899,11 +881,7 @@ _swrast_DrawPixels( GLcontext *ctx, RENDER_FINISH(swrast,ctx); - if (unpack->BufferObj->Name) { - /* done with PBO so unmap it now */ - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - unpack->BufferObj); - } + _mesa_unmap_drapix_pbo(ctx, unpack); } |