mesa: Make sure the buffer exists in _mesa_lookup_bufferobj_err
Generate GL_INVALID_OPERATION and return NULL when the buffer object hasn't been created. All callers expect this. v2: Use a more concise error message. Cc: Laura Ekstrand <laura@jlekstrand.net> Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
This commit is contained in:
parent
9d97cd2e3e
commit
2fd21d8a84
|
@ -1003,8 +1003,8 @@ _mesa_lookup_bufferobj_locked(struct gl_context *ctx, GLuint buffer)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A convenience function for direct state access functions that throws
|
* 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
|
* GL_INVALID_OPERATION if buffer is not the name of an existing
|
||||||
* hash table.
|
* buffer object.
|
||||||
*/
|
*/
|
||||||
struct gl_buffer_object *
|
struct gl_buffer_object *
|
||||||
_mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,
|
_mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,
|
||||||
|
@ -1013,9 +1013,11 @@ _mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,
|
||||||
struct gl_buffer_object *bufObj;
|
struct gl_buffer_object *bufObj;
|
||||||
|
|
||||||
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
|
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
|
||||||
if (!bufObj)
|
if (!bufObj || bufObj == &DummyBufferObject) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
"%s(non-generated buffer name %u)", caller, buffer);
|
"%s(non-existent buffer object %u)", caller, buffer);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return bufObj;
|
return bufObj;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue