<div dir="ltr">I noticed that there was no mention of VERTEX_BINDING_STRIDE and put that in the bug.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 3, 2015 at 11:23 AM, 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"><span class="">On Friday 03 April 2015, Laura Ekstrand wrote:<br>
> I just filed the bug.  I discovered something interesting in the process:<br>
><br>
> The spec for GetVertexAttrib*v explains how to query<br>
> VERTEX_ATTRIB_ARRAY_BUFFER_BINDING<br>
> and VERTEX_ATTRIB_BINDING, but these functions are non-DSA.<br>
> The spec for GetVertexAttrib*v also has a very helpful line,<br>
><br>
>     "Queries of VERTEX_ATTRIB_ARRAY_BUFFER_BINDING and<br>
>     VERTEX_ATTRIB_ARRAY_DIVISOR map the requested attribute index<br>
>     to a binding<br>
>     index via the VERTEX_ATTRIB_BINDING state, and then return the<br>
>     value of<br>
>     VERTEX_BINDING_BUFFER or VERTEX_BINDING_DIVISOR, respectively."<br>
<br>
</span>Right, and that makes those parameters redundant. There is also<br>
VERTEX_ATTRIB_ARRAY_STRIDE, which can only be set by<br>
VertexAttribPointer, which has no DSA equivalent.  This value does<br>
not map to VERTEX_BINDING_STRIDE.<br>
<br>
If VERTEX_ATTRIB_ARRAY_POINTER should not be supported<br>
(the revision history shows that it was removed), then these parameters<br>
should not be supported either.<br>
<div class="HOEnZb"><div class="h5"><br>
> On Thu, Apr 2, 2015 at 10:53 AM, Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>><br>
> wrote:<br>
><br>
> ><br>
> ><br>
> > On Tue, Mar 31, 2015 at 10:26 AM, Fredrik Höglund <<a href="mailto:fredrik@kde.org">fredrik@kde.org</a>> wrote:<br>
> ><br>
> >> This test verifies that glGetVertexArrayiv,<br>
> >> glGetVertexArrayIndexediv, and glGetVertexArrayIndexed64iv work<br>
> >> as expected.<br>
> >> ---<br>
> >>  tests/all.py                                       |   1 +<br>
> >>  .../spec/arb_direct_state_access/CMakeLists.gl.txt |   1 +<br>
> >>  tests/spec/arb_direct_state_access/vao-get.c       | 285<br>
> >> +++++++++++++++++++++<br>
> >>  3 files changed, 287 insertions(+)<br>
> >>  create mode 100644 tests/spec/arb_direct_state_access/vao-get.c<br>
> >><br>
> >> diff --git a/tests/all.py b/tests/all.py<br>
> >> index d0730d4..3affcf9 100755<br>
> >> --- a/tests/all.py<br>
> >> +++ b/tests/all.py<br>
> >> @@ -4288,6 +4288,7 @@ with profile.group_manager(<br>
> >>      g(['arb_direct_state_access-vao-element-array-buffer'],<br>
> >> 'vao-element-array-buffer')<br>
> >>      g(['arb_direct_state_access-vao-vertex-buffer'], 'vao-vertex-buffer')<br>
> >>      g(['arb_direct_state_access-vao-vertex-buffers'],<br>
> >> 'vao-vertex-buffers')<br>
> >> +    g(['arb_direct_state_access-vao-get'], 'vao-get')<br>
> >><br>
> >>  with profile.group_manager(<br>
> >>          PiglitGLTest,<br>
> >> diff --git a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
> >> b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
> >> index 41e5c46..c855797 100644<br>
> >> --- a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
> >> +++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
> >> @@ -44,4 +44,5 @@ piglit_add_executable<br>
> >> (arb_direct_state_access-vao-binding-divisor vao-binding-d<br>
> >>  piglit_add_executable (arb_direct_state_access-vao-element-array-buffer<br>
> >> vao-element-array-buffer.c)<br>
> >>  piglit_add_executable (arb_direct_state_access-vao-vertex-buffer<br>
> >> vao-vertex-buffer.c dsa-utils.c)<br>
> >>  piglit_add_executable (arb_direct_state_access-vao-vertex-buffers<br>
> >> vao-vertex-buffers.c dsa-utils.c)<br>
> >> +piglit_add_executable (arb_direct_state_access-vao-get vao-get.c)<br>
> >>  # vim: ft=cmake:<br>
> >> diff --git a/tests/spec/arb_direct_state_access/vao-get.c<br>
> >> b/tests/spec/arb_direct_state_access/vao-get.c<br>
> >> new file mode 100644<br>
> >> index 0000000..db4a89c<br>
> >> --- /dev/null<br>
> >> +++ b/tests/spec/arb_direct_state_access/vao-get.c<br>
> >> @@ -0,0 +1,285 @@<br>
> >> +/*<br>
> >> + * Copyright (C) 2015 Fredrik Höglund<br>
> >> + *<br>
> >> + * Permission is hereby granted, free of charge, to any person obtaining<br>
> >> a<br>
> >> + * copy of this software and associated documentation files (the<br>
> >> "Software"),<br>
> >> + * to deal in the Software without restriction, including without<br>
> >> limitation<br>
> >> + * on the rights to use, copy, modify, merge, publish, distribute, sub<br>
> >> + * license, and/or sell copies of the Software, and to permit persons to<br>
> >> whom<br>
> >> + * the Software is furnished to do so, subject to the following<br>
> >> conditions:<br>
> >> + *<br>
> >> + * The above copyright notice and this permission notice (including the<br>
> >> next<br>
> >> + * paragraph) shall be included in all copies or substantial portions of<br>
> >> the<br>
> >> + * Software.<br>
> >> + *<br>
> >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,<br>
> >> EXPRESS OR<br>
> >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF<br>
> >> MERCHANTABILITY,<br>
> >> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT<br>
> >> SHALL<br>
> >> + * THE AUTHORS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,<br>
> >> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR<br>
> >> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR<br>
> >> THE<br>
> >> + * USE OR OTHER DEALINGS IN THE SOFTWARE.<br>
> >> + */<br>
> >> +<br>
> >> +/**<br>
> >> + * @file vao-get.c<br>
> >> + *<br>
> >> + * Verifies that glGetVertexArrayiv, glGetVertexArrayIndexediv and<br>
> >> + * glGetVertexArrayIndexed64iv work as expected.<br>
> >> + */<br>
> >> +<br>
> >> +#include "piglit-util-gl.h"<br>
> >> +<br>
> >> +<br>
> >> +PIGLIT_GL_TEST_CONFIG_BEGIN<br>
> >> +<br>
> >> +       config.supports_gl_core_version = 31;<br>
> >> +       config.supports_gl_compat_version = 20;<br>
> >> +<br>
> >> +       config.window_visual = PIGLIT_GL_VISUAL_RGB |<br>
> >> PIGLIT_GL_VISUAL_DOUBLE;<br>
> >> +<br>
> >> +PIGLIT_GL_TEST_CONFIG_END<br>
> >> +<br>
> >> +<br>
> >> +enum piglit_result<br>
> >> +piglit_display(void)<br>
> >> +{<br>
> >> +       /* unreached */<br>
> >> +       return PIGLIT_FAIL;<br>
> >> +}<br>
> >> +<br>
> >> +<br>
> >> +/**<br>
> >> + * Verifies that glGetVertexArrayiv works as expected<br>
> >> + */<br>
> >> +static bool<br>
> >> +test_getvertexarrayiv(GLuint vao)<br>
> >> +{<br>
> >> +       bool pass = true;<br>
> >> +       GLint param;<br>
> >> +<br>
> >> +       /* The ARB_direct_state_access specification says:<br>
> >> +        *<br>
> >> +        * "An INVALID_ENUM error is generated if <pname> is not<br>
> >> +        *  ELEMENT_ARRAY_BUFFER_BINDING."<br>
> >> +        */<br>
> >> +       glGetVertexArrayiv(vao, GL_ARRAY_BUFFER_BINDING, &param);<br>
> >> +       pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;<br>
> >> +<br>
> >> +       /* Verify that no error is generated when pname is<br>
> >> +        * ELEMENT_ARRAY_BUFFER_BINDING.<br>
> >> +        */<br>
> >> +       glGetVertexArrayiv(vao, GL_ELEMENT_ARRAY_BUFFER_BINDING, &param);<br>
> >> +       pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
> >> +<br>
> >> +       piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,<br>
> >> +                                    "glGetVertexArrayiv");<br>
> >> +       return pass;<br>
> >> +}<br>
> >> +<br>
> >> +<br>
> >> +/**<br>
> >> + * Verifies that glGetVertexArrayIndexediv works as expected<br>
> >> + */<br>
> >> +static bool<br>
> >> +test_getvertexarrayindexediv(GLuint vao)<br>
> >> +{<br>
> >> +       struct {<br>
> >> +               GLenum pname;<br>
> >> +               bool supported;<br>
> >> +       } valid_pnames[] = {<br>
> >> +               {<br>
> >> +                       GL_VERTEX_ATTRIB_ARRAY_ENABLED,<br>
> >> +                       true,<br>
> >> +               },<br>
> >> +               {<br>
> >> +                       GL_VERTEX_ATTRIB_ARRAY_SIZE,<br>
> >> +                       true,<br>
> >> +               },<br>
> >> +               {<br>
> >> +                       GL_VERTEX_ATTRIB_ARRAY_STRIDE,<br>
> >> +                       true,<br>
> >> +               },<br>
> >> +               {<br>
> >> +                       GL_VERTEX_ATTRIB_ARRAY_TYPE,<br>
> >> +                       true,<br>
> >> +               },<br>
> >> +               {<br>
> >> +                       GL_VERTEX_ATTRIB_ARRAY_NORMALIZED,<br>
> >> +                       true,<br>
> >> +               },<br>
> >> +               {<br>
> >> +                       GL_VERTEX_ATTRIB_ARRAY_INTEGER,<br>
> >> +                       piglit_get_gl_version() >= 30,<br>
> >> +               },<br>
> >> +               {<br>
> >> +                       GL_VERTEX_ATTRIB_ARRAY_LONG,<br>
> >> +                       piglit_is_extension_supported(<br>
> >> +                               "GL_ARB_vertex_array_64bit"),<br>
> >> +               },<br>
> >><br>
> > Have you filed a bug against the spec about the inconsistency in which<br>
> > params GetVertexArrayIndexediv accepts?  (If not, I can do that.) I would<br>
> > also leave a comment here about it, because I had initially forgotten that<br>
> > the following params (except relative offset) were allowed because of the<br>
> > spec inconsistency you found.<br>
> ><br>
> >> +               {<br>
> >> +                       GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,<br>
> >> +                       true,<br>
> >> +               },<br>
> >><br>
> > Move relative offset up one so that it's in the order of accepted<br>
> > parameters in the OpenGL 4.5 spec.  Also, it would be really helpful if you<br>
> > left a comment here saying that you test vertex attrib array divisor below.<br>
> ><br>
> >> +               {<br>
> >> +                       GL_VERTEX_ATTRIB_RELATIVE_OFFSET,<br>
> >> +                       true,<br>
> >> +               },<br>
> >> +               {<br>
> >> +                       GL_VERTEX_ATTRIB_BINDING,<br>
> >> +                       true,<br>
> >> +               },<br>
> >> +               {<br>
> >> +                       GL_VERTEX_BINDING_BUFFER,<br>
> >> +                       true,<br>
> >> +               },<br>
> >> +               {<br>
> >> +                       GL_VERTEX_BINDING_STRIDE,<br>
> >> +                       true,<br>
> >> +               },<br>
> >> +               {<br>
> >> +                       GL_VERTEX_BINDING_DIVISOR,<br>
> >> +                       piglit_is_extension_supported(<br>
> >> +                               "GL_ARB_instanced_arrays"),<br>
> >> +               },<br>
> >> +       };<br>
> >> +<br>
> >> +       const GLenum invalid_pnames[] = {<br>
> >> +               GL_VERTEX_ATTRIB_ARRAY_POINTER<br>
> >> +       };<br>
> >> +<br>
> >> +       bool pass = true;<br>
> >> +       GLint param;<br>
> >> +       int i;<br>
> >> +<br>
> >> +       /* Verify that glGetVertexArrayIndexediv does not generate any<br>
> >> error<br>
> >> +        * for valid parameters. The returned values are not checked,<br>
> >> +        * since this is covered by the other DSA tests.<br>
> >> +        */<br>
> >> +       for (i = 0; i < ARRAY_SIZE(valid_pnames); i++) {<br>
> >> +               if (!valid_pnames[i].supported)<br>
> >> +                       continue;<br>
> >> +<br>
> >> +               glGetVertexArrayIndexediv(vao, 0, valid_pnames[i].pname,<br>
> >> +                                         &param);<br>
> >> +               pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
> >> +       }<br>
> >> +<br>
> >> +       /* Verify that glGetVertexArrayIndexediv generates<br>
> >> +        * GL_INVALID_ENUM for invalid parameters.<br>
> >> +        */<br>
> >> +       for (i = 0; i < ARRAY_SIZE(invalid_pnames); i++) {<br>
> >> +               glGetVertexArrayIndexediv(vao, 0, invalid_pnames[i],<br>
> >> +                                         &param);<br>
> >> +               pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;<br>
> >> +       }<br>
> >> +<br>
> >> +       /* Associate attrib #0 with bind point #10, and set the<br>
> >> +        * divisor for that bind point to 5. Then verify that the<br>
> >> +        * correct divisor value is returned for<br>
> >> +        * GL_VERTEX_ATTRIB_ARRAY_DIVISOR. The reason we check this<br>
> >> +        * return value is that the other DSA tests use<br>
> >> +        * GL_VERTEX_BINDING_DIVISOR.<br>
> >> +        */<br>
> >> +       glVertexArrayAttribBinding(vao, 0, 10);<br>
> >> +       glVertexArrayBindingDivisor(vao, 10, 5);<br>
> >> +       glGetVertexArrayIndexediv(vao, 0,<br>
> >> +                                 GL_VERTEX_ATTRIB_ARRAY_DIVISOR,<br>
> >> +                                 &param);<br>
> >> +       pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
> >> +<br>
> >> +       if (param != 5) {<br>
> >> +               fprintf(stderr, "GL_VERTEX_ATTRIB_ARRAY_DIVISOR[0] "<br>
> >> +                       "was %d, expected 5\n", param);<br>
> >> +               pass = false;<br>
> >> +       }<br>
> >> +<br>
> >> +       piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,<br>
> >> +                                    "glGetVertexArrayIndexediv");<br>
> >> +       return pass;<br>
> >> +}<br>
> >> +<br>
> >> +<br>
> >> +/**<br>
> >> + * Verifies that glGetVertexArrayIndexed64iv works as expected<br>
> >> + */<br>
> >> +static bool<br>
> >> +test_getvertexarrayindexed64iv(GLuint vao)<br>
> >> +{<br>
> >> +       /* glGetVertexArrayIndexed64iv should generate GL_INVALID_ENUM<br>
> >> +        * for each of these parameters.<br>
> >> +        */<br>
> >> +       const GLenum invalid_pnames[] = {<br>
> >> +               GL_VERTEX_ATTRIB_ARRAY_ENABLED,<br>
> >> +               GL_VERTEX_ATTRIB_ARRAY_SIZE,<br>
> >> +               GL_VERTEX_ATTRIB_ARRAY_STRIDE,<br>
> >> +               GL_VERTEX_ATTRIB_ARRAY_TYPE,<br>
> >> +               GL_VERTEX_ATTRIB_ARRAY_NORMALIZED,<br>
> >> +               GL_VERTEX_ATTRIB_ARRAY_INTEGER,<br>
> >> +               GL_VERTEX_ATTRIB_ARRAY_LONG,<br>
> >> +               GL_VERTEX_ATTRIB_ARRAY_DIVISOR,<br>
> >> +               GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,<br>
> >> +               GL_VERTEX_ATTRIB_ARRAY_POINTER,<br>
> >> +               GL_VERTEX_ATTRIB_RELATIVE_OFFSET,<br>
> >> +               GL_VERTEX_ATTRIB_BINDING,<br>
> >> +               GL_VERTEX_BINDING_BUFFER,<br>
> >> +               GL_VERTEX_BINDING_STRIDE,<br>
> >> +               GL_VERTEX_BINDING_DIVISOR<br>
> >> +       };<br>
> >> +<br>
> >> +       bool pass = true;<br>
> >> +       GLint64 param;<br>
> >> +       GLuint vbo;<br>
> >> +       int i;<br>
> >> +<br>
> >> +       for (i = 0; i < ARRAY_SIZE(invalid_pnames); i++) {<br>
> >> +               glGetVertexArrayIndexed64iv(vao, 0, invalid_pnames[i],<br>
> >> +                                           &param);<br>
> >> +               pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;<br>
> >> +       }<br>
> >> +<br>
> >> +       /* Verify that glGetVertexArrayIndexed64iv returns the correct<br>
> >> +        * value for GL_VERTEX_BINDING_OFFSET. This is the only valid<br>
> >> +        * parameter for this function.<br>
> >> +        */<br>
> >> +       glCreateBuffers(1, &vbo);<br>
> >> +       glVertexArrayVertexBuffer(vao, 0, vbo, 128, 0);<br>
> >> +       glGetVertexArrayIndexed64iv(vao, 0, GL_VERTEX_BINDING_OFFSET,<br>
> >> +                                   &param);<br>
> >> +       pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
> >> +       glDeleteBuffers(1, &vbo);<br>
> >> +<br>
> >> +       if (param != 128) {<br>
> >> +               fprintf(stderr, "GL_VERTEX_BINDING_OFFSET[0] "<br>
> >> +                       "was %lld, expected 128\n", param);<br>
> >> +               pass = false;<br>
> >> +       }<br>
> >> +<br>
> >> +       piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,<br>
> >> +                                    "glGetVertexArrayIndexed64iv");<br>
> >> +       return pass;<br>
> >> +}<br>
> >> +<br>
> >> +<br>
> >> +void<br>
> >> +piglit_init(int argc, char *argv[])<br>
> >> +{<br>
> >> +       GLuint vao;<br>
> >> +       bool pass = true;<br>
> >> +<br>
> >> +       piglit_require_extension("GL_ARB_direct_state_access");<br>
> >> +       piglit_require_extension("GL_ARB_vertex_array_object");<br>
> >> +       piglit_require_extension("GL_ARB_vertex_attrib_binding");<br>
> >> +<br>
> >> +       /* Create a VAO */<br>
> >> +       glCreateVertexArrays(1, &vao);<br>
> >> +<br>
> >> +       pass = test_getvertexarrayiv(vao) && pass;<br>
> >> +       pass = test_getvertexarrayindexediv(vao) && pass;<br>
> >> +       pass = test_getvertexarrayindexed64iv(vao) && pass;<br>
> >> +<br>
> >> +       glDeleteVertexArrays(1, &vao);<br>
> >> +<br>
> >> +       piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);<br>
> >> +}<br>
> >> +<br>
> >> --<br>
> >> 2.1.4<br>
> >><br>
> >> Other than the mess in what parameters the spec should accept, this looks<br>
> > okay.<br>
> ><br>
> > Reviewed-by: Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>><br>
> ><br>
> >> _______________________________________________<br>
> >> Piglit mailing list<br>
> >> <a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
> >> <a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
> >><br>
> ><br>
> ><br>
><br>
<br>
</div></div></blockquote></div><br></div>