aboutsummaryrefslogtreecommitdiff
path: root/tests/hiz
diff options
context:
space:
mode:
authorChad Versace <chad.versace@intel.com>2011-04-27 10:37:23 -0700
committerChad Versace <chad.versace@intel.com>2011-04-28 14:26:56 -0700
commit1f4ab9697ae9e2cf00a820f902514247399a5da7 (patch)
tree287499142ba010e3bf76b51435114ff5f744b376 /tests/hiz
parent80e2d30e611385fd5956d67f39967a0190a1593b (diff)
hiz: Add tests for depth tests when rendering to a window FB
Add tests for two cases: when the stencil buffer is, and is not, present. Reviewed-By: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@intel.com>
Diffstat (limited to 'tests/hiz')
-rw-r--r--tests/hiz/CMakeLists.gl.txt18
-rw-r--r--tests/hiz/hiz-depth-test-window-stencil0.c57
-rw-r--r--tests/hiz/hiz-depth-test-window-stencil1.c57
3 files changed, 132 insertions, 0 deletions
diff --git a/tests/hiz/CMakeLists.gl.txt b/tests/hiz/CMakeLists.gl.txt
index 5db8fb9b..6d584da2 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 00000000..aafa8d0a
--- /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@intel.com>
+ */
+
+/**
+ * \file hiz-depth-test-window-stencil0.c
+ * \author Chad Versace <chad.versace@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 00000000..0129dda7
--- /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@intel.com>
+ */
+
+/**
+ * \file hiz-depth-test-window-stencil1.c
+ * \author Chad Versace <chad.versace@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;
+}