Shuang He | 6 Jan 03:43 2012
Picon

[PATCH] fbo-max-depth-readpixels: New test for i965 driver bug

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37871
Signed-off-by: Shuang He <shuang.he@...>
---
 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
 <at>  <at>  -164,6 +164,7  <at>  <at>  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
 <at>  <at>  -84,6 +84,7  <at>  <at>  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
 <at>  <at>  -0,0 +1,81  <at>  <at> 
+/*
+ * 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> 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

_______________________________________________
Piglit mailing list
Piglit@...
http://lists.freedesktop.org/mailman/listinfo/piglit

Gmane