Commit 3168c103 authored by Chad Versace's avatar Chad Versace

tests,util: Wrap glutSwapBuffers with piglit_swap_buffers

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.
Reviewed-and-tested-by: Jordan Justen's avatarJordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
Tested-by: Paul Berry's avatarPaul Berry <stereotype441@gmail.com>
Acked-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarChad Versace <chad.versace@linux.intel.com>
parent cc29216d
......@@ -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);
......
......@@ -324,7 +324,7 @@ piglit_display(void)
i++;
}
glutSwapBuffers();
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
......
......@@ -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
}
......@@ -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);
......@@ -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();
}
......@@ -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);
......@@ -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();
}
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment