[Piglit] [PATCH 2/3] ARB_query_buffer_object: Add test for QUERY_BUFFER_BINDING

Rafal Mielniczuk rafal.mielniczuk2 at gmail.com
Wed Mar 19 14:29:08 PDT 2014


Tests if glGetIntegerv returns correct binding for
query buffer object

Signed-off-by: Rafal Mielniczuk <rafal.mielniczuk2 at gmail.com>
---
 tests/all.py                                       |  1 +
 .../spec/arb_query_buffer_object/CMakeLists.gl.txt |  1 +
 .../query_buffer_object-binding.c                  | 65 ++++++++++++++++++++++
 3 files changed, 67 insertions(+)
 create mode 100644 tests/spec/arb_query_buffer_object/query_buffer_object-binding.c

diff --git a/tests/all.py b/tests/all.py
index f47b215..b21b983 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1869,6 +1869,7 @@ add_plain_test(arb_provoking_vertex, 'arb-xfb-before-flatshading')
 arb_query_buffer_object = Group()
 spec['ARB_query_buffer_object'] = arb_query_buffer_object;
 add_plain_test(arb_query_buffer_object, 'arb_query_buffer_object-out-of-bound')
+add_plain_test(arb_query_buffer_object, 'arb_query_buffer_object-binding')
 
 # Group ARB_robustness
 arb_robustness = Group()
diff --git a/tests/spec/arb_query_buffer_object/CMakeLists.gl.txt b/tests/spec/arb_query_buffer_object/CMakeLists.gl.txt
index d007742..e566b1a 100644
--- a/tests/spec/arb_query_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_query_buffer_object/CMakeLists.gl.txt
@@ -10,5 +10,6 @@ link_libraries (
 )
 
 piglit_add_executable (arb_query_buffer_object-out-of-bound query_buffer_object-out-of-bound.c)
+piglit_add_executable (arb_query_buffer_object-binding query_buffer_object-binding.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_query_buffer_object/query_buffer_object-binding.c b/tests/spec/arb_query_buffer_object/query_buffer_object-binding.c
new file mode 100644
index 0000000..98c05c1
--- /dev/null
+++ b/tests/spec/arb_query_buffer_object/query_buffer_object-binding.c
@@ -0,0 +1,65 @@
+/**
+ * Copyright © 2014 Rafał Mielniczuk
+ *
+ * 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_compat_version = 10;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+#if !defined GL_QUERY_BUFFER
+#define GL_QUERY_BUFFER GL_QUERY_BUFFER_AMD
+#define GL_QUERY_BUFFER_BINDING GL_QUERY_BUFFER_BINDING_AMD
+#endif
+
+void
+piglit_init(int argc, char **argv)
+{
+	int test_pass = 1;
+	GLuint queryBuffer;
+	GLint queryBufferBinding = 0;
+
+	piglit_require_extension("GL_ARB_query_buffer_object");
+
+	glGenBuffers(1, &queryBuffer);
+	glBindBuffer(GL_QUERY_BUFFER, queryBuffer);
+
+	glGetIntegerv(GL_QUERY_BUFFER_BINDING, &queryBufferBinding);
+
+	/* Check if query buffer object binding has correct non zero value */
+	test_pass = (queryBufferBinding != 0);
+
+	if (!test_pass) {
+		fprintf(stderr, "glGetInteger(GL_QUERY_BUFFER_BINDING) failed\n");
+	}
+
+	piglit_report_result(test_pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+	return PIGLIT_FAIL;
+}
-- 
1.9.0



More information about the Piglit mailing list