[Piglit] =?y?q?=5BPATCH=5D=20fbo-max-depth-readpixels=3A=20New=20test=20for=20i965=20driver=20bug?=

Shuang He shuang.he at intel.com
Thu Jan 5 18:43:43 PST 2012


Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37871
Signed-off-by: Shuang He <shuang.he at intel.com>
---
 tests/all.tests                      |    1 +
 tests/fbo/CMakeLists.gl.txt          |    1 +
 tests/fbo/fbo-max-depth-readpixels.c |   81 ++++++++++++++++++++++++++++++++++
 3 files changed, 83 insertions(+), 0 deletions(-)
 create mode 100644 tests/fbo/fbo-max-depth-readpixels.c

diff --git a/tests/all.tests b/tests/all.tests
index 1b1c848..4e1c82f 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -164,6 +164,7 @@ add_plain_test(fbo, 'fbo-clear-formats')
 add_plain_test(fbo, 'fbo-copypix')
 add_plain_test(fbo, 'fbo-copyteximage')
 add_plain_test(fbo, 'fbo-copyteximage-simple')
+add_plain_test(fbo, 'fbo-max-depth-readpixels')
 add_plain_test(fbo, 'fbo-depth-array')
 add_plain_test(fbo, 'fbo-depthtex')
 add_plain_test(fbo, 'fbo-depth-sample-compare')
diff --git a/tests/fbo/CMakeLists.gl.txt b/tests/fbo/CMakeLists.gl.txt
index 6b5e32c..99839eb 100644
--- a/tests/fbo/CMakeLists.gl.txt
+++ b/tests/fbo/CMakeLists.gl.txt
@@ -84,6 +84,7 @@ add_executable (fbo-sys-sub-blit fbo-sys-sub-blit.c)
 add_executable (fbo-pbo-readpixels-small fbo-pbo-readpixels-small.c)
 add_executable (fbo-copyteximage fbo-copyteximage.c)
 add_executable (fbo-copyteximage-simple fbo-copyteximage-simple.c)
+add_executable (fbo-max-depth-readpixels fbo-max-depth-readpixels.c)
 add_executable (fbo-cubemap fbo-cubemap.c)
 add_executable (fbo-scissor-bitmap fbo-scissor-bitmap.c)
 
diff --git a/tests/fbo/fbo-max-depth-readpixels.c b/tests/fbo/fbo-max-depth-readpixels.c
new file mode 100644
index 0000000..1e40824
--- /dev/null
+++ b/tests/fbo/fbo-max-depth-readpixels.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright © 20011Intel 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.
+ *
+ * Authors:
+ *    Shuang He <shuang.he at intel.com>
+ *
+ */
+
+/** @file fbo-max-depth-readpixels.c
+ *
+ * Tests that glReadPixels from a max supported size depth fbo
+ */
+
+#include "piglit-util.h"
+
+int piglit_width = 100;
+int piglit_height = 100;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB;
+
+enum piglit_result
+piglit_display(void)
+{
+	GLboolean pass = GL_TRUE;
+	GLuint fb, rb;
+	GLint maxRenderbufferSize;
+	GLenum status;
+
+	glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &maxRenderbufferSize);
+
+	glGenFramebuffersEXT(1, &fb);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
+	glGenRenderbuffersEXT(1, &rb);
+	glBindRenderbufferEXT(GL_RENDERBUFFER, rb);
+	glRenderbufferStorageEXT(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, maxRenderbufferSize, maxRenderbufferSize);
+	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rb);
+	glDrawBuffer(GL_NONE);
+	glReadBuffer(GL_NONE);
+
+	assert(glGetError() == 0);
+
+	status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
+	if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+		fprintf(stderr, "FBO incomplete\n");
+		piglit_report_result(PIGLIT_SKIP);
+	}
+
+	glClearDepth(0.5);
+	glClear(GL_DEPTH_BUFFER_BIT);
+
+	pass &= piglit_probe_rect_depth(0, 0, maxRenderbufferSize, maxRenderbufferSize, 0.5);
+
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glDeleteRenderbuffersEXT(1, &rb);
+	glDeleteFramebuffersEXT(1, &fb);
+
+	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void piglit_init(int argc, char **argv)
+{
+	piglit_require_extension("GL_EXT_framebuffer_object");
+}
-- 
1.7.3.2.432.gad1a9.dirty



More information about the Piglit mailing list