[Piglit] [PATCH 3/4] GL_ARB_texture_buffer_object/get: New test for remaining queries.

Eric Anholt eric at anholt.net
Mon Mar 26 12:27:10 PDT 2012


---
 tests/all.tests                                    |    1 +
 .../arb_texture_buffer_object/CMakeLists.gl.txt    |    1 +
 tests/spec/arb_texture_buffer_object/get.c         |   87 ++++++++++++++++++++
 3 files changed, 89 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/arb_texture_buffer_object/get.c

diff --git a/tests/all.tests b/tests/all.tests
index 4f6fbb1..be5b964 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1136,6 +1136,7 @@ add_plain_test(arb_explicit_attrib_location, 'glsl-explicit-location-05')
 arb_texture_buffer_object = Group()
 spec['ARB_texture_buffer_object'] = arb_texture_buffer_object
 arb_texture_buffer_object['dlist'] = concurrent_test('arb_texture_buffer_object-dlist')
+arb_texture_buffer_object['get'] = concurrent_test('arb_texture_buffer_object-get')
 arb_texture_buffer_object['minmax'] = concurrent_test('arb_texture_buffer_object-minmax')
 arb_texture_buffer_object['negative-bad-bo'] = concurrent_test('arb_texture_buffer_object-negative-bad-bo')
 arb_texture_buffer_object['negative-bad-format'] = concurrent_test('arb_texture_buffer_object-negative-bad-format')
diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
index c56b8a8..451fd27 100644
--- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
@@ -13,6 +13,7 @@ link_libraries (
 )
 
 piglit_add_executable (arb_texture_buffer_object-dlist dlist.c)
+piglit_add_executable (arb_texture_buffer_object-get get.c)
 piglit_add_executable (arb_texture_buffer_object-minmax minmax.c)
 piglit_add_executable (arb_texture_buffer_object-negative-bad-bo negative-bad-bo.c)
 piglit_add_executable (arb_texture_buffer_object-negative-bad-format negative-bad-format.c)
diff --git a/tests/spec/arb_texture_buffer_object/get.c b/tests/spec/arb_texture_buffer_object/get.c
new file mode 100644
index 0000000..86de2bc
--- /dev/null
+++ b/tests/spec/arb_texture_buffer_object/get.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright © 2011 Intel Corporation
+ *
+ * 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.h"
+
+/**
+ * @file get.c
+ *
+ * Tests glGetIntegerv queries not covered by other tests.
+ */
+
+int piglit_width = 32;
+int piglit_height = 32;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA;
+
+enum piglit_result
+piglit_display(void)
+{
+	/* UNREACHED */
+	return PIGLIT_FAIL;
+}
+
+static bool
+_expect(int line, GLenum token, GLint val)
+{
+	GLint ret = 0xd0d0d0d0;
+
+	glGetIntegerv(token, &ret);
+	if (ret != val) {
+		fprintf(stderr,
+			"line %d: %s was %d, expected %d\n",
+			line,
+			piglit_get_gl_enum_name(token), ret, val);
+		return false;
+	}
+
+	return true;
+}
+#define expect(token, val) _expect(__LINE__, token, val)
+
+void
+piglit_init(int argc, char **argv)
+{
+	bool pass = true;
+	GLuint tex, bo;
+
+	piglit_require_gl_version(20);
+	piglit_require_extension("GL_ARB_texture_buffer_object");
+
+	glGenTextures(1, &tex);
+	glGenBuffers(1, &bo);
+
+	pass = expect(GL_TEXTURE_BINDING_BUFFER, 0) && pass;
+	glBindTexture(GL_TEXTURE_BUFFER, tex);
+	pass = expect(GL_TEXTURE_BINDING_BUFFER, tex) && pass;
+
+	pass = expect(GL_TEXTURE_BUFFER, 0) && pass;
+	glBindBuffer(GL_TEXTURE_BUFFER, bo);
+	pass = expect(GL_TEXTURE_BUFFER, bo) && pass;
+
+	pass = expect(GL_TEXTURE_BUFFER_FORMAT, GL_LUMINANCE8) && pass;
+	glTexBufferARB(GL_TEXTURE_BUFFER, GL_RGBA8, 0);
+	pass = expect(GL_TEXTURE_BUFFER_FORMAT, GL_RGBA8) && pass;
+
+	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
-- 
1.7.9.1



More information about the Piglit mailing list