[Piglit] [PATCH 1/5] EXT_framebuffer_multisample/negative-max-samples: New test for error case.

Eric Anholt eric at anholt.net
Thu Jan 5 19:53:16 PST 2012


---
 tests/all.tests                                    |    4 +
 tests/spec/CMakeLists.txt                          |    1 +
 .../ext_framebuffer_multisample/CMakeLists.gl.txt  |   14 ++++
 .../ext_framebuffer_multisample/CMakeLists.txt     |    1 +
 .../negative-max-samples.c                         |   72 ++++++++++++++++++++
 5 files changed, 92 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt
 create mode 100644 tests/spec/ext_framebuffer_multisample/CMakeLists.txt
 create mode 100644 tests/spec/ext_framebuffer_multisample/negative-max-samples.c

diff --git a/tests/all.tests b/tests/all.tests
index 8dab27b..eb333ce 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1205,6 +1205,10 @@ arb_vertex_program['getlocal4d-with-error'] = PlainExecTest(['arb_vertex_program
 arb_vertex_program['clip-plane-transformation arb'] = concurrent_test('clip-plane-transformation arb')
 arb_vertex_program['minmax'] = concurrent_test('arb_vertex_program-minmax')
 
+ext_framebuffer_multisample = Group()
+spec['EXT_framebuffer_multisample'] = ext_framebuffer_multisample
+ext_framebuffer_multisample['negative-max-samples'] = concurrent_test('ext_framebuffer_multisample-negative-max-samples')
+
 ext_framebuffer_object = Group()
 spec['EXT_framebuffer_object'] = ext_framebuffer_object
 add_fbo_stencil_tests(ext_framebuffer_object, 'GL_STENCIL_INDEX1')
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 12e2e4a..485f0c0 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -16,6 +16,7 @@ add_subdirectory (arb_texture_storage)
 add_subdirectory (arb_transform_feedback2)
 add_subdirectory (ati_envmap_bumpmap)
 add_subdirectory (ext_fog_coord)
+add_subdirectory (ext_framebuffer_multisample)
 add_subdirectory (ext_packed_depth_stencil)
 add_subdirectory (ext_packed_float)
 add_subdirectory (ext_timer_query)
diff --git a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt
new file mode 100644
index 0000000..3de9455
--- /dev/null
+++ b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt
@@ -0,0 +1,14 @@
+include_directories(
+	${OPENGL_INCLUDE_PATH}
+	${GLUT_INCLUDE_DIR}
+	${piglit_SOURCE_DIR}/tests/util
+)
+
+link_libraries (
+	piglitutil
+	${OPENGL_gl_LIBRARY}
+	${OPENGL_glu_LIBRARY}
+	${GLUT_glut_LIBRARY}
+)
+
+add_executable (ext_framebuffer_multisample-negative-max-samples negative-max-samples.c)
diff --git a/tests/spec/ext_framebuffer_multisample/CMakeLists.txt b/tests/spec/ext_framebuffer_multisample/CMakeLists.txt
new file mode 100644
index 0000000..144a306
--- /dev/null
+++ b/tests/spec/ext_framebuffer_multisample/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/ext_framebuffer_multisample/negative-max-samples.c b/tests/spec/ext_framebuffer_multisample/negative-max-samples.c
new file mode 100644
index 0000000..ab7cd19
--- /dev/null
+++ b/tests/spec/ext_framebuffer_multisample/negative-max-samples.c
@@ -0,0 +1,72 @@
+/*
+ * 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 negative-max-samples.c
+ *
+ * Tests that asking for more that GL_MAX_SAMPLES fails.
+ *
+ * From the EXT_framebuffer_multisample spec:
+ *
+ *     "If either <width> or <height> is greater than
+ *      MAX_RENDERBUFFER_SIZE_EXT, or if <samples> is greater than
+ *      MAX_SAMPLES_EXT, then the error INVALID_VALUE is generated."
+ */
+
+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)
+{
+	GLint max_samples;
+	GLuint rb;
+
+	piglit_require_extension("GL_EXT_framebuffer_multisample");
+
+	glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
+	piglit_check_gl_error(0, PIGLIT_FAIL);
+
+	glGenRenderbuffersEXT(1, &rb);
+	glBindRenderbufferEXT(GL_RENDERBUFFER, rb);
+
+	glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER,
+					    max_samples + 1,
+					    GL_RGBA,
+					    1, 1);
+	piglit_check_gl_error(GL_INVALID_VALUE, PIGLIT_FAIL);
+
+	glDeleteRenderbuffersEXT(1, &rb);
+
+	piglit_report_result(PIGLIT_PASS);
+}
-- 
1.7.7.3



More information about the Piglit mailing list