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