[Piglit] [PATCH 2/4] GL_ARB_texture_buffer_object/dlist: New test for display list handling.

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


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

diff --git a/tests/all.tests b/tests/all.tests
index cacc7aa..4f6fbb1 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1135,6 +1135,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['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 939b53c..c56b8a8 100644
--- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ link_libraries (
 	${GLUT_glut_LIBRARY}
 )
 
+piglit_add_executable (arb_texture_buffer_object-dlist dlist.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/dlist.c b/tests/spec/arb_texture_buffer_object/dlist.c
new file mode 100644
index 0000000..ed7cc6c
--- /dev/null
+++ b/tests/spec/arb_texture_buffer_object/dlist.c
@@ -0,0 +1,92 @@
+/*
+ * 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 dlist.c
+ *
+ * Tests display list behavior for GL_ARB_texture_buffer_object.
+ *
+ * The new entrypoint was added to the list of buffer-object related
+ * commands that are executed immediately and not added to the display
+ * list.
+ */
+
+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;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	bool pass = true;
+	GLuint list, tex, bo;
+	GLint ret;
+
+	piglit_require_gl_version(20);
+	piglit_require_extension("GL_ARB_texture_buffer_object");
+
+	glGenTextures(1, &tex);
+	glBindTexture(GL_TEXTURE_BUFFER, tex);
+
+	glGenBuffers(1, &bo);
+	glBindBuffer(GL_TEXTURE_BUFFER, bo);
+
+	list = glGenLists(1);
+	glNewList(list, GL_COMPILE);
+	glTexBufferARB(GL_TEXTURE_BUFFER, GL_RGBA8, bo);
+	glEndList();
+
+	ret = 0xd0d0d0d0;
+	glGetIntegerv(GL_TEXTURE_BUFFER_DATA_STORE_BINDING, &ret);
+	if (ret != bo) {
+		fprintf(stderr,
+			"GL_TEXTURE_BUFFER_DATA_STORE after display list "
+			"compile was %d, expected %d\n", ret, bo);
+		pass = false;
+	}
+
+	/* Make sure the list is empty. */
+	glTexBufferARB(GL_TEXTURE_BUFFER, GL_RGBA8, 0);
+	glCallList(list);
+	if (!piglit_check_gl_error(0))
+		pass = false;
+
+	glGetIntegerv(GL_TEXTURE_BUFFER_DATA_STORE_BINDING, &ret);
+	if (ret != 0) {
+		fprintf(stderr,
+			"GL_TEXTURE_BUFFER_DATA_STORE after display list "
+			"compile was %d, expected %d\n", ret, 0);
+		pass = false;
+	}
+
+	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
-- 
1.7.9.1



More information about the Piglit mailing list