aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/i915/intel_pixel_bitmap.c4
-rw-r--r--src/mesa/drivers/dri/i915/intel_pixel_read.c4
-rw-r--r--src/mesa/drivers/dri/i915/intel_tex_image.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c6
-rw-r--r--src/mesa/drivers/dri/i965/intel_pixel_bitmap.c4
-rw-r--r--src/mesa/drivers/dri/i965/intel_pixel_draw.c2
-rw-r--r--src/mesa/drivers/dri/i965/intel_pixel_read.c4
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex_image.c10
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_bufferobj.h4
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_pixel_read.c10
-rw-r--r--src/mesa/drivers/x11/xm_dd.c6
-rw-r--r--src/mesa/main/api_arrayelt.c2
-rw-r--r--src/mesa/main/arrayobj.c20
-rw-r--r--src/mesa/main/bufferobj.c2
-rw-r--r--src/mesa/main/bufferobj.h11
-rw-r--r--src/mesa/main/compute.c2
-rw-r--r--src/mesa/main/dlist.c2
-rw-r--r--src/mesa/main/draw.c22
-rw-r--r--src/mesa/main/draw_validate.c8
-rw-r--r--src/mesa/main/drawpix.c4
-rw-r--r--src/mesa/main/objectpurge.c2
-rw-r--r--src/mesa/main/pbo.c26
-rw-r--r--src/mesa/main/pixel.c14
-rw-r--r--src/mesa/main/readpix.c4
-rw-r--r--src/mesa/main/texgetimage.c18
-rw-r--r--src/mesa/main/varray.c8
-rw-r--r--src/mesa/main/varray.h2
-rw-r--r--src/mesa/state_tracker/st_atom_array.c2
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c2
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c2
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c6
-rw-r--r--src/mesa/state_tracker/st_draw.c4
-rw-r--r--src/mesa/tnl/t_draw.c4
-rw-r--r--src/mesa/tnl/t_rebase.c2
-rw-r--r--src/mesa/tnl/t_split_copy.c8
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c10
-rw-r--r--src/mesa/vbo/vbo_minmax_index.c4
-rw-r--r--src/mesa/vbo/vbo_save_api.c2
40 files changed, 123 insertions, 134 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_pixel_bitmap.c b/src/mesa/drivers/dri/i915/intel_pixel_bitmap.c
index 8dee0bea9f2..4c2358388d8 100644
--- a/src/mesa/drivers/dri/i915/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/i915/intel_pixel_bitmap.c
@@ -211,7 +211,7 @@ do_blit_bitmap( struct gl_context *ctx,
irb = intel_renderbuffer(fb->_ColorDrawBuffers[0]);
- if (_mesa_is_bufferobj(unpack->BufferObj)) {
+ if (unpack->BufferObj) {
bitmap = map_pbo(ctx, width, height, unpack, bitmap);
if (bitmap == NULL)
return true; /* even though this is an error, we're done */
@@ -310,7 +310,7 @@ out:
if (unlikely(INTEL_DEBUG & DEBUG_SYNC))
intel_batchbuffer_flush(intel);
- if (_mesa_is_bufferobj(unpack->BufferObj)) {
+ if (unpack->BufferObj) {
/* done with PBO so unmap it now */
ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
}
diff --git a/src/mesa/drivers/dri/i915/intel_pixel_read.c b/src/mesa/drivers/dri/i915/intel_pixel_read.c
index 3560963c8b8..8db01799fd6 100644
--- a/src/mesa/drivers/dri/i915/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i915/intel_pixel_read.c
@@ -84,7 +84,7 @@ do_blit_readpixels(struct gl_context * ctx,
DBG("%s\n", __func__);
- assert(_mesa_is_bufferobj(pack->BufferObj));
+ assert(pack->BufferObj);
struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
@@ -166,7 +166,7 @@ intelReadPixels(struct gl_context * ctx,
DBG("%s\n", __func__);
- if (_mesa_is_bufferobj(pack->BufferObj)) {
+ if (pack->BufferObj) {
/* Using PBOs, so try the BLT based path. */
if (do_blit_readpixels(ctx, x, y, width, height, format, type, pack,
pixels)) {
diff --git a/src/mesa/drivers/dri/i915/intel_tex_image.c b/src/mesa/drivers/dri/i915/intel_tex_image.c
index a06b1423452..1d037ab3554 100644
--- a/src/mesa/drivers/dri/i915/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i915/intel_tex_image.c
@@ -115,7 +115,7 @@ try_pbo_upload(struct gl_context *ctx,
GLuint src_offset;
drm_intel_bo *src_buffer;
- if (!_mesa_is_bufferobj(unpack->BufferObj))
+ if (!unpack->BufferObj)
return false;
DBG("trying pbo upload\n");
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
index 43363e5f63c..00c34f72cfd 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -857,7 +857,7 @@ blorp_get_client_bo(struct brw_context *brw,
*row_stride_out = stride;
*image_stride_out = _mesa_image_image_stride(packing, w, h, format, type);
- if (_mesa_is_bufferobj(packing->BufferObj)) {
+ if (packing->BufferObj) {
const uint32_t offset = first_pixel + (intptr_t)pixels;
if (!read_only && ((offset % cpp) || (stride % cpp))) {
perf_debug("Bad PBO alignment; fallback to CPU mapping\n");
@@ -1070,7 +1070,7 @@ brw_blorp_download_miptree(struct brw_context *brw,
}
/* This pass only works for PBOs */
- assert(_mesa_is_bufferobj(packing->BufferObj));
+ assert(packing->BufferObj);
uint32_t dst_offset, dst_row_stride, dst_image_stride;
struct brw_bo *dst_bo =
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index e87e0775614..ca51f88da15 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -493,7 +493,7 @@ brw_prepare_vertices(struct brw_context *brw)
_mesa_draw_buffer_binding(vao, ffs(vbomask) - 1);
const GLsizei stride = glbinding->Stride;
- assert(_mesa_is_bufferobj(glbinding->BufferObj));
+ assert(glbinding->BufferObj);
/* Accumulate the range of a single vertex, start with inverted range */
uint32_t vertex_range_start = ~(uint32_t)0;
@@ -581,7 +581,7 @@ brw_prepare_vertices(struct brw_context *brw)
_mesa_draw_buffer_binding(vao, ffs(usermask) - 1);
const GLsizei stride = glbinding->Stride;
- assert(!_mesa_is_bufferobj(glbinding->BufferObj));
+ assert(!glbinding->BufferObj);
assert(brw->vb.index_bounds_valid);
/* Accumulate the range of a single vertex, start with inverted range */
@@ -727,7 +727,7 @@ brw_upload_indices(struct brw_context *brw)
/* Turn into a proper VBO:
*/
- if (!_mesa_is_bufferobj(bufferobj)) {
+ if (!bufferobj) {
/* Get new bufferobj, offset:
*/
brw_upload_data(&brw->upload, index_buffer->ptr, ib_size, ib_type_size,
diff --git a/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c b/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c
index 249a077cf99..3a99bd8968b 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c
@@ -208,7 +208,7 @@ do_blit_bitmap( struct gl_context *ctx,
irb = intel_renderbuffer(fb->_ColorDrawBuffers[0]);
- if (_mesa_is_bufferobj(unpack->BufferObj)) {
+ if (unpack->BufferObj) {
bitmap = map_pbo(ctx, width, height, unpack, bitmap);
if (bitmap == NULL)
return true; /* even though this is an error, we're done */
@@ -312,7 +312,7 @@ out:
if (unlikely(INTEL_DEBUG & DEBUG_SYNC))
intel_batchbuffer_flush(brw);
- if (_mesa_is_bufferobj(unpack->BufferObj)) {
+ if (unpack->BufferObj) {
/* done with PBO so unmap it now */
ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
}
diff --git a/src/mesa/drivers/dri/i965/intel_pixel_draw.c b/src/mesa/drivers/dri/i965/intel_pixel_draw.c
index 9b7d436599f..8a29fa772e0 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_draw.c
@@ -164,7 +164,7 @@ intelDrawPixels(struct gl_context * ctx,
}
if (brw->screen->devinfo.gen < 6 &&
- _mesa_is_bufferobj(unpack->BufferObj)) {
+ unpack->BufferObj) {
if (do_blit_drawpixels(ctx, x, y, width, height, format, type, unpack,
pixels)) {
return;
diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c
index dfae6ff15f9..e52bc0ccc4e 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
@@ -95,7 +95,7 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
if (!devinfo->has_llc ||
!(type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) ||
pixels == NULL ||
- _mesa_is_bufferobj(pack->BufferObj) ||
+ pack->BufferObj ||
pack->Alignment > 4 ||
pack->SkipPixels > 0 ||
pack->SkipRows > 0 ||
@@ -272,7 +272,7 @@ intelReadPixels(struct gl_context * ctx,
intel_prepare_render(brw);
brw->front_buffer_dirty = dirty;
- if (_mesa_is_bufferobj(pack->BufferObj)) {
+ if (pack->BufferObj) {
if (intel_readpixels_blorp(ctx, x, y, width, height,
format, type, pixels, pack))
return;
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index bc72827802c..b1f86a6ba71 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -208,7 +208,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
!(texImage->TexObject->Target == GL_TEXTURE_2D ||
texImage->TexObject->Target == GL_TEXTURE_RECTANGLE) ||
pixels == NULL ||
- _mesa_is_bufferobj(packing->BufferObj) ||
+ packing->BufferObj ||
packing->Alignment > 4 ||
packing->SkipPixels > 0 ||
packing->SkipRows > 0 ||
@@ -322,13 +322,13 @@ intel_upload_tex(struct gl_context * ctx,
bool ok;
/* Check that there is actually data to store. */
- if (pixels == NULL && !_mesa_is_bufferobj(packing->BufferObj))
+ if (pixels == NULL && !packing->BufferObj)
return;
bool tex_busy = mt &&
(brw_batch_references(&brw->batch, mt->bo) || brw_bo_busy(mt->bo));
- if (_mesa_is_bufferobj(packing->BufferObj) || tex_busy ||
+ if (packing->BufferObj || tex_busy ||
mt->aux_usage == ISL_AUX_USAGE_CCS_E) {
ok = intel_texsubimage_blorp(brw, dims, texImage,
xoffset, yoffset, zoffset,
@@ -756,7 +756,7 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context *ctx,
!(texImage->TexObject->Target == GL_TEXTURE_2D ||
texImage->TexObject->Target == GL_TEXTURE_RECTANGLE) ||
pixels == NULL ||
- _mesa_is_bufferobj(packing->BufferObj) ||
+ packing->BufferObj ||
packing->Alignment > 4 ||
packing->SkipPixels > 0 ||
packing->SkipRows > 0 ||
@@ -867,7 +867,7 @@ intel_get_tex_sub_image(struct gl_context *ctx,
DBG("%s\n", __func__);
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+ if (ctx->Pack.BufferObj) {
if (intel_gettexsubimage_blorp(brw, texImage,
xoffset, yoffset, zoffset,
width, height, depth, format, type,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.h b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.h
index 01ef0bad0fd..77878971ec7 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.h
@@ -35,10 +35,10 @@ struct nouveau_bufferobj {
#define to_nouveau_bufferobj(x) ((struct nouveau_bufferobj *)(x))
#define nouveau_bufferobj_hw(x) \
- (_mesa_is_bufferobj(x) ? to_nouveau_bufferobj(x)->bo : NULL)
+ (x ? to_nouveau_bufferobj(x)->bo : NULL)
#define nouveau_bufferobj_sys(x) \
- (_mesa_is_bufferobj(x) ? to_nouveau_bufferobj(x)->sys : NULL)
+ (x ? to_nouveau_bufferobj(x)->sys : NULL)
void
nouveau_bufferobj_functions_init(struct dd_function_table *functions);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index d7e6c34c1e2..720b7c3e1a0 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -46,7 +46,7 @@ get_array_stride(struct gl_context *ctx, const struct tnl_vertex_array *a)
struct nouveau_render_state *render = to_render_state(ctx);
const struct gl_vertex_buffer_binding *binding = a->BufferBinding;
- if (render->mode == VBO && !_mesa_is_bufferobj(binding->BufferObj)) {
+ if (render->mode == VBO && !binding->BufferObj) {
const struct gl_array_attributes *attrib = a->VertexAttrib;
/* Pack client buffers. */
return align(attrib->Format._ElementSize, 4);
@@ -230,7 +230,7 @@ get_max_client_stride(struct gl_context *ctx, const struct tnl_vertex_array *arr
FOR_EACH_BOUND_ATTR(render, i, attr) {
const struct tnl_vertex_array *a = &arrays[attr];
- if (!_mesa_is_bufferobj(a->BufferBinding->BufferObj))
+ if (!a->BufferBinding->BufferObj)
s = MAX2(s, get_array_stride(ctx, a));
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
index e115b749da5..b80999d2cbf 100644
--- a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
+++ b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
@@ -131,13 +131,13 @@ do_blit_readpixels(struct gl_context * ctx,
aligned_rowstride = get_texture_image_row_stride(radeon, dst_format, dst_rowstride, 0, GL_TEXTURE_2D);
dst_rowstride *= _mesa_get_format_bytes(dst_format);
- if (_mesa_is_bufferobj(pack->BufferObj) && aligned_rowstride != dst_rowstride)
+ if (pack->BufferObj && aligned_rowstride != dst_rowstride)
return GL_FALSE;
dst_imagesize = get_texture_image_size(dst_format,
aligned_rowstride,
height, 1, 0);
- if (!_mesa_is_bufferobj(pack->BufferObj))
+ if (!pack->BufferObj)
{
dst_buffer = radeon_bo_open(radeon->radeonScreen->bom, 0, dst_imagesize, 1024, RADEON_GEM_DOMAIN_GTT, 0);
dst_offset = 0;
@@ -176,8 +176,8 @@ do_blit_readpixels(struct gl_context * ctx,
height,
flip_y))
{
- if (!_mesa_is_bufferobj(pack->BufferObj))
- {
+ if (!pack->BufferObj)
+ {
radeon_bo_map(dst_buffer, 0);
copy_rows(pixels, dst_rowstride, dst_buffer->ptr,
aligned_rowstride, height, dst_rowstride);
@@ -188,7 +188,7 @@ do_blit_readpixels(struct gl_context * ctx,
return GL_TRUE;
}
- if (!_mesa_is_bufferobj(pack->BufferObj))
+ if (!pack->BufferObj)
radeon_bo_unref(dst_buffer);
return GL_FALSE;
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index 1f8d78cb541..16884af48f9 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -355,7 +355,7 @@ xmesa_DrawPixels_8R8G8B( struct gl_context *ctx,
if (swrast->NewState)
_swrast_validate_derived( ctx );
- if (_mesa_is_bufferobj(unpack->BufferObj)) {
+ if (unpack->BufferObj) {
/* unpack from PBO */
GLubyte *buf;
if (!_mesa_validate_pbo_access(2, unpack, width, height, 1,
@@ -415,7 +415,7 @@ xmesa_DrawPixels_8R8G8B( struct gl_context *ctx,
XPutImage(dpy, xrb->pixmap, gc, &ximage, 0, 0, dstX, dstY, w, h);
}
- if (_mesa_is_bufferobj(unpack->BufferObj)) {
+ if (unpack->BufferObj) {
ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
}
}
@@ -487,7 +487,7 @@ xmesa_DrawPixels_5R6G5B( struct gl_context *ctx,
if (swrast->NewState)
_swrast_validate_derived( ctx );
- if (_mesa_is_bufferobj(unpack->BufferObj)) {
+ if (unpack->BufferObj) {
/* unpack from PBO */
GLubyte *buf;
if (!_mesa_validate_pbo_access(2, unpack, width, height, 1,
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;
diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c
index 16f7414fab6..0b5909ba11a 100644
--- a/src/mesa/state_tracker/st_atom_array.c
+++ b/src/mesa/state_tracker/st_atom_array.c
@@ -156,7 +156,7 @@ st_setup_arrays(struct st_context *st,
= _mesa_draw_buffer_binding(vao, i);
const unsigned bufidx = (*num_vbuffers)++;
- if (_mesa_is_bufferobj(binding->BufferObj)) {
+ if (binding->BufferObj) {
/* Set the binding */
struct st_buffer_object *stobj = st_buffer_object(binding->BufferObj);
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index ea9551be3a0..3bcd784d5d0 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -503,7 +503,7 @@ search_drawpixels_cache(struct st_context *st,
unpack->SkipPixels != 0 ||
unpack->SkipRows != 0 ||
unpack->SwapBytes ||
- _mesa_is_bufferobj(unpack->BufferObj)) {
+ unpack->BufferObj) {
/* we don't allow non-default pixel unpacking values */
return NULL;
}
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 9b3b9c4d6b6..96526508cfc 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -470,7 +470,7 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
goto fallback;
}
- if (st->pbo.download_enabled && _mesa_is_bufferobj(pack->BufferObj)) {
+ if (st->pbo.download_enabled && pack->BufferObj) {
if (try_pbo_readpixels(st, strb,
st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP,
x, y, width, height,
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index e585e40caa7..0432e3fccdf 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1487,7 +1487,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
/* Try texture_subdata, which should be the fastest memcpy path. */
if (pixels &&
- !_mesa_is_bufferobj(unpack->BufferObj) &&
+ !unpack->BufferObj &&
_mesa_texstore_can_use_memcpy(ctx, texImage->_BaseFormat,
texImage->TexFormat, format, type,
unpack)) {
@@ -1557,7 +1557,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
goto fallback;
}
- if (_mesa_is_bufferobj(unpack->BufferObj)) {
+ if (unpack->BufferObj) {
if (try_pbo_upload(ctx, dims, texImage, format, type, dst_format,
xoffset, yoffset, zoffset,
width, height, depth, pixels, unpack))
@@ -1777,7 +1777,7 @@ st_CompressedTexSubImage(struct gl_context *ctx, GLuint dims,
goto fallback;
}
- if (!_mesa_is_bufferobj(ctx->Unpack.BufferObj))
+ if (!ctx->Unpack.BufferObj)
goto fallback;
if (st_compressed_format_fallback(st, texImage->TexFormat))
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index e3bea305a51..a8ff306e00a 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -206,7 +206,7 @@ st_draw_vbo(struct gl_context *ctx,
info.min_index = min_index;
info.max_index = max_index;
- if (_mesa_is_bufferobj(bufobj)) {
+ if (bufobj) {
/* indices are in a real VBO */
info.has_user_indices = false;
info.index.resource = st_buffer_object(bufobj)->buffer;
@@ -295,7 +295,7 @@ st_indirect_draw_vbo(struct gl_context *ctx,
struct gl_buffer_object *bufobj = ib->obj;
/* indices are always in a real VBO */
- assert(_mesa_is_bufferobj(bufobj));
+ assert(bufobj);
info.index_size = 1 << ib->index_size_shift;
info.index.resource = st_buffer_object(bufobj)->buffer;
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 33d39a7bd20..335161ef0d0 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -291,7 +291,7 @@ static void bind_inputs( struct gl_context *ctx,
const struct gl_array_attributes *attrib = array->VertexAttrib;
const void *ptr;
- if (_mesa_is_bufferobj(binding->BufferObj)) {
+ if (binding->BufferObj) {
if (!binding->BufferObj->Mappings[MAP_INTERNAL].Pointer) {
bo[*nr_bo] = binding->BufferObj;
(*nr_bo)++;
@@ -362,7 +362,7 @@ static void bind_indices( struct gl_context *ctx,
return;
}
- if (_mesa_is_bufferobj(ib->obj) &&
+ if (ib->obj &&
!_mesa_bufferobj_mapped(ib->obj, MAP_INTERNAL)) {
/* if the buffer object isn't mapped yet, map it now */
bo[*nr_bo] = ib->obj;
diff --git a/src/mesa/tnl/t_rebase.c b/src/mesa/tnl/t_rebase.c
index e6e5c9f3dfa..2d53d947d3d 100644
--- a/src/mesa/tnl/t_rebase.c
+++ b/src/mesa/tnl/t_rebase.c
@@ -227,7 +227,7 @@ void t_rebase_prims( struct gl_context *ctx,
tmp_attribs[i] = *(arrays[i].VertexAttrib);
tmp_arrays[i].BufferBinding = arrays[i].BufferBinding;
tmp_arrays[i].VertexAttrib = &tmp_attribs[i];
- if (_mesa_is_bufferobj(arrays[i].BufferBinding->BufferObj))
+ if (arrays[i].BufferBinding->BufferObj)
tmp_attribs[i].RelativeOffset +=
min_index * arrays[i].BufferBinding->Stride;
else
diff --git a/src/mesa/tnl/t_split_copy.c b/src/mesa/tnl/t_split_copy.c
index 9df55c78558..801cb71790b 100644
--- a/src/mesa/tnl/t_split_copy.c
+++ b/src/mesa/tnl/t_split_copy.c
@@ -455,7 +455,7 @@ replay_init(struct copy_context *copy)
copy->varying[j].size = attrib->Format._ElementSize;
copy->vertex_size += attrib->Format._ElementSize;
- if (_mesa_is_bufferobj(vbo)) {
+ if (vbo) {
if (!_mesa_bufferobj_mapped(vbo, MAP_INTERNAL)) {
ctx->Driver.MapBufferRange(ctx, 0, vbo->Size, GL_MAP_READ_BIT, vbo,
MAP_INTERNAL);
@@ -476,7 +476,7 @@ replay_init(struct copy_context *copy)
* caller convert non-indexed prims to indexed. Could alternately
* do it internally.
*/
- if (_mesa_is_bufferobj(copy->ib->obj) &&
+ if (copy->ib->obj &&
!_mesa_bufferobj_mapped(copy->ib->obj, MAP_INTERNAL))
ctx->Driver.MapBufferRange(ctx, 0, copy->ib->obj->Size, GL_MAP_READ_BIT,
copy->ib->obj, MAP_INTERNAL);
@@ -578,12 +578,12 @@ replay_finish(struct copy_context *copy)
for (i = 0; i < copy->nr_varying; i++) {
struct gl_buffer_object *vbo =
copy->varying[i].array->BufferBinding->BufferObj;
- if (_mesa_is_bufferobj(vbo) && _mesa_bufferobj_mapped(vbo, MAP_INTERNAL))
+ if (vbo && _mesa_bufferobj_mapped(vbo, MAP_INTERNAL))
ctx->Driver.UnmapBuffer(ctx, vbo, MAP_INTERNAL);
}
/* Unmap index buffer */
- if (_mesa_is_bufferobj(copy->ib->obj) &&
+ if (copy->ib->obj &&
_mesa_bufferobj_mapped(copy->ib->obj, MAP_INTERNAL)) {
ctx->Driver.UnmapBuffer(ctx, copy->ib->obj, MAP_INTERNAL);
}
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 93a74cc07ad..54ee7af86f6 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -89,7 +89,7 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
struct vbo_exec_context *exec = &vbo->exec;
GLintptr buffer_offset;
- if (_mesa_is_bufferobj(exec->vtx.bufferobj)) {
+ if (exec->vtx.bufferobj) {
assert(exec->vtx.bufferobj->Mappings[MAP_INTERNAL].Pointer);
buffer_offset = exec->vtx.bufferobj->Mappings[MAP_INTERNAL].Offset +
exec->vtx.buffer_offset;
@@ -137,7 +137,7 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
}
_mesa_enable_vertex_array_attribs(ctx, vao, vao_enabled);
assert(vao_enabled == vao->Enabled);
- assert(!_mesa_is_bufferobj(exec->vtx.bufferobj) ||
+ assert(!exec->vtx.bufferobj ||
(vao_enabled & ~vao->VertexAttribBufferMask) == 0);
_mesa_set_draw_vao(ctx, vao, _vbo_get_vao_filter(mode));
@@ -150,7 +150,7 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
static void
vbo_exec_vtx_unmap(struct vbo_exec_context *exec)
{
- if (_mesa_is_bufferobj(exec->vtx.bufferobj)) {
+ if (exec->vtx.bufferobj) {
struct gl_context *ctx = exec->ctx;
if (ctx->Driver.FlushMappedBufferRange &&
@@ -211,7 +211,7 @@ vbo_exec_vtx_map(struct vbo_exec_context *exec)
MESA_MAP_NOWAIT_BIT;
}
- if (!_mesa_is_bufferobj(exec->vtx.bufferobj))
+ if (!exec->vtx.bufferobj)
return;
assert(!exec->vtx.buffer_map);
@@ -295,7 +295,7 @@ vbo_exec_vtx_flush(struct vbo_exec_context *exec)
{
/* Only unmap if persistent mappings are unsupported. */
bool persistent_mapping = exec->ctx->Extensions.ARB_buffer_storage &&
- _mesa_is_bufferobj(exec->vtx.bufferobj) &&
+ exec->vtx.bufferobj &&
exec->vtx.buffer_map;
if (0)
diff --git a/src/mesa/vbo/vbo_minmax_index.c b/src/mesa/vbo/vbo_minmax_index.c
index 0c87ffbea3c..f66ed3dee39 100644
--- a/src/mesa/vbo/vbo_minmax_index.c
+++ b/src/mesa/vbo/vbo_minmax_index.c
@@ -248,7 +248,7 @@ vbo_get_minmax_index(struct gl_context *ctx,
GLintptr offset = 0;
indices = (char *) ib->ptr + (prim->start << ib->index_size_shift);
- if (_mesa_is_bufferobj(ib->obj)) {
+ if (ib->obj) {
GLsizeiptr size = MIN2(count << ib->index_size_shift, ib->obj->Size);
if (vbo_get_minmax_cached(ib->obj, 1 << ib->index_size_shift, (GLintptr) indices,
@@ -338,7 +338,7 @@ vbo_get_minmax_index(struct gl_context *ctx,
unreachable("not reached");
}
- if (_mesa_is_bufferobj(ib->obj)) {
+ if (ib->obj) {
vbo_minmax_cache_store(ctx, ib->obj, 1 << ib->index_size_shift, offset,
count, *min_index, *max_index);
ctx->Driver.UnmapBuffer(ctx, ib->obj, MAP_INTERNAL);
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 63a5b0ebb90..52ed86cf3b7 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -1374,7 +1374,7 @@ _save_OBE_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
_mesa_vao_map(ctx, vao, GL_MAP_READ_BIT);
- if (_mesa_is_bufferobj(indexbuf))
+ if (indexbuf)
indices =
ADD_POINTERS(indexbuf->Mappings[MAP_INTERNAL].Pointer, indices);