[Piglit] [PATCH 03/13] GL_EXT_texture_integer: Split off a bunch of tests to separate runs.

Eric Anholt eric at anholt.net
Sat Oct 15 13:19:32 PDT 2011


---
 tests/all.tests                                  |    3 +
 tests/spec/ext_texture_integer/CMakeLists.gl.txt |    3 +
 tests/spec/ext_texture_integer/api-drawpixels.c  |   58 +++++++++++++++
 tests/spec/ext_texture_integer/api-readpixels.c  |   59 +++++++++++++++
 tests/spec/ext_texture_integer/api-teximage.c    |   86 ++++++++++++++++++++++
 5 files changed, 209 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/ext_texture_integer/api-drawpixels.c
 create mode 100644 tests/spec/ext_texture_integer/api-readpixels.c
 create mode 100644 tests/spec/ext_texture_integer/api-teximage.c

diff --git a/tests/all.tests b/tests/all.tests
index 16f2e9e..e095e2c 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1180,6 +1180,9 @@ spec['EXT_texture_integer'] = ext_texture_integer
 # unsupported for int yet
 #add_fbo_clear_extension(ext_texture_integer, 'GL_EXT_texture_integer', 'fbo-clear-formats')
 add_plain_test(ext_texture_integer, 'ext_texture_integer-fbo_integer_precision_clear')
+ext_texture_integer['api-drawpixels'] = concurrent_test('ext_texture_integer-api-drawpixels')
+ext_texture_integer['api-teximage'] = concurrent_test('ext_texture_integer-api-teximage')
+ext_texture_integer['api-readpixels'] = concurrent_test('ext_texture_integer-api-readpixels')
 
 arb_texture_rg = Group()
 spec['ARB_texture_rg'] = arb_texture_rg
diff --git a/tests/spec/ext_texture_integer/CMakeLists.gl.txt b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
index 0d9ae5a..52ca4f2 100644
--- a/tests/spec/ext_texture_integer/CMakeLists.gl.txt
+++ b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
@@ -16,5 +16,8 @@ link_libraries (
 add_executable (ext_texture_integer-fbo_integer_precision_clear fbo-integer-precision-clear.c)
 add_executable (ext_texture_integer-fbo_integer_readpixels_sint_uint fbo-integer-readpixels-sint-uint.c)
 add_executable (ext_texture_integer-texture_integer_glsl130 texture-integer-glsl130.c)
+add_executable (ext_texture_integer-api-drawpixels api-drawpixels.c)
+add_executable (ext_texture_integer-api-readpixels api-readpixels.c)
+add_executable (ext_texture_integer-api-teximage api-teximage.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/ext_texture_integer/api-drawpixels.c b/tests/spec/ext_texture_integer/api-drawpixels.c
new file mode 100644
index 0000000..adf311e
--- /dev/null
+++ b/tests/spec/ext_texture_integer/api-drawpixels.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2010 VMware, Inc.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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 api-teximage.c
+ *
+ * Tests GL_EXT_texture_integer's error behavior with glTexImage2D().
+ */
+
+#include "piglit-util.h"
+
+int piglit_width = 10, piglit_height = 10;
+int piglit_window_mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE;
+
+enum piglit_result
+piglit_display(void)
+{
+	static const float black[4] = {0, 0, 0, 0};
+	static const float green[4] = {0, 1, 0, 0};
+	bool pass;
+
+	glClearColor(0.0, 1.0, 0.0, 0.0);
+	glClear(GL_COLOR_BUFFER_BIT);
+
+	glDrawPixels(1, 1, GL_RGBA_INTEGER_EXT, GL_FLOAT, black);
+	piglit_check_gl_error(GL_INVALID_ENUM, PIGLIT_FAIL);
+
+	pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
+
+	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	piglit_require_extension("GL_EXT_texture_integer");
+}
diff --git a/tests/spec/ext_texture_integer/api-readpixels.c b/tests/spec/ext_texture_integer/api-readpixels.c
new file mode 100644
index 0000000..9ea6eb6
--- /dev/null
+++ b/tests/spec/ext_texture_integer/api-readpixels.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2010 VMware, Inc.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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 api-readpixels.c
+ *
+ * Tests GL_EXT_texture_integer's error behavior with glReadPixels().
+ */
+
+#include "piglit-util.h"
+
+int piglit_width = 10, piglit_height = 10;
+int piglit_window_mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE;
+
+enum piglit_result
+piglit_display(void)
+{
+	/* UNREACHED */
+	return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	GLfloat buf[64];
+
+	piglit_require_extension("GL_EXT_texture_integer");
+
+	/* Is GL_INVALID_ENUM generated by glReadPixels? */
+	glReadPixels(0, 0, 4, 4, GL_RGBA_INTEGER, GL_FLOAT, buf);
+	piglit_check_gl_error(GL_INVALID_ENUM, PIGLIT_FAIL);
+
+	/* Is GL_INVALID_OPERATION generated by glReadPixels? */
+	glReadPixels(0, 0, 4, 4, GL_RGBA_INTEGER, GL_UNSIGNED_INT, buf);
+	piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
+
+	piglit_report_result(PIGLIT_PASS);
+}
diff --git a/tests/spec/ext_texture_integer/api-teximage.c b/tests/spec/ext_texture_integer/api-teximage.c
new file mode 100644
index 0000000..ef10f5d
--- /dev/null
+++ b/tests/spec/ext_texture_integer/api-teximage.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2010 VMware, Inc.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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 api-teximage.c
+ *
+ * Tests GL_EXT_texture_integer's error behavior with glTexImage2D().
+ */
+
+#include "piglit-util.h"
+
+#define ELEMENTS(ARRAY)  (sizeof(ARRAY) / sizeof(ARRAY[0]))
+
+int piglit_width = 10, piglit_height = 10;
+int piglit_window_mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE;
+
+enum piglit_result
+piglit_display(void)
+{
+	static const float black[4] = {0, 0, 0, 0};
+	GLuint tex;
+
+	glGenTextures(1, &tex);
+	glBindTexture(GL_TEXTURE_2D, tex);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+	/* Check that GL_FLOAT type is not accepted with integer formats */
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16UI_EXT, 1, 1, 0,
+		     GL_RGBA_INTEGER, GL_FLOAT, black);
+	piglit_check_gl_error(GL_INVALID_ENUM, PIGLIT_FAIL);
+
+	/* Check that GL_INVALID_OPERATION is generated by trying to mix
+	 * integer/float formats/types.
+	 */
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0,
+		     GL_RGBA_INTEGER, GL_SHORT, NULL);
+	piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
+
+	glTexSubImage2D(GL_TEXTURE_2D, 0,
+			0, 0, 4, 4,
+			GL_RGBA_INTEGER, GL_FLOAT, NULL);
+	piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
+
+	/* Check for GL_INVALID_OPERATION when trying to copy framebuffer pixels
+	 * to an integer texture when the framebuffer is not an integer format.
+	 */
+	/* make valid texture image here */
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16UI_EXT, 4, 4, 0,
+		     GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, NULL);
+
+	glCopyTexSubImage2D(GL_TEXTURE_2D, 0,
+			    0, 0, 0, 0, 4, 4);
+	piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
+
+	glDeleteTextures(1, &tex);
+
+	return PIGLIT_PASS;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	piglit_require_extension("GL_EXT_texture_integer");
+}
-- 
1.7.7



More information about the Piglit mailing list