<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 18, 2015 at 4:18 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">---<br>
src/mesa/main/arrayobj.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++<br>
src/mesa/main/arrayobj.h | 3 +++<br>
2 files changed, 53 insertions(+)<br>
<br>
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c<br>
index 0c15630..ac081b0 100644<br>
--- a/src/mesa/main/arrayobj.c<br>
+++ b/src/mesa/main/arrayobj.c<br>
@@ -75,6 +75,56 @@ _mesa_lookup_vao(struct gl_context *ctx, GLuint id)<br>
<br>
<br>
/**<br>
+ * Looks up the array object for the given ID.<br>
+ *<br>
+ * Unlike _mesa_lookup_vao, this function generates a GL_INVALID_OPERATION<br>
+ * error if the buffer object does not exist. It also returns the default<br>
+ * array object when id is zero, and ctx is a compatibility profile context.<br>
+ */<br>
+struct gl_vertex_array_object *<br>
+_mesa_lookup_vao_err(struct gl_context *ctx, GLuint id, const char *caller)<br>
+{<br>
+ /* The ARB_direct_state_access specification says:<br>
+ *<br>
+ * "<vaobj> is [compatibility profile:<br>
+ * zero, indicating the default vertex array object, or]<br>
+ * the name of the vertex array object."<br>
+ */<br>
+ if (id == 0) {<br>
+ if (ctx->API == API_OPENGL_CORE) {<br>
+ _mesa_error(ctx, GL_INVALID_OPERATION,<br>
+ "%s(zero is not valid vaobj name in a core profile "<br>
+ "context)", caller);<br></blockquote><div>Maybe a more concise error message such as "%s(id = 0 is invalid for core profile)" ?<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ return NULL;<br>
+ }<br>
+<br>
+ return ctx->Array.DefaultVAO;<br>
+ } else {<br>
+ struct gl_vertex_array_object *vao =<br>
+ (struct gl_vertex_array_object *)<br>
+ _mesa_HashLookup(ctx->Array.Objects, id);<br>
+<br>
+ /* The ARB_direct_state_access specification says:<br>
+ *<br>
+ * "An INVALID_OPERATION error is generated if <vaobj> is not<br>
+ * [compatibility profile: zero or] the name of an existing<br>
+ * vertex array object."<br>
+ */<br>
+ if (!vao || !vao->EverBound) {<br>
+ const char *format = ctx->API == API_OPENGL_CORE ?<br>
+ "%s(vaobj=%d is not the name of an existing vertex array object)" :<br>
+ "%s(vaobj=%d is not zero or the name of an existing vertex "<br>
+ "array object)";<br></blockquote><div>Maybe more concise error messages like "%s(non-existent vaobj=%d)" and "%s(non-existent, non-zero vaobj=%d)" ?<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ _mesa_error(ctx, GL_INVALID_OPERATION, format, caller, id);<br>
+ return NULL;<br>
+ }<br>
+<br>
+ return vao;<br>
+ }<br>
+}<br>
+<br>
+<br>
+/**<br>
* For all the vertex binding points in the array object, unbind any pointers<br>
* to any buffer objects (VBOs).<br>
* This is done just prior to array object destruction.<br>
diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h<br>
index ae671e3..1e7436b 100644<br>
--- a/src/mesa/main/arrayobj.h<br>
+++ b/src/mesa/main/arrayobj.h<br>
@@ -49,6 +49,9 @@ extern struct gl_vertex_array_object *<br>
_mesa_lookup_vao(struct gl_context *ctx, GLuint id);<br>
<br>
extern struct gl_vertex_array_object *<br>
+_mesa_lookup_vao_err(struct gl_context *ctx, GLuint id, const char *caller);<br>
+<br>
+extern struct gl_vertex_array_object *<br>
_mesa_new_vao(struct gl_context *ctx, GLuint name);<br>
<br>
extern void<br>
<span class=""><font color="#888888">--<br>
1.8.5.3<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>