return buf;
}
-bool
-_mesa_handle_bind_buffer_gen(struct gl_context *ctx,
- GLuint buffer,
- struct gl_buffer_object **buf_handle,
- const char *caller, bool no_error)
+static ALWAYS_INLINE bool
+handle_bind_buffer_gen(struct gl_context *ctx,
+ GLuint buffer,
+ struct gl_buffer_object **buf_handle,
+ const char *caller, bool no_error)
{
struct gl_buffer_object *buf = *buf_handle;
*/
*buf_handle = new_gl_buffer_object(ctx, buffer);
if (!*buf_handle) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller);
+ if (!no_error)
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller);
return false;
}
_mesa_HashLockMaybeLocked(ctx->Shared->BufferObjects,
return true;
}
+bool
+_mesa_handle_bind_buffer_gen(struct gl_context *ctx,
+ GLuint buffer,
+ struct gl_buffer_object **buf_handle,
+ const char *caller, bool no_error)
+{
+ return handle_bind_buffer_gen(ctx, buffer, buf_handle, caller, no_error);
+}
+
/**
* Bind the specified target to buffer for the specified context.
* Called by glBindBuffer() and other functions.
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
- &bufObj, "glNamedBufferStorageEXT", false))
+ if (!handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glNamedBufferStorageEXT", false))
return;
inlined_buffer_storage(GL_NONE, buffer, size, data, flags, GL_NONE, 0,
}
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
- &bufObj, "glNamedBufferDataEXT", false))
+ if (!handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glNamedBufferDataEXT", false))
return;
_mesa_buffer_data(ctx, bufObj, GL_NONE, size, data, usage,
}
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
- &bufObj, "glNamedBufferSubDataEXT", false))
+ if (!handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glNamedBufferSubDataEXT", false))
return;
if (validate_buffer_sub_data(ctx, bufObj, offset, size,
}
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
- &bufObj, "glGetNamedBufferSubDataEXT", false))
+ if (!handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glGetNamedBufferSubDataEXT", false))
return;
if (!buffer_object_subdata_range_good(ctx, bufObj, offset, size, false,
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
- &bufObj, "glClearNamedBufferDataEXT", false))
+ if (!handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glClearNamedBufferDataEXT", false))
return;
clear_buffer_sub_data_error(ctx, bufObj, internalformat, 0, bufObj->Size,
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
- &bufObj, "glClearNamedBufferSubDataEXT", false))
+ if (!handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glClearNamedBufferSubDataEXT", false))
return;
clear_buffer_sub_data_error(ctx, bufObj, internalformat, offset, size,
}
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
- &bufObj, "glGetNamedBufferParameterivEXT", false))
+ if (!handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glGetNamedBufferParameterivEXT", false))
return;
if (!get_buffer_parameter(ctx, bufObj, pname, ¶meter,
}
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
- &bufObj, "glGetNamedBufferPointervEXT", false))
+ if (!handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glGetNamedBufferPointervEXT", false))
return;
*params = bufObj->Mappings[MAP_USER].Pointer;
struct gl_buffer_object *src, *dst;
src = _mesa_lookup_bufferobj(ctx, readBuffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, readBuffer,
- &src,
+ if (!handle_bind_buffer_gen(ctx, readBuffer,
+ &src,
"glNamedCopyBufferSubDataEXT", false))
return;
dst = _mesa_lookup_bufferobj(ctx, writeBuffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, writeBuffer,
- &dst,
- "glNamedCopyBufferSubDataEXT", false))
+ if (!handle_bind_buffer_gen(ctx, writeBuffer,
+ &dst, "glNamedCopyBufferSubDataEXT", false))
return;
copy_buffer_sub_data(ctx, src, dst, readOffset, writeOffset, size,
if (named && ext_dsa) {
func = "glNamedBufferSubDataEXT";
dst = _mesa_lookup_bufferobj(ctx, dstTargetOrName);
- if (!_mesa_handle_bind_buffer_gen(ctx, dstTargetOrName, &dst, func, false))
+ if (!handle_bind_buffer_gen(ctx, dstTargetOrName, &dst, func, false))
goto done;
} else if (named) {
func = "glNamedBufferSubData";
if (dsa_ext) {
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer, &bufObj, func, false))
+ if (!handle_bind_buffer_gen(ctx, buffer, &bufObj, func, false))
return NULL;
} else {
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, func);
}
struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
- &bufObj, "glMapNamedBufferEXT", false))
+ if (!handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glMapNamedBufferEXT", false))
return NULL;
if (!validate_map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags,
}
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
- &bufObj, "glFlushMappedNamedBufferRangeEXT", false))
+ if (!handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glFlushMappedNamedBufferRangeEXT", false))
return;
flush_mapped_buffer_range(ctx, bufObj, offset, length,
bufObj = NULL;
} else {
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
- &bufObj, "glBindBufferRange", false))
- return;
-
- if (!no_error && !bufObj) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glBindBufferRange(invalid buffer=%u)", buffer);
+ if (!handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glBindBufferRange", no_error))
return;
- }
}
if (no_error) {
bufObj = NULL;
} else {
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
- &bufObj, "glBindBufferBase", false))
- return;
-
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glBindBufferBase(invalid buffer=%u)", buffer);
+ if (!handle_bind_buffer_gen(ctx, buffer,
+ &bufObj, "glBindBufferBase", false))
return;
- }
}
/* Note that there's some oddness in the GL 3.1-GL 3.3 specifications with
/* Use NamedBuffer* functions logic from EXT_direct_state_access */
if (buffer != 0) {
bufferObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!_mesa_handle_bind_buffer_gen(ctx, buffer, &bufferObj,
- "glNamedBufferPageCommitmentEXT", false))
+ if (!handle_bind_buffer_gen(ctx, buffer, &bufferObj,
+ "glNamedBufferPageCommitmentEXT", false))
return;
} else {
/* GL_EXT_direct_state_access says about NamedBuffer* functions: