[Piglit] [PATCH 4/4] GL_ARB_texture_buffer_object/unused-name: Test another little bit of spec.

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


---
 tests/all.tests                                    |    1 +
 .../arb_texture_buffer_object/CMakeLists.gl.txt    |    1 +
 tests/spec/arb_texture_buffer_object/unused-name.c |   75 ++++++++++++++++++++
 3 files changed, 77 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/arb_texture_buffer_object/unused-name.c

diff --git a/tests/all.tests b/tests/all.tests
index be5b964..56aad2e 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1141,6 +1141,7 @@ arb_texture_buffer_object['minmax'] = concurrent_test('arb_texture_buffer_object
 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')
 arb_texture_buffer_object['negative-bad-target'] = concurrent_test('arb_texture_buffer_object-negative-bad-target')
+arb_texture_buffer_object['unused-name'] = concurrent_test('unused-name')
 
 arb_texture_rectangle = Group()
 spec['ARB_texture_rectangle'] = arb_texture_rectangle
diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
index 451fd27..572ae2d 100644
--- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
@@ -18,3 +18,4 @@ 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)
 piglit_add_executable (arb_texture_buffer_object-negative-bad-target negative-bad-target.c)
+piglit_add_executable (arb_texture_buffer_object-unused-name unused-name.c)
diff --git a/tests/spec/arb_texture_buffer_object/unused-name.c b/tests/spec/arb_texture_buffer_object/unused-name.c
new file mode 100644
index 0000000..0bd1911
--- /dev/null
+++ b/tests/spec/arb_texture_buffer_object/unused-name.c
@@ -0,0 +1,75 @@
+/*
+ * 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 unused-name.c
+ *
+ * Tests that TBOs don't require glGenTextures() for their names.
+ *
+ * From the GL_ARB_texture_buffer_object spec:
+ *
+ *     "A texture object is created by binding an unused name to
+ *      TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, or
+ *      TEXTURE_BUFFER_ARB."
+ */
+
+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 tex = 1, bo;
+
+	piglit_require_extension("GL_ARB_texture_buffer_object");
+
+	assert(!glIsTexture(tex));
+
+	glBindTexture(GL_TEXTURE_BUFFER, tex);
+
+	if (!glIsTexture(tex)) {
+		fprintf(stderr,
+			"Binding %d to GL_TEXTURE_BINDING_BUFFER didn't "
+			"create a texture.\n", tex);
+	}
+
+	/* Do something to the newly-genned texture. */
+	glGenBuffers(1, &bo);
+	glBindBuffer(GL_TEXTURE_BUFFER, bo);
+
+	if (!piglit_check_gl_error(0))
+		pass = false;
+
+	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
-- 
1.7.9.1



More information about the Piglit mailing list