diff options
author | Laura Ekstrand <[email protected]> | 2015-01-09 16:16:48 -0800 |
---|---|---|
committer | Laura Ekstrand <[email protected]> | 2015-03-09 13:33:53 -0700 |
commit | 768ca8b83e45b1d23c0d3af0b79cc19c1b3b6988 (patch) | |
tree | 5c633798108c29a285f7228a4ccc5f3269e850cd /src | |
parent | ff011340a499d9fe5c3ead6b46b917578bfeb533 (diff) |
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/bufferobj.c | 19 | ||||
-rw-r--r-- | src/mesa/main/bufferobj.h | 4 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index e1c5877797a..cef284fb7ce 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -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) diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index fe294fc0bed..8e53bfd979e 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -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); |