diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2009-09-10 15:33:45 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2009-09-10 15:33:45 -0700 |
commit | b8e1e8d2d8ae6ffbf8f271b46ee89788a926b3b0 (patch) | |
tree | 5db502ab80287bfc8ff61082784017c7448464f5 /src/mesa/main/colortab.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/colortab.c')
-rw-r--r-- | src/mesa/main/colortab.c | 62 |
1 files changed, 14 insertions, 48 deletions
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 36304065eb..5a7de5f209 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -179,26 +179,12 @@ store_colortable_entries(GLcontext *ctx, struct gl_color_table *table, GLfloat bScale, GLfloat bBias, GLfloat aScale, GLfloat aBias) { - if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) { - /* Get/unpack the color table data from a PBO */ - GLubyte *buf; - if (!_mesa_validate_pbo_access(1, &ctx->Unpack, count, 1, 1, - format, type, data)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glColor[Sub]Table(bad PBO access)"); - return; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - GL_READ_ONLY_ARB, - ctx->Unpack.BufferObj); - if (!buf) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glColor[Sub]Table(PBO mapped)"); - return; - } - data = ADD_POINTERS(buf, data); - } - + data = _mesa_map_validate_pbo_source(ctx, + 1, &ctx->Unpack, count, 1, 1, + format, type, data, + "glColor[Sub]Table"); + if (!data) + return; { /* convert user-provided data to GLfloat values */ @@ -279,10 +265,7 @@ store_colortable_entries(GLcontext *ctx, struct gl_color_table *table, } } - if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) { - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - ctx->Unpack.BufferObj); - } + _mesa_unmap_pbo_source(ctx, &ctx->Unpack); } @@ -696,34 +679,17 @@ _mesa_GetColorTable( GLenum target, GLenum format, return; } - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { - /* pack color table into PBO */ - GLubyte *buf; - if (!_mesa_validate_pbo_access(1, &ctx->Pack, table->Size, 1, 1, - format, type, data)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetColorTable(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, - "glGetColorTable(PBO is mapped)"); - return; - } - data = ADD_POINTERS(buf, data); - } + data = _mesa_map_validate_pbo_dest(ctx, + 1, &ctx->Pack, table->Size, 1, 1, + format, type, data, + "glGetColorTable"); + if (!data) + return; _mesa_pack_rgba_span_float(ctx, table->Size, rgba, format, type, data, &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); } |