[Piglit] [PATCH 2/3] hiz: Add tests for depth tests when rendering to a window FB
chad at chad-versace.us
chad at chad-versace.us
Wed Apr 27 13:00:53 PDT 2011
From: Chad Versace <chad.versace at intel.com>
Add tests for two cases: when the stencil buffer is, and is not, present.
Signed-off-by: Chad Versace <chad.versace at intel.com>
---
tests/hiz/CMakeLists.gl.txt | 18 +++++++++
tests/hiz/hiz-depth-test-window-stencil0.c | 57 ++++++++++++++++++++++++++++
tests/hiz/hiz-depth-test-window-stencil1.c | 57 ++++++++++++++++++++++++++++
3 files changed, 132 insertions(+), 0 deletions(-)
create mode 100644 tests/hiz/hiz-depth-test-window-stencil0.c
create mode 100644 tests/hiz/hiz-depth-test-window-stencil1.c
diff --git a/tests/hiz/CMakeLists.gl.txt b/tests/hiz/CMakeLists.gl.txt
index 5db8fb9..6d584da 100644
--- a/tests/hiz/CMakeLists.gl.txt
+++ b/tests/hiz/CMakeLists.gl.txt
@@ -11,4 +11,22 @@ add_library(hiz-util
hiz-util.c
)
+link_libraries (
+ hiz-util
+ piglitutil
+
+ ${OPENGL_gl_LIBRARY}
+ ${OPENGL_glu_LIBRARY}
+ ${OPENGL_egl_LIBRARY}
+ ${GLUT_glut_LIBRARY}
+ ${TIFF_LIBRARY}
+)
+
+IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ link_libraries(pthread X11)
+ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+
+add_executable(hiz-depth-test-window-stencil0 hiz-depth-test-window-stencil0.c)
+add_executable(hiz-depth-test-window-stencil1 hiz-depth-test-window-stencil1.c)
+
# vim: ft=cmake:
diff --git a/tests/hiz/hiz-depth-test-window-stencil0.c b/tests/hiz/hiz-depth-test-window-stencil0.c
new file mode 100644
index 0000000..aafa8d0
--- /dev/null
+++ b/tests/hiz/hiz-depth-test-window-stencil0.c
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ *
+ * Authors:
+ * Chad Versace <chad.versace at intel.com>
+ */
+
+/**
+ * \file hiz-depth-test-window-stencil0.c
+ * \author Chad Versace <chad.versace at intel.com>
+ *
+ * Checks that depth tests work correctly when rendering to a window
+ * framebuffer with no stencilbuffer.
+ */
+
+#include "piglit-util.h"
+#include "hiz/hiz-util.h"
+
+int piglit_width = 400;
+int piglit_height = 400;
+int piglit_window_mode = GLUT_RGB | GLUT_ALPHA | GLUT_DEPTH;
+
+void
+piglit_init(int argc, char **argv)
+{
+ /* empty */
+}
+
+enum piglit_result
+piglit_display()
+{
+ bool pass;
+ hiz_draw_rects();
+ pass = hiz_probe_rects();
+ if (!piglit_automatic)
+ glutSwapBuffers();
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
diff --git a/tests/hiz/hiz-depth-test-window-stencil1.c b/tests/hiz/hiz-depth-test-window-stencil1.c
new file mode 100644
index 0000000..0129dda
--- /dev/null
+++ b/tests/hiz/hiz-depth-test-window-stencil1.c
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ *
+ * Authors:
+ * Chad Versace <chad.versace at intel.com>
+ */
+
+/**
+ * \file hiz-depth-test-window-stencil1.c
+ * \author Chad Versace <chad.versace at intel.com>
+ *
+ * Checks that depth tests work correctly when rendering to a window
+ * framebuffer with a stencilbuffer.
+ */
+
+#include "piglit-util.h"
+#include "hiz/hiz-util.h"
+
+int piglit_width = 400;
+int piglit_height = 400;
+int piglit_window_mode = GLUT_RGB | GLUT_ALPHA | GLUT_DEPTH | GLUT_STENCIL;
+
+void
+piglit_init(int argc, char **argv)
+{
+ /* empty */
+}
+
+enum piglit_result
+piglit_display()
+{
+ bool pass;
+ hiz_draw_rects();
+ pass = hiz_probe_rects();
+ if (!piglit_automatic)
+ glutSwapBuffers();
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
--
1.7.4.4
More information about the Piglit
mailing list