<div dir="ltr">On 12 August 2013 09:53, Nicholas Mack <span dir="ltr"><<a href="mailto:nichmack@gmail.com" target="_blank">nichmack@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
V2: Added better piglit error messages.<br>
---<br>
 tests/spec/gl-3.2/CMakeLists.gl.txt           |   1 +<br>
 tests/spec/gl-3.2/get-buffer-parameter-i64v.c | 110 ++++++++++++++++++++++++++<br>
 2 files changed, 111 insertions(+)<br>
 create mode 100644 tests/spec/gl-3.2/get-buffer-parameter-i64v.c<br>
<br>
diff --git a/tests/spec/gl-3.2/CMakeLists.gl.txt b/tests/spec/gl-3.2/CMakeLists.gl.txt<br>
index c6c99b8..bb0d008 100644<br>
--- a/tests/spec/gl-3.2/CMakeLists.gl.txt<br>
+++ b/tests/spec/gl-3.2/CMakeLists.gl.txt<br>
@@ -10,5 +10,6 @@ link_libraries (<br>
 )<br>
<br>
 piglit_add_executable (gl-3.2-minmax minmax.c)<br>
+piglit_add_executable (gl-3.2-get-buffer-parameter-i64v get-buffer-parameter-i64v.c)<br></blockquote><div><br></div><div>Don't forget to add this to all.tests.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<br>
 # vim: ft=cmake:<br>
diff --git a/tests/spec/gl-3.2/get-buffer-parameter-i64v.c b/tests/spec/gl-3.2/get-buffer-parameter-i64v.c<br>
new file mode 100644<br>
index 0000000..7c049ee<br>
--- /dev/null<br>
+++ b/tests/spec/gl-3.2/get-buffer-parameter-i64v.c<br>
@@ -0,0 +1,110 @@<br>
+/**<br>
+ * Copyright © 2013 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 DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ */<br>
+<br>
+/**<br>
+ * Test GetBufferParameteri64v()<br>
+ *<br>
+ * GL 3.2 core spec added GetBufferParameteri64v() in section 6.1.8<br>
+ *<br>
+ * GetBufferParameteri64v() returns an int64 value corresponding to the size, map<br>
+ * offset, or map length of the target buffer<br>
+ *<br>
+ */<br>
+<br>
+#include "piglit-util-gl-common.h"<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<br>
+       config.supports_gl_core_version = 32;<br>
+       config.supports_gl_compat_version = 32;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+       /* UNREACHED */<br>
+       return PIGLIT_FAIL;<br>
+}<br>
+<br>
+static const GLenum buffers[] = { GL_ARRAY_BUFFER, GL_COPY_READ_BUFFER,<br>
+                       GL_COPY_WRITE_BUFFER, GL_ELEMENT_ARRAY_BUFFER,<br>
+                       GL_PIXEL_PACK_BUFFER, GL_PIXEL_UNPACK_BUFFER,<br>
+                       GL_TEXTURE_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER,<br>
+                       GL_UNIFORM_BUFFER };<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+       bool pass = true;<br>
+       GLint64 data = -2;<br>
+       int i = 0;<br>
+<br>
+       int stuff[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};<br>
+       int size = sizeof(stuff);<br>
+       int offset = 1;<br>
+       int range = 5;<br>
+<br>
+       GLuint buff = 0;<br>
+       glGenBuffers(1, &buff);<br>
+<br>
+       for (i = 0; i < sizeof(buffers)/sizeof(GLenum); i++) {<br></blockquote><div><br></div><div>Use this instead--it's more readable:<br><br></div><div>for (i = 0; i < ARRAY_SIZE(buffers); i++) {<br></div><div>
 </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+               glBindBuffer(buffers[i], buff);<br>
+               glBufferData(buffers[i], size, stuff, GL_STATIC_READ);<br>
+               glMapBufferRange(buffers[i], offset, range, GL_MAP_READ_BIT);<br>
+<br>
+               glGetBufferParameteri64v(buffers[i], GL_BUFFER_SIZE, &data);<br>
+               if(data != size) {<br>
+                       printf("GL_BUFFER_SIZE for %s expected %d, but %d "<br>
+                               "was returned.\n",<br>
+                               piglit_get_gl_enum_name(buffers[i]),<br>
+                               size, (int)data);<br>
+                       pass = false;<br>
+               }<br>
+               pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+<br>
+               glGetBufferParameteri64v(buffers[i], GL_BUFFER_MAP_OFFSET, &data);<br>
+               if(data != offset) {<br>
+                       printf("GL_BUFFER_MAP_OFFSET for %s expected %d, but "<br>
+                               "%d was returned.\n",<br>
+                               piglit_get_gl_enum_name(buffers[i]),<br>
+                               offset, (int)data);<br>
+                       pass = false;<br>
+               }<br>
+               pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+<br>
+               glGetBufferParameteri64v(buffers[i], GL_BUFFER_MAP_LENGTH, &data);<br>
+               if(data != range) {<br>
+                       printf("GL_BUFFER_MAP_LENGTH for %s expected %d, but "<br>
+                               "%d was returned.\n",<br>
+                               piglit_get_gl_enum_name(buffers[i]),<br>
+                               range, (int)data);<br>
+                       pass = false;<br>
+               }<br></blockquote><div><br></div><div>Just for the sake of sanity let's call:<br><br>glUnmapBuffer(buffers[i]);<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

+               pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+       }<br>
+<br>
+       pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+<br>
+       piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);<br>
+}<br>
<span class=""><font color="#888888">--<br>
1.8.3.1<br></font></span></blockquote><div><br></div><div>With those minor fixes, this patch is:<br><br></div><div>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div>
</div></div></div>