diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/api_arrayelt.c | 2 | ||||
-rw-r--r-- | src/mesa/main/arrayobj.c | 20 | ||||
-rw-r--r-- | src/mesa/main/bufferobj.c | 2 | ||||
-rw-r--r-- | src/mesa/main/bufferobj.h | 11 | ||||
-rw-r--r-- | src/mesa/main/compute.c | 2 | ||||
-rw-r--r-- | src/mesa/main/dlist.c | 2 | ||||
-rw-r--r-- | src/mesa/main/draw.c | 22 | ||||
-rw-r--r-- | src/mesa/main/draw_validate.c | 8 | ||||
-rw-r--r-- | src/mesa/main/drawpix.c | 4 | ||||
-rw-r--r-- | src/mesa/main/objectpurge.c | 2 | ||||
-rw-r--r-- | src/mesa/main/pbo.c | 26 | ||||
-rw-r--r-- | src/mesa/main/pixel.c | 14 | ||||
-rw-r--r-- | src/mesa/main/readpix.c | 4 | ||||
-rw-r--r-- | src/mesa/main/texgetimage.c | 18 | ||||
-rw-r--r-- | src/mesa/main/varray.c | 8 | ||||
-rw-r--r-- | src/mesa/main/varray.h | 2 |
16 files changed, 68 insertions, 79 deletions
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index 0dae3ef7740..bc74cede5fe 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -1415,7 +1415,7 @@ attrib_src(const struct gl_vertex_array_object *vao, &vao->BufferBinding[array->BufferBindingIndex]; const GLubyte *src = _mesa_vertex_attrib_address(array, binding); - if (_mesa_is_bufferobj(binding->BufferObj)) { + if (binding->BufferObj) { src = ADD_POINTERS(binding->BufferObj->Mappings[MAP_INTERNAL].Pointer, src); } diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index cf848bc177e..cba5cbdb01a 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -409,7 +409,7 @@ compute_vbo_offset_range(const struct gl_vertex_array_object *vao, GLsizeiptr* min, GLsizeiptr* max) { /* The function is meant to work on VBO bindings */ - assert(_mesa_is_bufferobj(binding->BufferObj)); + assert(binding->BufferObj); /* Start with an inverted range of relative offsets. */ GLuint min_offset = ~(GLuint)0; @@ -554,7 +554,7 @@ _mesa_update_vao_derived_arrays(struct gl_context *ctx, struct gl_vertex_buffer_binding *binding = &vao->BufferBinding[bindex]; /* The scan goes different for user space arrays than vbos */ - if (_mesa_is_bufferobj(binding->BufferObj)) { + if (binding->BufferObj) { /* The bound arrays. */ const GLbitfield bound = enabled & binding->_BoundArrays; @@ -733,7 +733,7 @@ _mesa_update_vao_derived_arrays(struct gl_context *ctx, } /* User space buffer object */ - assert(!_mesa_is_bufferobj(binding2->BufferObj)); + assert(!binding2->BufferObj); eff_bound_arrays |= VERT_BIT(j); } @@ -776,7 +776,7 @@ _mesa_update_vao_derived_arrays(struct gl_context *ctx, assert(binding->Stride == binding2->Stride); assert(binding->InstanceDivisor == binding2->InstanceDivisor); assert(binding->BufferObj == binding2->BufferObj); - if (_mesa_is_bufferobj(binding->BufferObj)) { + if (binding->BufferObj) { assert(attrib->_EffRelativeOffset <= MaxRelativeOffset); assert(binding->Offset + attrib->RelativeOffset == binding2->_EffOffset + attrib->_EffRelativeOffset); @@ -818,7 +818,7 @@ _mesa_all_varyings_in_vbos(const struct gl_vertex_array_object *vao) &vao->BufferBinding[attrib_array->BufferBindingIndex]; /* We have already masked out vao->VertexAttribBufferMask */ - assert(!_mesa_is_bufferobj(buffer_binding->BufferObj)); + assert(!buffer_binding->BufferObj); /* Bail out once we find the first non vbo with a non zero stride */ if (buffer_binding->Stride != 0) @@ -847,7 +847,7 @@ _mesa_all_buffers_are_unmapped(const struct gl_vertex_array_object *vao) &vao->BufferBinding[attrib_array->BufferBindingIndex]; /* We have already masked with vao->VertexAttribBufferMask */ - assert(_mesa_is_bufferobj(buffer_binding->BufferObj)); + assert(buffer_binding->BufferObj); /* Bail out once we find the first disallowed mapping */ if (_mesa_check_disallowed_mapping(buffer_binding->BufferObj)) @@ -877,7 +877,7 @@ _mesa_vao_map_arrays(struct gl_context *ctx, struct gl_vertex_array_object *vao, mask &= ~binding->_BoundArrays; struct gl_buffer_object *bo = binding->BufferObj; - assert(_mesa_is_bufferobj(bo)); + assert(bo); if (_mesa_bufferobj_mapped(bo, MAP_INTERNAL)) continue; @@ -896,7 +896,7 @@ _mesa_vao_map(struct gl_context *ctx, struct gl_vertex_array_object *vao, struct gl_buffer_object *bo = vao->IndexBufferObj; /* map the index buffer, if there is one, and not already mapped */ - if (_mesa_is_bufferobj(bo) && !_mesa_bufferobj_mapped(bo, MAP_INTERNAL)) + if (bo && !_mesa_bufferobj_mapped(bo, MAP_INTERNAL)) ctx->Driver.MapBufferRange(ctx, 0, bo->Size, access, bo, MAP_INTERNAL); _mesa_vao_map_arrays(ctx, vao, access); @@ -919,7 +919,7 @@ _mesa_vao_unmap_arrays(struct gl_context *ctx, mask &= ~binding->_BoundArrays; struct gl_buffer_object *bo = binding->BufferObj; - assert(_mesa_is_bufferobj(bo)); + assert(bo); if (!_mesa_bufferobj_mapped(bo, MAP_INTERNAL)) continue; @@ -937,7 +937,7 @@ _mesa_vao_unmap(struct gl_context *ctx, struct gl_vertex_array_object *vao) struct gl_buffer_object *bo = vao->IndexBufferObj; /* unmap the index buffer, if there is one, and still mapped */ - if (_mesa_is_bufferobj(bo) && _mesa_bufferobj_mapped(bo, MAP_INTERNAL)) + if (bo && _mesa_bufferobj_mapped(bo, MAP_INTERNAL)) ctx->Driver.UnmapBuffer(ctx, bo, MAP_INTERNAL); _mesa_vao_unmap_arrays(ctx, vao); diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index e4330d8c58e..f4c8bd8bd85 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -206,7 +206,7 @@ get_buffer(struct gl_context *ctx, const char *func, GLenum target, return NULL; } - if (!_mesa_is_bufferobj(*bufObj)) { + if (!*bufObj) { _mesa_error(ctx, error, "%s(no buffer bound)", func); return NULL; } diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index 44ac95f40e9..d1291677222 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -60,17 +60,6 @@ _mesa_check_disallowed_mapping(const struct gl_buffer_object *obj) GL_MAP_PERSISTENT_BIT); } -/** - * Is the given buffer object a user-created buffer object? - * Mesa uses default buffer objects in several places. Default buffers - * always have Name==0. User created buffers have Name!=0. - */ -static inline GLboolean -_mesa_is_bufferobj(const struct gl_buffer_object *obj) -{ - return obj != NULL && obj->Name != 0; -} - extern void _mesa_init_buffer_objects(struct gl_context *ctx); diff --git a/src/mesa/main/compute.c b/src/mesa/main/compute.c index 794b5d035bf..013d6a68567 100644 --- a/src/mesa/main/compute.c +++ b/src/mesa/main/compute.c @@ -214,7 +214,7 @@ valid_dispatch_indirect(struct gl_context *ctx, GLintptr indirect) * DRAW_INDIRECT_BUFFER binding, or if the command would source data * beyond the end of the buffer object." */ - if (!_mesa_is_bufferobj(ctx->DispatchIndirectBuffer)) { + if (!ctx->DispatchIndirectBuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s: no buffer bound to DISPATCH_INDIRECT_BUFFER", name); return GL_FALSE; diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 3abac73ebb9..4f4e28321ce 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1536,7 +1536,7 @@ unpack_image(struct gl_context *ctx, GLuint dimensions, return NULL; } - if (!_mesa_is_bufferobj(unpack->BufferObj)) { + if (!unpack->BufferObj) { /* no PBO */ GLvoid *image; diff --git a/src/mesa/main/draw.c b/src/mesa/main/draw.c index 53946a72b20..a33862f517b 100644 --- a/src/mesa/main/draw.c +++ b/src/mesa/main/draw.c @@ -72,7 +72,7 @@ check_array_data(struct gl_context *ctx, struct gl_vertex_array_object *vao, &vao->BufferBinding[array->BufferBindingIndex]; struct gl_buffer_object *bo = binding->BufferObj; const void *data = array->Ptr; - if (_mesa_is_bufferobj(bo)) { + if (bo) { data = ADD_POINTERS(_mesa_vertex_attrib_address(array, binding), bo->Mappings[MAP_INTERNAL].Pointer); } @@ -133,7 +133,7 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, _mesa_vao_map(ctx, vao, GL_MAP_READ_BIT); - if (_mesa_is_bufferobj(vao->IndexBufferObj)) + if (vao->IndexBufferObj) elements = ADD_POINTERS(vao->IndexBufferObj->Mappings[MAP_INTERNAL].Pointer, elements); @@ -257,7 +257,7 @@ print_draw_arrays(struct gl_context *ctx, array->Format.Size, binding->Stride, array->Ptr, bufObj ? bufObj->Name : 0); - if (_mesa_is_bufferobj(bufObj)) { + if (bufObj) { GLubyte *p = bufObj->Mappings[MAP_INTERNAL].Pointer; int offset = (int) (GLintptr) _mesa_vertex_attrib_address(array, binding); @@ -751,7 +751,7 @@ skip_draw_elements(struct gl_context *ctx, GLsizei count, /* Not using a VBO for indices, so avoid NULL pointer derefs later. */ - if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj) && indices == NULL) + if (!ctx->Array.VAO->IndexBufferObj && indices == NULL) return true; if (skip_validated_draw(ctx)) @@ -1226,7 +1226,7 @@ _mesa_validated_multidrawelements(struct gl_context *ctx, GLenum mode, * subranges of the index buffer as one large index buffer may lead to * us reading unmapped memory. */ - if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) + if (!ctx->Array.VAO->IndexBufferObj) fallback = GL_TRUE; } @@ -1542,7 +1542,7 @@ _mesa_exec_DrawArraysIndirect(GLenum mode, const GLvoid *indirect) * pointer passed as their <indirect> parameters." */ if (ctx->API == API_OPENGL_COMPAT && - !_mesa_is_bufferobj(ctx->DrawIndirectBuffer)) { + !ctx->DrawIndirectBuffer) { DrawArraysIndirectCommand *cmd = (DrawArraysIndirectCommand *) indirect; _mesa_exec_DrawArraysInstancedBaseInstance(mode, cmd->first, cmd->count, @@ -1589,14 +1589,14 @@ _mesa_exec_DrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect * pointer passed as their <indirect> parameters." */ if (ctx->API == API_OPENGL_COMPAT && - !_mesa_is_bufferobj(ctx->DrawIndirectBuffer)) { + !ctx->DrawIndirectBuffer) { /* * Unlike regular DrawElementsInstancedBaseVertex commands, the indices * may not come from a client array and must come from an index buffer. * If no element array buffer is bound, an INVALID_OPERATION error is * generated. */ - if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { + if (!ctx->Array.VAO->IndexBufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawElementsIndirect(no buffer bound " "to GL_ELEMENT_ARRAY_BUFFER)"); @@ -1661,7 +1661,7 @@ _mesa_exec_MultiDrawArraysIndirect(GLenum mode, const GLvoid *indirect, * pointer passed as their <indirect> parameters." */ if (ctx->API == API_OPENGL_COMPAT && - !_mesa_is_bufferobj(ctx->DrawIndirectBuffer)) { + !ctx->DrawIndirectBuffer) { if (!_mesa_valid_draw_indirect_multi(ctx, primcount, stride, "glMultiDrawArraysIndirect")) @@ -1730,14 +1730,14 @@ _mesa_exec_MultiDrawElementsIndirect(GLenum mode, GLenum type, * pointer passed as their <indirect> parameters." */ if (ctx->API == API_OPENGL_COMPAT && - !_mesa_is_bufferobj(ctx->DrawIndirectBuffer)) { + !ctx->DrawIndirectBuffer) { /* * Unlike regular DrawElementsInstancedBaseVertex commands, the indices * may not come from a client array and must come from an index buffer. * If no element array buffer is bound, an INVALID_OPERATION error is * generated. */ - if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { + if (!ctx->Array.VAO->IndexBufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glMultiDrawElementsIndirect(no buffer bound " "to GL_ELEMENT_ARRAY_BUFFER)"); diff --git a/src/mesa/main/draw_validate.c b/src/mesa/main/draw_validate.c index 523281f7012..4b624af1e2f 100644 --- a/src/mesa/main/draw_validate.c +++ b/src/mesa/main/draw_validate.c @@ -773,7 +773,7 @@ _mesa_validate_MultiDrawElements(struct gl_context *ctx, /* Not using a VBO for indices, so avoid NULL pointer derefs later. */ - if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { + if (!ctx->Array.VAO->IndexBufferObj) { for (i = 0; i < primcount; i++) { if (!indices[i]) return GL_FALSE; @@ -1161,7 +1161,7 @@ valid_draw_indirect(struct gl_context *ctx, return GL_FALSE; } - if (!_mesa_is_bufferobj(ctx->DrawIndirectBuffer)) { + if (!ctx->DrawIndirectBuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s: no buffer bound to DRAW_INDIRECT_BUFFER", name); return GL_FALSE; @@ -1203,7 +1203,7 @@ valid_draw_indirect_elements(struct gl_context *ctx, * If no element array buffer is bound, an INVALID_OPERATION error is * generated. */ - if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { + if (!ctx->Array.VAO->IndexBufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no buffer bound to GL_ELEMENT_ARRAY_BUFFER)", name); return GL_FALSE; @@ -1345,7 +1345,7 @@ valid_draw_indirect_parameters(struct gl_context *ctx, * MultiDrawElementsIndirectCountARB if no buffer is bound to the * PARAMETER_BUFFER_ARB binding point." */ - if (!_mesa_is_bufferobj(ctx->ParameterBuffer)) { + if (!ctx->ParameterBuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s: no buffer bound to PARAMETER_BUFFER", name); return GL_FALSE; diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 320081911bb..efec78cda05 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -143,7 +143,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, GLint x = IROUND(ctx->Current.RasterPos[0]); GLint y = IROUND(ctx->Current.RasterPos[1]); - if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) { + if (ctx->Unpack.BufferObj) { /* unpack from PBO */ if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1, format, type, INT_MAX, pixels)) { @@ -326,7 +326,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, GLint x = IFLOOR(ctx->Current.RasterPos[0] + epsilon - xorig); GLint y = IFLOOR(ctx->Current.RasterPos[1] + epsilon - yorig); - if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) { + if (ctx->Unpack.BufferObj) { /* unpack from PBO */ if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1, GL_COLOR_INDEX, GL_BITMAP, diff --git a/src/mesa/main/objectpurge.c b/src/mesa/main/objectpurge.c index 28d046b565c..090e28b3447 100644 --- a/src/mesa/main/objectpurge.c +++ b/src/mesa/main/objectpurge.c @@ -53,7 +53,7 @@ buffer_object_purgeable(struct gl_context *ctx, GLuint name, GLenum option) "glObjectPurgeable(name = 0x%x)", name); return 0; } - if (!_mesa_is_bufferobj(bufObj)) { + if (!bufObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glObjectPurgeable(buffer 0)" ); return 0; } diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c index 6af815759f1..8ab782f3a33 100644 --- a/src/mesa/main/pbo.c +++ b/src/mesa/main/pbo.c @@ -79,7 +79,7 @@ _mesa_validate_pbo_access(GLuint dimensions, If a PBO is bound, 'ptr' is an offset into the bound PBO. In that case 'clientMemSize' is ignored: we just use the PBO's size. */ - if (!_mesa_is_bufferobj(pack->BufferObj)) { + if (!pack->BufferObj) { offset = 0; size = (clientMemSize == INT_MAX) ? UINTPTR_MAX : clientMemSize; } else { @@ -151,7 +151,7 @@ _mesa_map_pbo_source(struct gl_context *ctx, { const GLubyte *buf; - if (_mesa_is_bufferobj(unpack->BufferObj)) { + if (unpack->BufferObj) { /* unpack from PBO */ buf = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size, @@ -188,7 +188,7 @@ _mesa_validate_pbo_source(struct gl_context *ctx, GLuint dimensions, if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth, format, type, clientMemSize, ptr)) { - if (_mesa_is_bufferobj(unpack->BufferObj)) { + if (unpack->BufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(out of bounds PBO access)", where); @@ -200,7 +200,7 @@ _mesa_validate_pbo_source(struct gl_context *ctx, GLuint dimensions, return false; } - if (!_mesa_is_bufferobj(unpack->BufferObj)) { + if (!unpack->BufferObj) { /* non-PBO access: no further validation to be done */ return true; } @@ -225,7 +225,7 @@ _mesa_validate_pbo_source_compressed(struct gl_context *ctx, GLuint dimensions, GLsizei imageSize, const GLvoid *pixels, const char *where) { - if (!_mesa_is_bufferobj(unpack->BufferObj)) { + if (!unpack->BufferObj) { /* not using a PBO */ return true; } @@ -284,7 +284,7 @@ _mesa_unmap_pbo_source(struct gl_context *ctx, const struct gl_pixelstore_attrib *unpack) { assert(unpack != &ctx->Pack); /* catch pack/unpack mismatch */ - if (_mesa_is_bufferobj(unpack->BufferObj)) { + if (unpack->BufferObj) { ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL); } } @@ -305,7 +305,7 @@ _mesa_map_pbo_dest(struct gl_context *ctx, { void *buf; - if (_mesa_is_bufferobj(pack->BufferObj)) { + if (pack->BufferObj) { /* pack into PBO */ buf = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0, pack->BufferObj->Size, @@ -346,7 +346,7 @@ _mesa_map_validate_pbo_dest(struct gl_context *ctx, if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth, format, type, clientMemSize, ptr)) { - if (_mesa_is_bufferobj(unpack->BufferObj)) { + if (unpack->BufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(out of bounds PBO access)", where); } else { @@ -357,7 +357,7 @@ _mesa_map_validate_pbo_dest(struct gl_context *ctx, return NULL; } - if (!_mesa_is_bufferobj(unpack->BufferObj)) { + if (!unpack->BufferObj) { /* non-PBO access: no further validation to be done */ return ptr; } @@ -381,7 +381,7 @@ _mesa_unmap_pbo_dest(struct gl_context *ctx, const struct gl_pixelstore_attrib *pack) { assert(pack != &ctx->Unpack); /* catch pack/unpack mismatch */ - if (_mesa_is_bufferobj(pack->BufferObj)) { + if (pack->BufferObj) { ctx->Driver.UnmapBuffer(ctx, pack->BufferObj, MAP_INTERNAL); } } @@ -402,7 +402,7 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions, { GLubyte *buf; - if (!_mesa_is_bufferobj(unpack->BufferObj)) { + if (!unpack->BufferObj) { /* no PBO */ return pixels; } @@ -450,7 +450,7 @@ _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx, return NULL; } - if (!_mesa_is_bufferobj(packing->BufferObj)) { + if (!packing->BufferObj) { /* not using a PBO - return pointer unchanged */ return pixels; } @@ -478,7 +478,7 @@ void _mesa_unmap_teximage_pbo(struct gl_context *ctx, const struct gl_pixelstore_attrib *unpack) { - if (_mesa_is_bufferobj(unpack->BufferObj)) { + if (unpack->BufferObj) { ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL); } } diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index f5856a0ea79..d8dfab7be2b 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -158,7 +158,7 @@ validate_pbo_access(struct gl_context *ctx, &ctx->DefaultPacking.BufferObj, NULL); if (!ok) { - if (_mesa_is_bufferobj(pack->BufferObj)) { + if (pack->BufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "gl[Get]PixelMap*v(out of bounds PBO access)"); } else { @@ -199,7 +199,7 @@ _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ) values = (const GLfloat *) _mesa_map_pbo_source(ctx, &ctx->Unpack, values); if (!values) { - if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) { + if (ctx->Unpack.BufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glPixelMapfv(PBO is mapped)"); } @@ -240,7 +240,7 @@ _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ) values = (const GLuint *) _mesa_map_pbo_source(ctx, &ctx->Unpack, values); if (!values) { - if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) { + if (ctx->Unpack.BufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glPixelMapuiv(PBO is mapped)"); } @@ -295,7 +295,7 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ) values = (const GLushort *) _mesa_map_pbo_source(ctx, &ctx->Unpack, values); if (!values) { - if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) { + if (ctx->Unpack.BufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glPixelMapusv(PBO is mapped)"); } @@ -344,7 +344,7 @@ _mesa_GetnPixelMapfvARB( GLenum map, GLsizei bufSize, GLfloat *values ) values = (GLfloat *) _mesa_map_pbo_dest(ctx, &ctx->Pack, values); if (!values) { - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { + if (ctx->Pack.BufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetPixelMapfv(PBO is mapped)"); } @@ -393,7 +393,7 @@ _mesa_GetnPixelMapuivARB( GLenum map, GLsizei bufSize, GLuint *values ) values = (GLuint *) _mesa_map_pbo_dest(ctx, &ctx->Pack, values); if (!values) { - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { + if (ctx->Pack.BufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetPixelMapuiv(PBO is mapped)"); } @@ -442,7 +442,7 @@ _mesa_GetnPixelMapusvARB( GLenum map, GLsizei bufSize, GLushort *values ) values = (GLushort *) _mesa_map_pbo_dest(ctx, &ctx->Pack, values); if (!values) { - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { + if (ctx->Pack.BufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetPixelMapusv(PBO is mapped)"); } diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index 45e5754d9a4..a7ca828e3f1 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -1141,7 +1141,7 @@ read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, if (!no_error) { if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1, format, type, bufSize, pixels)) { - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { + if (ctx->Pack.BufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(out of bounds PBO access)"); } else { @@ -1152,7 +1152,7 @@ read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, return; } - if (_mesa_is_bufferobj(ctx->Pack.BufferObj) && + if (ctx->Pack.BufferObj && _mesa_check_disallowed_mapping(ctx->Pack.BufferObj)) { /* buffer is mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index d6ec4c52949..9171a8de811 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -701,7 +701,7 @@ _mesa_GetTexSubImage_sw(struct gl_context *ctx, _mesa_get_texture_dimensions(texImage->TexObject->Target); /* map dest buffer, if PBO */ - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { + if (ctx->Pack.BufferObj) { /* Packing texture image into a PBO. * Map the (potentially) VRAM-based buffer into our process space so * we can write into it with the code below. @@ -760,7 +760,7 @@ _mesa_GetTexSubImage_sw(struct gl_context *ctx, width, height, depth, format, type, pixels, texImage); } - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { + if (ctx->Pack.BufferObj) { ctx->Driver.UnmapBuffer(ctx, ctx->Pack.BufferObj, MAP_INTERNAL); } } @@ -788,7 +788,7 @@ get_compressed_texsubimage_sw(struct gl_context *ctx, width, height, depth, &ctx->Pack, &store); - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { + if (ctx->Pack.BufferObj) { /* pack texture image into a PBO */ dest = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0, ctx->Pack.BufferObj->Size, @@ -835,7 +835,7 @@ get_compressed_texsubimage_sw(struct gl_context *ctx, } } - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { + if (ctx->Pack.BufferObj) { ctx->Driver.UnmapBuffer(ctx, ctx->Pack.BufferObj, MAP_INTERNAL); } } @@ -1101,7 +1101,7 @@ pbo_error_check(struct gl_context *ctx, GLenum target, if (!_mesa_validate_pbo_access(dimensions, &ctx->Pack, width, height, depth, format, type, clientMemSize, pixels)) { - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { + if (ctx->Pack.BufferObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(out of bounds PBO access)", caller); } else { @@ -1112,7 +1112,7 @@ pbo_error_check(struct gl_context *ctx, GLenum target, return true; } - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { + if (ctx->Pack.BufferObj) { /* PBO should not be mapped */ if (_mesa_check_disallowed_mapping(ctx->Pack.BufferObj)) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -1121,7 +1121,7 @@ pbo_error_check(struct gl_context *ctx, GLenum target, } } - if (!_mesa_is_bufferobj(ctx->Pack.BufferObj) && !pixels) { + if (!ctx->Pack.BufferObj && !pixels) { /* not an error, do nothing */ return true; } @@ -1719,7 +1719,7 @@ getcompressedteximage_error_check(struct gl_context *ctx, &ctx->Pack); /* Do dest buffer bounds checking */ - if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { + if (ctx->Pack.BufferObj) { /* do bounds checking on PBO write */ if ((GLubyte *) pixels + totalBytes > (GLubyte *) ctx->Pack.BufferObj->Size) { @@ -1744,7 +1744,7 @@ getcompressedteximage_error_check(struct gl_context *ctx, } } - if (!_mesa_is_bufferobj(ctx->Pack.BufferObj) && !pixels) { + if (!ctx->Pack.BufferObj && !pixels) { /* not an error, but do nothing */ return true; } diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 357492583e6..2190687e108 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -169,7 +169,7 @@ _mesa_vertex_attrib_binding(struct gl_context *ctx, if (array->BufferBindingIndex != bindingIndex) { const GLbitfield array_bit = VERT_BIT(attribIndex); - if (_mesa_is_bufferobj(vao->BufferBinding[bindingIndex].BufferObj)) + if (vao->BufferBinding[bindingIndex].BufferObj) vao->VertexAttribBufferMask |= array_bit; else vao->VertexAttribBufferMask &= ~array_bit; @@ -205,7 +205,7 @@ _mesa_bind_vertex_buffer(struct gl_context *ctx, struct gl_vertex_buffer_binding *binding = &vao->BufferBinding[index]; if (ctx->Const.VertexBufferOffsetIsInt32 && (int)offset < 0 && - _mesa_is_bufferobj(vbo)) { + vbo) { /* The offset will be interpreted as a signed int, so make sure * the user supplied offset is not negative (driver limitation). */ @@ -227,7 +227,7 @@ _mesa_bind_vertex_buffer(struct gl_context *ctx, binding->Offset = offset; binding->Stride = stride; - if (!_mesa_is_bufferobj(vbo)) { + if (!vbo) { vao->VertexAttribBufferMask &= ~binding->_BoundArrays; } else { vao->VertexAttribBufferMask |= binding->_BoundArrays; @@ -831,7 +831,7 @@ validate_array(struct gl_context *ctx, const char *func, * 2.9.6), and the pointer argument is not NULL." */ if (ptr != NULL && vao != ctx->Array.DefaultVAO && - !_mesa_is_bufferobj(obj)) { + !obj) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-VBO array)", func); return; } diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 247fcb1d7f7..6a549d2a5f0 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -45,7 +45,7 @@ static inline const GLubyte * _mesa_vertex_attrib_address(const struct gl_array_attributes *array, const struct gl_vertex_buffer_binding *binding) { - if (_mesa_is_bufferobj(binding->BufferObj)) + if (binding->BufferObj) return (const GLubyte *) (binding->Offset + array->RelativeOffset); else return array->Ptr; |