<div dir="ltr"><div>You are right; I missed that subtle OpenGL definition of "exist" in the lookup functions.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 19, 2015 at 3:48 PM, Fredrik Höglund <span dir="ltr"><<a href="mailto:fredrik@kde.org" target="_blank">fredrik@kde.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Generate GL_INVALID_OPERATION and return NULL when the buffer object<br>
hasn't been created. All callers expect this.<br>
<br>
Cc: Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>><br>
---<br>
src/mesa/main/bufferobj.c | 11 +++++++----<br>
1 file changed, 7 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c<br>
index 78d3d78..41455f3 100644<br>
--- a/src/mesa/main/bufferobj.c<br>
+++ b/src/mesa/main/bufferobj.c<br>
@@ -1003,8 +1003,8 @@ _mesa_lookup_bufferobj_locked(struct gl_context *ctx, GLuint buffer)<br>
<br>
/**<br>
* A convenience function for direct state access functions that throws<br>
- * GL_INVALID_OPERATION if buffer is not the name of a buffer object in the<br>
- * hash table.<br>
+ * GL_INVALID_OPERATION if buffer is not the name of an existing<br>
+ * buffer object.<br>
*/<br>
struct gl_buffer_object *<br>
_mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,<br>
@@ -1013,9 +1013,12 @@ _mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,<br>
struct gl_buffer_object *bufObj;<br>
<br>
bufObj = _mesa_lookup_bufferobj(ctx, buffer);<br>
- if (!bufObj)<br>
+ if (!bufObj || bufObj == &DummyBufferObject) {<br>
_mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "%s(non-generated buffer name %u)", caller, buffer);<br></blockquote><div>This should be more concise. How about "%s(non-existent buffer object %u)" ? <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ "%s(%u is not the name of an existing buffer object)",<br>
+ caller, buffer);<br>
+ return NULL;<br>
+ }<br>
<br>
return bufObj;<br>
}<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.1.4<br>
<br>
</font></span></blockquote></div><br></div></div>