[Piglit] [PATCH 2/4] GL_EXT_framebuffer_object/fbo-generatemipmap-no-image: Test for bug #40308.

Eric Anholt eric at anholt.net
Wed Oct 5 12:59:30 PDT 2011


---
 tests/all.tests                        |    4 ++
 tests/fbo/CMakeLists.gl.txt            |    1 +
 tests/fbo/fbo-generatemipmap-noimage.c |   53 ++++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 0 deletions(-)
 create mode 100644 tests/fbo/fbo-generatemipmap-noimage.c

diff --git a/tests/all.tests b/tests/all.tests
index 40bc92c..840d2c9 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1308,6 +1308,10 @@ ext_fog_coord = Group()
 spec['EXT_fog_coord'] = ext_fog_coord
 add_plain_test(ext_fog_coord, 'ext_fog_coord-modes')
 
+ext_framebuffer_object = Group()
+spec['EXT_framebuffer_object'] = ext_framebuffer_object
+add_concurrent_test(ext_framebuffer_object, 'fbo-generatemipmap-noimage')
+
 nv_texture_barrier = Group()
 spec['NV_texture_barrier'] = nv_texture_barrier
 add_plain_test(nv_texture_barrier, 'blending-in-shader')
diff --git a/tests/fbo/CMakeLists.gl.txt b/tests/fbo/CMakeLists.gl.txt
index 42a8584..6b5e32c 100644
--- a/tests/fbo/CMakeLists.gl.txt
+++ b/tests/fbo/CMakeLists.gl.txt
@@ -54,6 +54,7 @@ add_executable (fbo-generatemipmap-array fbo-generatemipmap-array.c)
 add_executable (fbo-generatemipmap-filtering fbo-generatemipmap-filtering.c)
 add_executable (fbo-generatemipmap-formats fbo-generatemipmap-formats.c)
 add_executable (fbo-generatemipmap-scissor fbo-generatemipmap-scissor.c)
+add_executable (fbo-generatemipmap-noimage fbo-generatemipmap-noimage.c)
 add_executable (fbo-generatemipmap-nonsquare fbo-generatemipmap-nonsquare.c)
 add_executable (fbo-generatemipmap-npot fbo-generatemipmap-npot.c)
 add_executable (fbo-generatemipmap-viewport fbo-generatemipmap-viewport.c)
diff --git a/tests/fbo/fbo-generatemipmap-noimage.c b/tests/fbo/fbo-generatemipmap-noimage.c
new file mode 100644
index 0000000..35c7889
--- /dev/null
+++ b/tests/fbo/fbo-generatemipmap-noimage.c
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+/** @file fbo-generatemipmap-noimage.c
+ *
+ * Test that a glGenerateMipmap() on a texture that has no images
+ * defined yet doesn't crash the driver.
+ *
+ * https://bugs.freedesktop.org/show_bug.cgi?id=40308
+ */
+
+#include "piglit-util.h"
+
+int piglit_width = 32;
+int piglit_height = 32;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
+enum piglit_result
+piglit_display(void)
+{
+	/* UNREACHED */
+	return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	piglit_require_extension("GL_EXT_framebuffer_object");
+
+	glGenerateMipmapEXT(GL_TEXTURE_2D);
+
+	piglit_report_result(PIGLIT_PASS);
+}
-- 
1.7.6.3



More information about the Piglit mailing list