summaryrefslogtreecommitdiff
path: root/tests/hiz
diff options
context:
space:
mode:
authorChad Versace <chad.versace@intel.com>2011-05-18 16:44:19 -0700
committerChad Versace <chad.versace@intel.com>2011-05-19 07:49:23 -0700
commit45e22984b4d8c8f254b49d9741e6c98417ca31be (patch)
tree940feafdcee8e4e8b76f84e280155f1e0bd5198c /tests/hiz
parent53facdccd5b535c358bf931d4c7001afce529568 (diff)
hiz: Eliminate hiz_draw_rects()
This function will soon cease to be useful, since more complex hiz tests will each have their own drawing routine. The function body has been copied into hiz_run_test_depth_test_common(), which contains the common functionality needed by hiz_run_test_depth_test_{fbo,window}(). Signed-off-by: Chad Versace <chad.versace@intel.com>
Diffstat (limited to 'tests/hiz')
-rw-r--r--tests/hiz/hiz-util.c83
-rw-r--r--tests/hiz/hiz-util.h23
2 files changed, 49 insertions, 57 deletions
diff --git a/tests/hiz/hiz-util.c b/tests/hiz/hiz-util.c
index ec54add89..fba4e1a9e 100644
--- a/tests/hiz/hiz-util.c
+++ b/tests/hiz/hiz-util.c
@@ -34,35 +34,6 @@
#include "piglit-util.h"
#include "hiz/hiz-util.h"
-void
-hiz_draw_rects()
-{
- const float width_3 = piglit_width / 3.0;
- const float height_3 = piglit_height / 3.0;
-
- glEnable(GL_DEPTH_TEST);
- glDepthFunc(GL_LESS);
- glClearDepth(hiz_clear_z);
- glClearColor(hiz_grey[0], hiz_grey[1], hiz_grey[2], hiz_grey[3]);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glViewport(0, 0, piglit_width, piglit_height);
- piglit_ortho_projection(piglit_width, piglit_height, false);
-
- glColor4fv(hiz_green);
- glDepthRange(hiz_green_z, hiz_green_z);
- piglit_draw_rect(0 * width_3, 0 * width_3, /* x, y */
- 2 * width_3, 2 * height_3); /* width, height */
-
- glColor4fv(hiz_blue);
- glDepthRange(hiz_blue_z, hiz_blue_z);
- piglit_draw_rect(1 * width_3, 1 * height_3, /* x, y */
- 2 * width_3, 2 * height_3); /* width, height */
-
- glClearDepth(1.0);
- glDepthRange(0, 1);
-}
-
bool
hiz_probe_rects()
{
@@ -238,6 +209,51 @@ hiz_delete_fbo(GLuint fbo)
assert(!glGetError());
}
+/* ------------------------------------------------------------------------ */
+
+/**
+ * \name hiz_run_depth_test utilties
+ *
+ * Utilities for testing depth testing.
+ *
+ * \{
+ */
+
+/**
+ * Common functionality needed by hiz_run_test_depth_test_fbo() and
+ * hiz_run_test_depth_test_window().
+ */
+static bool
+hiz_run_test_depth_test_common()
+{
+ const float width_3 = piglit_width / 3.0;
+ const float height_3 = piglit_height / 3.0;
+
+ glEnable(GL_DEPTH_TEST);
+ glDepthFunc(GL_LESS);
+ glClearDepth(hiz_clear_z);
+ glClearColor(hiz_grey[0], hiz_grey[1], hiz_grey[2], hiz_grey[3]);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ glViewport(0, 0, piglit_width, piglit_height);
+ piglit_ortho_projection(piglit_width, piglit_height, false);
+
+ glColor4fv(hiz_green);
+ glDepthRange(hiz_green_z, hiz_green_z);
+ piglit_draw_rect(0 * width_3, 0 * width_3, /* x, y */
+ 2 * width_3, 2 * height_3); /* width, height */
+
+ glColor4fv(hiz_blue);
+ glDepthRange(hiz_blue_z, hiz_blue_z);
+ piglit_draw_rect(1 * width_3, 1 * height_3, /* x, y */
+ 2 * width_3, 2 * height_3); /* width, height */
+
+ glClearDepth(1.0);
+ glDepthRange(0, 1);
+
+ return hiz_probe_rects();
+}
+
bool
hiz_run_test_depth_test_fbo(const struct hiz_fbo_options *fbo_options)
{
@@ -252,8 +268,7 @@ hiz_run_test_depth_test_fbo(const struct hiz_fbo_options *fbo_options)
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
- hiz_draw_rects();
- pass = hiz_probe_rects();
+ pass = hiz_run_test_depth_test_common();
if (!piglit_automatic) {
/* Blit the FBO to the window FB so we can see the results. */
@@ -272,10 +287,10 @@ hiz_run_test_depth_test_fbo(const struct hiz_fbo_options *fbo_options)
bool
hiz_run_test_depth_test_window() {
- bool pass = true;
- hiz_draw_rects();
- pass = hiz_probe_rects();
+ bool pass = hiz_run_test_depth_test_common();
if (!piglit_automatic)
glutSwapBuffers();
return pass;
}
+
+/** \} */
diff --git a/tests/hiz/hiz-util.h b/tests/hiz/hiz-util.h
index 271df9669..bd599770b 100644
--- a/tests/hiz/hiz-util.h
+++ b/tests/hiz/hiz-util.h
@@ -50,29 +50,6 @@ static const GLfloat hiz_blue_z = 0.50;
static const GLfloat hiz_clear_z = 0.875;
/**
- * \brief Draw two overlapping rectangles.
- *
- * Draw a green rectangle, then a blue one behind it.
- * This draw function should be sufficient for all HiZ tests.
- *
- * Let (w, h) be the window's dimensions. Then the scene is as follows:
- * - glClearDepth: hiz_clear_z
- * - glClearColor: hiz_grey
- * - glDepthFunc: GL_LESS
- * - rectangle 1
- * - color: hiz_green
- * - x range: [0, 2/3 * w]
- * - y range: [0, 2/3 * h]
- * - z: hiz_green_z
- * - rectangle 2
- * - color: hiz_blue
- * - x range: [1/3 * w, w]
- * - y range: [1/3 * h, h]
- * - z: hiz_blue_z
- */
-void hiz_draw_rects();
-
-/**
* \brief Probe the scene drawn by hiz_draw_rects().
* \return True if all probes passed.
*/