summaryrefslogtreecommitdiff
path: root/tests/hiz
diff options
context:
space:
mode:
authorChad Versace <chad.versace@intel.com>2011-05-18 16:01:24 -0700
committerChad Versace <chad.versace@intel.com>2011-05-19 07:49:23 -0700
commit734c6e417d5deb36ffacca53681cbfba1b4d3592 (patch)
tree7b8349bd7e35835b7b247090fc684132c5ff72a1 /tests/hiz
parentf3c84d12bc5113ba963c79956e0ba0505a0b25f7 (diff)
hiz: Factor out common code from hiz-depth-test-window*.c
... into hiz_run_test_depth_test_window(). The immediate result of this refactoring results in a net increas in code. But, it will prevent much code duplication on a subsequent commit that refactors the probe functions. Signed-off-by: Chad Versace <chad.versace@intel.com>
Diffstat (limited to 'tests/hiz')
-rw-r--r--tests/hiz/hiz-depth-test-window-stencil0.c10
-rw-r--r--tests/hiz/hiz-depth-test-window-stencil1.c10
-rw-r--r--tests/hiz/hiz-util.c10
-rw-r--r--tests/hiz/hiz-util.h9
4 files changed, 27 insertions, 12 deletions
diff --git a/tests/hiz/hiz-depth-test-window-stencil0.c b/tests/hiz/hiz-depth-test-window-stencil0.c
index 45bd6dacb..2c18be300 100644
--- a/tests/hiz/hiz-depth-test-window-stencil0.c
+++ b/tests/hiz/hiz-depth-test-window-stencil0.c
@@ -48,10 +48,8 @@ piglit_init(int argc, char **argv)
enum piglit_result
piglit_display()
{
- bool pass;
- hiz_draw_rects();
- pass = hiz_probe_rects();
- if (!piglit_automatic)
- glutSwapBuffers();
- return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+ if (hiz_run_test_depth_test_window())
+ return PIGLIT_PASS;
+ else
+ return PIGLIT_FAIL;
}
diff --git a/tests/hiz/hiz-depth-test-window-stencil1.c b/tests/hiz/hiz-depth-test-window-stencil1.c
index 0129dda76..88a5a1d67 100644
--- a/tests/hiz/hiz-depth-test-window-stencil1.c
+++ b/tests/hiz/hiz-depth-test-window-stencil1.c
@@ -48,10 +48,8 @@ piglit_init(int argc, char **argv)
enum piglit_result
piglit_display()
{
- bool pass;
- hiz_draw_rects();
- pass = hiz_probe_rects();
- if (!piglit_automatic)
- glutSwapBuffers();
- return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+ if (hiz_run_test_depth_test_window())
+ return PIGLIT_PASS;
+ else
+ return PIGLIT_FAIL;
}
diff --git a/tests/hiz/hiz-util.c b/tests/hiz/hiz-util.c
index d28bac2a0..7ca23afae 100644
--- a/tests/hiz/hiz-util.c
+++ b/tests/hiz/hiz-util.c
@@ -269,3 +269,13 @@ hiz_check_fbo_depth_test(const struct hiz_fbo_options *fbo_options)
return pass;
}
+
+bool
+hiz_run_test_depth_test_window() {
+ bool pass = true;
+ hiz_draw_rects();
+ pass = hiz_probe_rects();
+ if (!piglit_automatic)
+ glutSwapBuffers();
+ return pass;
+}
diff --git a/tests/hiz/hiz-util.h b/tests/hiz/hiz-util.h
index 5237011a7..50a99da01 100644
--- a/tests/hiz/hiz-util.h
+++ b/tests/hiz/hiz-util.h
@@ -91,3 +91,12 @@ void hiz_delete_fbo(GLuint fbo);
* \return True if test passed.
*/
bool hiz_check_fbo_depth_test(const struct hiz_fbo_options *options);
+
+/**
+ * Check that depth tests work correctly when rendering to the window
+ * framebuffer.
+ *
+ * \param options Perform the test with an FBO with the given formats.
+ * \return True if test passed.
+ */
+bool hiz_run_test_depth_test_window();