[Piglit] [PATCH 05/23] tests, util: Wrap glutSwapBuffers with piglit_swap_buffers
Chad Versace
chad.versace at linux.intel.com
Fri Sep 28 10:44:51 PDT 2012
I'm trying to transition Piglit from using GLUT to using Waffle. This
requires killing all uses of GLUT functions, one-by-one.
Two remaining tests called glutSwapBuffers directly, read-front and
texline, for which piglit_preset_results is unsuitable. These tests call
glReadPixels on the front buffer. This patch replaces those calls with
a new wrapper, piglit_swap_buffers.
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
tests/general/read-front.c | 2 +-
tests/mesa/tests/texline.c | 2 +-
tests/util/piglit-framework-fbo.c | 10 ++++++++++
tests/util/piglit-framework-fbo.h | 3 +++
tests/util/piglit-framework-glut.c | 6 ++++++
tests/util/piglit-framework-glut.h | 4 ++++
tests/util/piglit-framework.c | 9 +++++++++
tests/util/piglit-framework.h | 1 +
8 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/tests/general/read-front.c b/tests/general/read-front.c
index 2e999ba..83e7da0 100644
--- a/tests/general/read-front.c
+++ b/tests/general/read-front.c
@@ -58,7 +58,7 @@ piglit_display(void)
glReadBuffer(GL_FRONT);
- glutSwapBuffers();
+ piglit_swap_buffers();
pass &= piglit_probe_rect_rgb(0, 0,
piglit_width, piglit_height / 2, blue);
diff --git a/tests/mesa/tests/texline.c b/tests/mesa/tests/texline.c
index 726c51f..3389d72 100644
--- a/tests/mesa/tests/texline.c
+++ b/tests/mesa/tests/texline.c
@@ -114,7 +114,7 @@ static void DoFrame(void)
glPopMatrix();
}
- glutSwapBuffers();
+ piglit_swap_buffers();
}
static void Screenshot(void)
diff --git a/tests/util/piglit-framework-fbo.c b/tests/util/piglit-framework-fbo.c
index 6fda821..8610724 100644
--- a/tests/util/piglit-framework-fbo.c
+++ b/tests/util/piglit-framework-fbo.c
@@ -337,3 +337,13 @@ piglit_framework_fbo_run(const struct piglit_gl_test_info *info)
piglit_framework_fbo_destroy();
piglit_report_result(result);
}
+
+void
+piglit_framework_fbo_swap_buffers(void)
+{
+#if defined(PIGLIT_FRAMEWORK_FBO_USE_GLX)
+ glXSwapBuffers(piglit_glx_dpy, piglit_glx_window);
+#elif defined(PIGLIT_FRAMEWORK_FBO_USE_WAFFLE)
+ waffle_window_swap_buffers(piglit_waffle_window);
+#endif
+}
diff --git a/tests/util/piglit-framework-fbo.h b/tests/util/piglit-framework-fbo.h
index f9da2ae..08f13e2 100644
--- a/tests/util/piglit-framework-fbo.h
+++ b/tests/util/piglit-framework-fbo.h
@@ -30,3 +30,6 @@ piglit_framework_fbo_init(const struct piglit_gl_test_info *info);
void
piglit_framework_fbo_run(const struct piglit_gl_test_info *info);
+
+void
+piglit_framework_fbo_swap_buffers(void);
diff --git a/tests/util/piglit-framework-glut.c b/tests/util/piglit-framework-glut.c
index 9f203ef..ea26404 100644
--- a/tests/util/piglit-framework-glut.c
+++ b/tests/util/piglit-framework-glut.c
@@ -147,3 +147,9 @@ piglit_framework_glut_run(const struct piglit_gl_test_info *info)
glutMainLoop();
piglit_report_result(result);
}
+
+void
+piglit_framework_glut_swap_buffers(void)
+{
+ glutSwapBuffers();
+}
diff --git a/tests/util/piglit-framework-glut.h b/tests/util/piglit-framework-glut.h
index c94ef51..816d10e 100644
--- a/tests/util/piglit-framework-glut.h
+++ b/tests/util/piglit-framework-glut.h
@@ -31,3 +31,7 @@ piglit_framework_glut_init(int argc, char *argv[],
void
piglit_framework_glut_run(const struct piglit_gl_test_info *info);
+
+
+void
+piglit_framework_glut_swap_buffers(void);
diff --git a/tests/util/piglit-framework.c b/tests/util/piglit-framework.c
index ac951ae..e8999f4 100644
--- a/tests/util/piglit-framework.c
+++ b/tests/util/piglit-framework.c
@@ -154,3 +154,12 @@ piglit_set_keyboard_func(void (*func)(unsigned char key, int x, int y))
if (!piglit_automatic && !piglit_use_fbo)
glutKeyboardFunc(func);
}
+
+void
+piglit_swap_buffers(void)
+{
+ if (piglit_use_fbo)
+ piglit_framework_fbo_swap_buffers();
+ else
+ piglit_framework_glut_swap_buffers();
+}
diff --git a/tests/util/piglit-framework.h b/tests/util/piglit-framework.h
index 68af5ee..325d00d 100644
--- a/tests/util/piglit-framework.h
+++ b/tests/util/piglit-framework.h
@@ -128,6 +128,7 @@ extern int piglit_height;
extern bool piglit_use_fbo;
extern unsigned int piglit_winsys_fbo;
+void piglit_swap_buffers(void);
extern void piglit_present_results();
void piglit_post_redisplay(void);
void piglit_set_keyboard_func(void (*func)(unsigned char key, int x, int y));
--
1.7.12.1
More information about the Piglit
mailing list