Commit 05c8d2e0 authored by Chad Versace's avatar Chad Versace

cmake,util: Switch GL tests to use new framework

- Stop building old framework sources, piglit-framework-{fbo,glut}.c.
- Stop building libglut_waffle.
- Wire up piglit_gl_test_run() to use the new framework.
Reviewed-and-tested-by: Jordan Justen's avatarJordan Justen <jordan.l.justen@intel.com>
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 4072eacd
......@@ -19,8 +19,8 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# The no_api directory must precede the GL directories because it builds
# glut_waffle, which the GL targets depend on.
# The no_api directory must precede the GL directories because it may build
# api-independent libraries on which the api-dependent targets rely.
add_subdirectory(no_api)
add_subdirectory(gl)
......
......@@ -3,9 +3,7 @@ add_definitions(
-DPIGLIT_USE_OPENGL
)
if(PIGLIT_USE_WAFFLE)
link_libraries(glut_waffle)
else(PIGLIT_USE_WAFFLE)
if(NOT PIGLIT_USE_WAFFLE)
add_definitions(-DPIGLIT_USE_GLUT)
include_directories(
${GLUT_INCLUDE_DIR}
......@@ -13,7 +11,7 @@ else(PIGLIT_USE_WAFFLE)
link_libraries(
${GLUT_glut_LIBRARY}
)
endif(PIGLIT_USE_WAFFLE)
endif()
add_subdirectory(${piglit_SOURCE_DIR}/tests
${piglit_BINARY_DIR}/target_api/${piglit_target_api}/tests
......
......@@ -3,7 +3,6 @@ set(piglit_target_api "gles1")
add_definitions(
-DPIGLIT_USE_OPENGL_ES1
)
link_libraries(glut_waffle)
add_subdirectory(${piglit_SOURCE_DIR}/tests
${piglit_BINARY_DIR}/target_api/${piglit_target_api}/tests
)
......@@ -3,7 +3,6 @@ set(piglit_target_api "gles2")
add_definitions(
-DPIGLIT_USE_OPENGL_ES2
)
link_libraries(glut_waffle)
add_subdirectory(${piglit_SOURCE_DIR}/tests
${piglit_BINARY_DIR}/target_api/${piglit_target_api}/tests
)
if(PIGLIT_USE_WAFFLE)
add_subdirectory(glut_waffle)
endif(PIGLIT_USE_WAFFLE)
......@@ -27,9 +27,6 @@
/**
* \file glut_wrap.h
* \brief Convenience header that includes the actual GLUT headers.
*
* The actual GLUT headers are chosen according to the macro definitions
* PIGLIT_USE_GLUT and PIGLIT_USE_WAFFLE.
*/
#pragma once
......@@ -42,9 +39,7 @@ extern "C" {
#include <windows.h>
#endif
#if defined(PIGLIT_USE_WAFFLE)
# include <glut_waffle/glut_waffle.h>
#elif defined(PIGLIT_USE_GLUT)
#if defined(PIGLIT_USE_GLUT)
# ifdef __APPLE__
# include <GLUT/glut.h>
......
......@@ -21,8 +21,6 @@ set(UTIL_GL_SOURCES
piglit-util-gl-enum.c
piglit-framework-gl/piglit_gl_framework.c
piglit-framework-gl.c
piglit-framework-fbo.c
piglit-framework-glut.c
piglit_ktx.c
rgb9e5.c
)
......
......@@ -21,11 +21,6 @@
* IN THE SOFTWARE.
*/
/**
* Simple test case framework.
*
* \author Ian Romanick <ian.d.romanick@intel.com>
*/
#include <assert.h>
#include <string.h>
#include <stdio.h>
......@@ -33,9 +28,9 @@
#include <math.h>
#include "piglit-util-gl-common.h"
#include "piglit-framework-gl.h"
#include "piglit-framework-fbo.h"
#include "piglit-framework-glut.h"
#include "piglit-framework-gl/piglit_gl_framework.h"
static struct piglit_gl_framework *gl_fw;
bool piglit_use_fbo = false;
int piglit_automatic = 0;
......@@ -122,51 +117,48 @@ piglit_gl_test_run(int argc, char *argv[],
piglit_width = config->window_width;
piglit_height = config->window_height;
if (piglit_use_fbo) {
if (!piglit_framework_fbo_init(config))
piglit_use_fbo = false;
}
if (!piglit_use_fbo)
piglit_framework_glut_init(argc, argv, config);
config->init(argc, argv);
if (piglit_use_fbo) {
piglit_framework_fbo_run(config);
} else {
piglit_framework_glut_run(config);
gl_fw = piglit_gl_framework_factory(config);
if (gl_fw == NULL) {
printf("piglit: error: failed to create "
"piglit_gl_framework\n");
piglit_report_result(PIGLIT_FAIL);
}
gl_fw->run_test(gl_fw, argc, argv);
assert(false);
}
void
piglit_post_redisplay(void)
{
if (!piglit_use_fbo && !piglit_automatic)
glutPostRedisplay();
if (gl_fw->post_redisplay)
gl_fw->post_redisplay(gl_fw);
}
void
piglit_set_keyboard_func(void (*func)(unsigned char key, int x, int y))
{
if (!piglit_automatic && !piglit_use_fbo)
glutKeyboardFunc(func);
if (gl_fw->set_keyboard_func)
gl_fw->set_keyboard_func(gl_fw, func);
}
void
piglit_swap_buffers(void)
{
if (piglit_use_fbo)
piglit_framework_fbo_swap_buffers();
else
piglit_framework_glut_swap_buffers();
if (gl_fw->swap_buffers)
gl_fw->swap_buffers(gl_fw);
}
void
piglit_present_results(void)
{
if (!piglit_automatic)
piglit_swap_buffers();
}
void
piglit_set_reshape_func(void (*func)(int w, int h))
{
if (!piglit_use_fbo && !piglit_automatic)
glutReshapeFunc(func);
if (!gl_fw->set_reshape_func)
gl_fw->set_reshape_func(gl_fw, func);
}
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