main: Add utility function _mesa_lookup_bufferobj_err.

This function is exposed to mesa driver internals so that texture buffer
objects and array objects can use it.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
This commit is contained in:
Laura Ekstrand 2015-01-09 16:16:48 -08:00
parent ff011340a4
commit 768ca8b83e
2 changed files with 23 additions and 0 deletions

View file

@ -1006,6 +1006,25 @@ _mesa_lookup_bufferobj_locked(struct gl_context *ctx, GLuint buffer)
_mesa_HashLookupLocked(ctx->Shared->BufferObjects, buffer);
}
/**
* A convenience function for direct state access functions that throws
* GL_INVALID_OPERATION if buffer is not the name of a buffer object in the
* hash table.
*/
struct gl_buffer_object *
_mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,
const char *caller)
{
struct gl_buffer_object *bufObj;
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
if (!bufObj)
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(non-generated buffer name %u)", caller, buffer);
return bufObj;
}
void
_mesa_begin_bufferobj_lookups(struct gl_context *ctx)

View file

@ -89,6 +89,10 @@ _mesa_lookup_bufferobj(struct gl_context *ctx, GLuint buffer);
extern struct gl_buffer_object *
_mesa_lookup_bufferobj_locked(struct gl_context *ctx, GLuint buffer);
extern struct gl_buffer_object *
_mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,
const char *caller);
extern void
_mesa_begin_bufferobj_lookups(struct gl_context *ctx);