<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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
src/mapi/glapi/gen/ARB_direct_state_access.xml | 14 +++<br>
src/mesa/main/tests/dispatch_sanity.cpp | 2 +<br>
src/mesa/main/varray.c | 117 +++++++++++++++++++++++++<br>
src/mesa/main/varray.h | 10 +++<br>
4 files changed, 143 insertions(+)<br>
<br>
diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
index 35857d6..955cf8b 100644<br>
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
@@ -461,5 +461,19 @@<br>
<param name="param" type="GLint *" /><br>
</function><br>
<br>
+ <function name="GetVertexArrayIndexediv" offset="assign"><br>
+ <param name="vaobj" type="GLuint" /><br>
+ <param name="index" type="GLuint" /><br>
+ <param name="pname" type="GLenum" /><br>
+ <param name="param" type="GLint *" /><br>
+ </function><br>
+<br>
+ <function name="GetVertexArrayIndexed64iv" offset="assign"><br>
+ <param name="vaobj" type="GLuint" /><br>
+ <param name="index" type="GLuint" /><br>
+ <param name="pname" type="GLenum" /><br>
+ <param name="param" type="GLint64 *" /><br>
+ </function><br>
+<br>
</category><br>
</OpenGLAPI><br>
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp<br>
index 83f8ecc..1ffd86d 100644<br>
--- a/src/mesa/main/tests/dispatch_sanity.cpp<br>
+++ b/src/mesa/main/tests/dispatch_sanity.cpp<br>
@@ -982,6 +982,8 @@ const struct function gl_core_functions_possible[] = {<br>
{ "glVertexArrayAttribBinding", 45, -1 },<br>
{ "glVertexArrayBindingDivisor", 45, -1 },<br>
{ "glGetVertexArrayiv", 45, -1 },<br>
+ { "glGetVertexArrayIndexediv", 45, -1 },<br>
+ { "glGetVertexArrayIndexed64iv", 45, -1 },<br>
<br>
/* GL_EXT_polygon_offset_clamp */<br>
{ "glPolygonOffsetClampEXT", 11, -1 },<br>
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c<br>
index ec768f0..dccfc2f 100644<br>
--- a/src/mesa/main/varray.c<br>
+++ b/src/mesa/main/varray.c<br>
@@ -1051,6 +1051,123 @@ _mesa_GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer)<br>
}<br>
<br>
<br>
+/** ARB_direct_state_access */<br>
+void GLAPIENTRY<br>
+_mesa_GetVertexArrayIndexediv(GLuint vaobj, GLuint index,<br>
+ GLenum pname, GLint *params)<br>
+{<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+ struct gl_vertex_array_object *vao;<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>
+ vao = _mesa_lookup_vao_err(ctx, vaobj, "glGetVertexArrayIndexediv");<br>
+ if (!vao)<br>
+ return;<br>
+<br>
+ /* The ARB_direct_state_access specification says:<br>
+ *<br>
+ * "For GetVertexArrayIndexediv, <pname> must be one of<br>
+ * VERTEX_ATTRIB_ARRAY_ENABLED, VERTEX_ATTRIB_ARRAY_SIZE,<br>
+ * VERTEX_ATTRIB_ARRAY_STRIDE, VERTEX_ATTRIB_ARRAY_TYPE,<br>
+ * VERTEX_ATTRIB_ARRAY_NORMALIZED, VERTEX_ATTRIB_ARRAY_INTEGER,<br>
+ * VERTEX_ATTRIB_ARRAY_LONG, VERTEX_ATTRIB_ARRAY_DIVISOR, or<br>
+ * VERTEX_ATTRIB_RELATIVE_OFFSET."<br>
+ *<br>
+ * and:<br>
+ *<br>
+ * "Add GetVertexArrayIndexediv in 'Get Command' for<br>
+ * VERTEX_ATTRIB_ARRAY_BUFFER_BINDING<br>
+ * VERTEX_ATTRIB_BINDING,<br>
+ * VERTEX_ATTRIB_RELATIVE_OFFSET,<br>
+ * VERTEX_BINDING_OFFSET, and<br>
+ * VERTEX_BINDING_STRIDE states"<br>
+ *<br>
+ * The only parameter name common to both lists is<br>
+ * VERTEX_ATTRIB_RELATIVE_OFFSET. Also note that VERTEX_BINDING_BUFFER<br>
+ * and VERTEX_BINDING_DIVISOR are missing from both lists. It seems<br>
+ * pretty clear however that the intent is that it should be possible<br>
+ * to query all vertex attrib and binding states that can be set with<br>
+ * a DSA function.<br>
+ */<br>
+ switch (pname) {<br>
+ case GL_VERTEX_BINDING_OFFSET:<br>
+ params[0] = vao->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset;<br>
+ break;<br>
+ case GL_VERTEX_BINDING_STRIDE:<br>
+ params[0] = vao->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride;<br>
+ break;<br>
+ case GL_VERTEX_BINDING_DIVISOR:<br>
+ params[0] = vao->VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor;<br>
+ break;<br>
+ case GL_VERTEX_BINDING_BUFFER:<br>
+ params[0] = vao->VertexBinding[VERT_ATTRIB_GENERIC(index)].BufferObj->Name;<br>
+ break;<br>
+ default:<br>
+ params[0] = get_vertex_array_attrib(ctx, vao, index, pname,<br>
+ "glGetVertexArrayIndexediv");<br>
+ break;<br>
+ }<br>
+}<br>
+<br>
+<br>
+void GLAPIENTRY<br>
+_mesa_GetVertexArrayIndexed64iv(GLuint vaobj, GLuint index,<br>
+ GLenum pname, GLint64 *params)<br>
+{<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+ struct gl_vertex_array_object *vao;<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>
+ */ </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ vao = _mesa_lookup_vao_err(ctx, vaobj, "glVertexArrayIndexed64iv");<br></blockquote><div>You forgot "Get" in this string --^ <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ if (!vao)<br>
+ return;<br>
+<br>
+ /* The ARB_direct_state_access specification says:<br>
+ *<br>
+ * "For GetVertexArrayIndexed64iv, <pname> must be<br>
+ * VERTEX_BINDING_OFFSET."<br>
+ *<br>
+ * and:<br>
+ *<br>
+ * "An INVALID_ENUM error is generated if <pname> is not one of<br>
+ * the valid values listed above for the corresponding command."<br>
+ */<br>
+ if (pname != GL_VERTEX_BINDING_OFFSET) {<br>
+ _mesa_error(ctx, GL_INVALID_ENUM, "glVertexArrayIndexed64iv("<br></blockquote><div>Again, you forgot "Get" --^ <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ "pname != GL_VERTEX_BINDING_OFFSET)");<br>
+ return;<br>
+ }<br>
+<br>
+ /* The ARB_direct_state_access specification says:<br>
+ *<br>
+ * "An INVALID_VALUE error is generated if <index> is greater than<br>
+ * or equal to the value of MAX_VERTEX_ATTRIBS."<br>
+ *<br>
+ * Since the index refers to a buffer binding in this case, the intended<br>
+ * limit must be MAX_VERTEX_ATTRIB_BINDINGS. Both limits are currently<br>
+ * required to be the same, so in practice this doesn't matter.<br>
+ */<br>
+ if (index >= ctx->Const.MaxVertexAttribBindings) {<br>
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexArrayIndexed64iv("<br></blockquote><div>Again you forgot "Get" ---^ <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ "index %d >= the value of GL_MAX_VERTEX_ATTRIB_BINDINGS (%d))",<br>
+ index, ctx->Const.MaxVertexAttribBindings);<br>
+ return;<br>
+ }<br>
+<br>
+ params[0] = vao->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset;<br>
+}<br>
+<br>
+<br>
void GLAPIENTRY<br>
_mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,<br>
GLsizei count, const GLvoid *ptr)<br>
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h<br>
index c369ba4..e218219 100644<br>
--- a/src/mesa/main/varray.h<br>
+++ b/src/mesa/main/varray.h<br>
@@ -208,6 +208,16 @@ extern void GLAPIENTRY<br>
_mesa_GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer);<br>
<br>
<br>
+void GLAPIENTRY<br>
+_mesa_GetVertexArrayIndexediv(GLuint vaobj, GLuint index,<br>
+ GLenum pname, GLint *param);<br>
+<br>
+<br>
+void GLAPIENTRY<br>
+_mesa_GetVertexArrayIndexed64iv(GLuint vaobj, GLuint index,<br>
+ GLenum pname, GLint64 *param);<br>
+<br>
+<br>
extern void GLAPIENTRY<br>
_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);<br>
<span class="HOEnZb"><font color="#888888"><br>
--<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>