<div dir="ltr"><div>Again *hopefully* we are testing usage somewhere else.  If we are not, let's add a non-DSA test for usage.<br><br></div>I used the same test for Data and SubData because I ended up implementing them together.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 18, 2015 at 8:06 AM, Martin Peres <span dir="ltr"><<a href="mailto:martin.peres@linux.intel.com" target="_blank">martin.peres@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
On 23/01/15 21:03, Laura Ekstrand wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
  tests/all.py                                       |   1 +<br>
  .../spec/arb_direct_state_<u></u>access/CMakeLists.gl.txt |   1 +<br>
  .../namedbuffersubdata-vbo-<u></u>sync.c                  | 119 +++++++++++++++++++++<br>
  3 files changed, 121 insertions(+)<br>
  create mode 100644 tests/spec/arb_direct_state_<u></u>access/namedbuffersubdata-vbo-<u></u>sync.c<br>
<br>
diff --git a/tests/all.py b/tests/all.py<br>
index 7ec9d64..69a7cd7 100644<br>
--- a/tests/all.py<br>
+++ b/tests/all.py<br>
@@ -4423,6 +4423,7 @@ spec['ARB_direct_state_access'<u></u>]['texture-storage-<u></u>multisample'] = PiglitGLTest(['<br>
  spec['ARB_direct_state_access'<u></u>]['texture-buffer'] = PiglitGLTest(['arb_direct_<u></u>state_access-texture-buffer'], run_concurrent=True)<br>
  spec['ARB_direct_state_access'<u></u>]['texture-buffer-range'] = PiglitGLTest(['arb_direct_<u></u>state_access-texture-buffer-<u></u>range'], run_concurrent=True)<br>
  spec['ARB_direct_state_access'<u></u>]['namedbufferstorage-<u></u>persistent'] = PiglitGLTest(['arb_direct_<u></u>state_access-<u></u>namedbufferstorage-persistent'<u></u>], run_concurrent=True)<br>
+spec['ARB_direct_state_<u></u>access']['namedbuffersubdata-<u></u>vbo-sync'] = PiglitGLTest(['arb_direct_<u></u>state_access-<u></u>namedbuffersubdata-vbo-sync'], run_concurrent=True)<br>
    profile.tests['hiz'] = hiz<br>
  profile.tests['fast_color_<u></u>clear'] = fast_color_clear<br>
diff --git a/tests/spec/arb_direct_state_<u></u>access/CMakeLists.gl.txt b/tests/spec/arb_direct_state_<u></u>access/CMakeLists.gl.txt<br>
index 9228917..eedd60d 100644<br>
--- a/tests/spec/arb_direct_state_<u></u>access/CMakeLists.gl.txt<br>
+++ b/tests/spec/arb_direct_state_<u></u>access/CMakeLists.gl.txt<br>
@@ -10,6 +10,7 @@ link_libraries (<br>
  )<br>
    piglit_add_executable (arb_direct_state_access-<u></u>namedbufferstorage-persistent namedbufferstorage.c)<br>
+piglit_add_executable (arb_direct_state_access-<u></u>namedbuffersubdata-vbo-sync namedbuffersubdata-vbo-sync.c)<br>
  piglit_add_executable (arb_direct_state_access-dsa-<u></u>textures dsa-textures.c dsa-utils.c)<br>
  piglit_add_executable (arb_direct_state_access-<u></u>texturesubimage texturesubimage.c)<br>
  piglit_add_executable (arb_direct_state_access-bind-<u></u>texture-unit bind-texture-unit.c)<br>
diff --git a/tests/spec/arb_direct_state_<u></u>access/namedbuffersubdata-vbo-<u></u>sync.c b/tests/spec/arb_direct_state_<u></u>access/namedbuffersubdata-vbo-<u></u>sync.c<br>
new file mode 100644<br>
index 0000000..60ebcda<br>
--- /dev/null<br>
+++ b/tests/spec/arb_direct_state_<u></u>access/namedbuffersubdata-vbo-<u></u>sync.c<br>
@@ -0,0 +1,119 @@<br>
+/*<br>
+ * Copyright © 2009, 2015 Intel Corporation<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br>
+ * DEALINGS IN THE SOFTWARE.<br>
+ *<br>
+ * Authors:<br>
+ *    Ben Holmes <<a href="mailto:shranzel@hotmail.com" target="_blank">shranzel@hotmail.com</a>><br>
+ *    Eric Anholt <<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>><br>
+ *<br>
+ * Adapted by Laura Ekstrand <<a href="mailto:laura@jlekstrand.net" target="_blank">laura@jlekstrand.net</a>> to test<br>
+ * NamedBufferSubData, January 2015.<br>
+ */<br>
+<br>
+/** @file namedbuffersubdata-vbo-sync.c<br>
+ *<br>
+ * Test for synchronizing behavior of glNamedBufferSubData.<br>
+ */<br>
+<br>
+#include "piglit-util-gl.h"<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<br>
+       config.supports_gl_compat_<u></u>version = 10;<br>
+<br>
+       config.window_width = 400;<br>
+       config.window_height = 300;<br>
+       config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+static GLuint vbo;<br>
+#define RECT_WIDTH 200<br>
+#define RECT_HEIGHT 150<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+       piglit_require_extension("GL_<u></u>ARB_vertex_buffer_object");<br>
+       piglit_require_extension("GL_<u></u>ARB_direct_state_access");<br>
+<br>
+       piglit_ortho_projection(<u></u>piglit_width, piglit_height, GL_FALSE);<br>
+<br>
+       glCreateBuffers(1, &vbo);<br>
+}<br>
+<br>
+static void<br>
+verify_rect(GLboolean *pass, int hpos, int vpos, const float *expected)<br>
+{<br>
+       *pass = piglit_probe_rect_rgb(hpos * RECT_WIDTH, vpos * RECT_HEIGHT,<br>
+                                     RECT_WIDTH, RECT_HEIGHT,<br>
+                                     expected) && *pass;<br>
+}<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+       GLfloat white[4] = {1.0, 1.0, 1.0, 0.0};<br>
+       GLfloat black[4] = {0.0, 0.0, 0.0, 0.0};<br>
+       GLboolean pass = GL_TRUE;<br>
+       GLfloat varray1[12] = {1 * RECT_WIDTH, 0 * RECT_HEIGHT, 0,<br>
+                              1 * RECT_WIDTH, 1 * RECT_HEIGHT, 0,<br>
+                              0 * RECT_WIDTH, 0 * RECT_HEIGHT, 0,<br>
+                              0 * RECT_WIDTH, 1 * RECT_HEIGHT, 0};<br>
+       GLfloat varray2[12] = {2 * RECT_WIDTH, 1 * RECT_HEIGHT, 0,<br>
+                              2 * RECT_WIDTH, 2 * RECT_HEIGHT, 0,<br>
+                              1 * RECT_WIDTH, 1 * RECT_HEIGHT, 0,<br>
+                              1 * RECT_WIDTH, 2 * RECT_HEIGHT, 0};<br>
+       GLenum err;<br>
+<br>
+       glNamedBufferData(vbo, 12 * sizeof(GLfloat), varray1,<br>
+                         GL_DYNAMIC_DRAW);<br>
</blockquote>
<br></div></div>
Ok, so this tests both Data and SubData. I was looking for separate patches but why not!<br>
<br>
Would there be a point in trying with different usage flags?<br>
<br>
I'll re-read this when I am not sick any more...<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+       glBindBuffer(GL_ARRAY_BUFFER, vbo);<br>
+       glEnableClientState(GL_VERTEX_<u></u>ARRAY);<br>
+       glVertexPointer(3, GL_FLOAT, 0, 0);<br>
+<br>
+       glClear(GL_COLOR_BUFFER_BIT);<br>
+       glDrawArrays(GL_TRIANGLE_<u></u>STRIP, 0, 4);<br>
+<br>
+       /* Demonstrate inserting data while not bound */<br>
+       glBindBuffer(GL_ARRAY_BUFFER, 0);<br>
+       glNamedBufferSubData(vbo, 0, 12 * sizeof(GLfloat), varray2);<br>
+       glBindBuffer(GL_ARRAY_BUFFER, vbo);<br>
+<br>
+       glDrawArrays(GL_TRIANGLE_<u></u>STRIP, 0, 4);<br>
+<br>
+       if ((err = glGetError()) != 0) {<br>
+               printf("gl error: 0x%08x\n", err);<br>
+               pass = GL_FALSE;<br>
+       }<br>
+<br>
+       verify_rect(&pass, 0, 0, white);<br>
+       verify_rect(&pass, 1, 0, black);<br>
+       verify_rect(&pass, 1, 1, white);<br>
+       verify_rect(&pass, 0, 1, black);<br>
+<br>
+       piglit_present_results();<br>
+<br>
+       glDisableClientState(GL_<u></u>VERTEX_ARRAY);<br>
+<br>
+       return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>