All buffers have Name != 0.
Note that there is no longer the pointer dereference to get Name,
so it's faster.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4466>
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 */
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);
}
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);
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)) {
GLuint src_offset;
drm_intel_bo *src_buffer;
- if (!_mesa_is_bufferobj(unpack->BufferObj))
+ if (!unpack->BufferObj)
return false;
DBG("trying pbo upload\n");
*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");
}
/* 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 =
_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;
_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 */
/* 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,
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 */
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);
}
}
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;
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 ||
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;
!(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 ||
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,
!(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 ||
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,
#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);
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);
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));
}
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;
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);
return GL_TRUE;
}
- if (!_mesa_is_bufferobj(pack->BufferObj))
+ if (!pack->BufferObj)
radeon_bo_unref(dst_buffer);
return GL_FALSE;
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,
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);
}
}
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,
&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);
}
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;
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;
}
/* User space buffer object */
- assert(!_mesa_is_bufferobj(binding2->BufferObj));
+ assert(!binding2->BufferObj);
eff_bound_arrays |= VERT_BIT(j);
}
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);
&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)
&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))
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;
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);
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;
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);
return NULL;
}
- if (!_mesa_is_bufferobj(*bufObj)) {
+ if (!*bufObj) {
_mesa_error(ctx, error, "%s(no buffer bound)", func);
return NULL;
}
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);
* 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;
return NULL;
}
- if (!_mesa_is_bufferobj(unpack->BufferObj)) {
+ if (!unpack->BufferObj) {
/* no PBO */
GLvoid *image;
&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);
}
_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);
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);
/* 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))
* 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;
}
* 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,
* 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)");
* 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"))
* 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)");
/* 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;
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;
* 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;
* 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;
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)) {
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,
"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;
}
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 {
{
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,
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);
return false;
}
- if (!_mesa_is_bufferobj(unpack->BufferObj)) {
+ if (!unpack->BufferObj) {
/* non-PBO access: no further validation to be done */
return true;
}
GLsizei imageSize, const GLvoid *pixels,
const char *where)
{
- if (!_mesa_is_bufferobj(unpack->BufferObj)) {
+ if (!unpack->BufferObj) {
/* not using a PBO */
return true;
}
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);
}
}
{
void *buf;
- if (_mesa_is_bufferobj(pack->BufferObj)) {
+ if (pack->BufferObj) {
/* pack into PBO */
buf = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0,
pack->BufferObj->Size,
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 {
return NULL;
}
- if (!_mesa_is_bufferobj(unpack->BufferObj)) {
+ if (!unpack->BufferObj) {
/* non-PBO access: no further validation to be done */
return ptr;
}
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);
}
}
{
GLubyte *buf;
- if (!_mesa_is_bufferobj(unpack->BufferObj)) {
+ if (!unpack->BufferObj) {
/* no PBO */
return pixels;
}
return NULL;
}
- if (!_mesa_is_bufferobj(packing->BufferObj)) {
+ if (!packing->BufferObj) {
/* not using a PBO - return pointer unchanged */
return pixels;
}
_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);
}
}
&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 {
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)");
}
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)");
}
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)");
}
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)");
}
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)");
}
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)");
}
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 {
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)");
_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.
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);
}
}
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,
}
}
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+ if (ctx->Pack.BufferObj) {
ctx->Driver.UnmapBuffer(ctx, ctx->Pack.BufferObj, MAP_INTERNAL);
}
}
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 {
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,
}
}
- if (!_mesa_is_bufferobj(ctx->Pack.BufferObj) && !pixels) {
+ if (!ctx->Pack.BufferObj && !pixels) {
/* not an error, do nothing */
return true;
}
&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) {
}
}
- if (!_mesa_is_bufferobj(ctx->Pack.BufferObj) && !pixels) {
+ if (!ctx->Pack.BufferObj && !pixels) {
/* not an error, but do nothing */
return true;
}
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;
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).
*/
binding->Offset = offset;
binding->Stride = stride;
- if (!_mesa_is_bufferobj(vbo)) {
+ if (!vbo) {
vao->VertexAttribBufferMask &= ~binding->_BoundArrays;
} else {
vao->VertexAttribBufferMask |= binding->_BoundArrays;
* 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;
}
_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;
= _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);
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;
}
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,
/* 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)) {
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))
goto fallback;
}
- if (!_mesa_is_bufferobj(ctx->Unpack.BufferObj))
+ if (!ctx->Unpack.BufferObj)
goto fallback;
if (st_compressed_format_fallback(st, texImage->TexFormat))
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;
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;
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)++;
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;
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
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);
* 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);
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);
}
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;
}
_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));
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 &&
MESA_MAP_NOWAIT_BIT;
}
- if (!_mesa_is_bufferobj(exec->vtx.bufferobj))
+ if (!exec->vtx.bufferobj)
return;
assert(!exec->vtx.buffer_map);
{
/* 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)
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,
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);
_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);