diff options
author | Ian Romanick <[email protected]> | 2009-09-10 15:33:45 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2009-09-10 15:33:45 -0700 |
commit | b8e1e8d2d8ae6ffbf8f271b46ee89788a926b3b0 (patch) | |
tree | 5db502ab80287bfc8ff61082784017c7448464f5 /src/mesa/main/histogram.c | |
parent | 81722c5d7e8e93d837510b9e6e5d014ec64cf4b3 (diff) | |
parent | d9dc4cb0e4f578da9e50c9d1ba6fd9c22ea2fca6 (diff) |
Merge branch 'master' into asm-shader-rework-2
Conflicts:
src/mesa/shader/lex.yy.c
src/mesa/shader/program_parse.tab.c
src/mesa/shader/program_parse.tab.h
Diffstat (limited to 'src/mesa/main/histogram.c')
-rw-r--r-- | src/mesa/main/histogram.c | 63 |
1 files changed, 11 insertions, 52 deletions
diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index 726a50d3b1b..ceb0d5a6a86 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -649,29 +649,11 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo return; } - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { - /* pack min/max values into a PBO */ - GLubyte *buf; - if (!_mesa_validate_pbo_access(1, &ctx->Pack, 2, 1, 1, - format, type, values)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetMinMax(invalid PBO access)"); - return; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - GL_WRITE_ONLY_ARB, - ctx->Pack.BufferObj); - if (!buf) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION,"glGetMinMax(PBO is mapped)"); - return; - } - values = ADD_POINTERS(buf, values); - } - else if (!values) { - /* not an error */ + + values = _mesa_map_validate_pbo_dest(ctx, 1, &ctx->Pack, 2, 1, 1, + format, type, values, "glGetMinmax"); + if (!values) return; - } { GLfloat minmax[2][4]; @@ -687,10 +669,7 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo format, type, values, &ctx->Pack, 0x0); } - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - ctx->Pack.BufferObj); - } + _mesa_unmap_pbo_dest(ctx, &ctx->Pack); if (reset) { _mesa_ResetMinmax(GL_MINMAX); @@ -733,38 +712,18 @@ _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, G return; } - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { - /* pack min/max values into a PBO */ - GLubyte *buf; - if (!_mesa_validate_pbo_access(1, &ctx->Pack, ctx->Histogram.Width, 1, 1, - format, type, values)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetHistogram(invalid PBO access)"); - return; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - GL_WRITE_ONLY_ARB, - ctx->Pack.BufferObj); - if (!buf) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx,GL_INVALID_OPERATION,"glGetHistogram(PBO is mapped)"); - return; - } - values = ADD_POINTERS(buf, values); - } - else if (!values) { - /* not an error */ + values = _mesa_map_validate_pbo_dest(ctx, 1, &ctx->Pack, + ctx->Histogram.Width, 1, 1, + format, type, values, + "glGetHistogram"); + if (!values) return; - } pack_histogram(ctx, ctx->Histogram.Width, (CONST GLuint (*)[4]) ctx->Histogram.Count, format, type, values, &ctx->Pack); - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - ctx->Pack.BufferObj); - } + _mesa_unmap_pbo_dest(ctx, &ctx->Pack); if (reset) { GLuint i; |