[Piglit] [PATCH 19/23] cmake, util: Switch GL tests to use new framework
Chad Versace
chad.versace at linux.intel.com
Fri Sep 28 10:45:05 PDT 2012
- 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.
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
cmake/target_api/CMakeLists.txt | 4 +--
cmake/target_api/gl/CMakeLists.txt | 6 ++--
cmake/target_api/gles1/CMakeLists.txt | 1 -
cmake/target_api/gles2/CMakeLists.txt | 1 -
src/CMakeLists.txt | 3 --
src/piglit/glut_wrap.h | 7 +----
tests/util/CMakeLists.txt | 2 --
tests/util/piglit-framework-gl.c | 56 +++++++++++++++--------------------
8 files changed, 29 insertions(+), 51 deletions(-)
diff --git a/cmake/target_api/CMakeLists.txt b/cmake/target_api/CMakeLists.txt
index c5e0b90..8ef89c4 100644
--- a/cmake/target_api/CMakeLists.txt
+++ b/cmake/target_api/CMakeLists.txt
@@ -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)
diff --git a/cmake/target_api/gl/CMakeLists.txt b/cmake/target_api/gl/CMakeLists.txt
index b13229d..0a3c3b7 100644
--- a/cmake/target_api/gl/CMakeLists.txt
+++ b/cmake/target_api/gl/CMakeLists.txt
@@ -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
diff --git a/cmake/target_api/gles1/CMakeLists.txt b/cmake/target_api/gles1/CMakeLists.txt
index b76d51b..882a2f3 100644
--- a/cmake/target_api/gles1/CMakeLists.txt
+++ b/cmake/target_api/gles1/CMakeLists.txt
@@ -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
)
diff --git a/cmake/target_api/gles2/CMakeLists.txt b/cmake/target_api/gles2/CMakeLists.txt
index b8cad20..ef1e327 100644
--- a/cmake/target_api/gles2/CMakeLists.txt
+++ b/cmake/target_api/gles2/CMakeLists.txt
@@ -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
)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2cca584..e69de29 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,3 +0,0 @@
-if(PIGLIT_USE_WAFFLE)
- add_subdirectory(glut_waffle)
-endif(PIGLIT_USE_WAFFLE)
diff --git a/src/piglit/glut_wrap.h b/src/piglit/glut_wrap.h
index 549059d..f4ef911 100644
--- a/src/piglit/glut_wrap.h
+++ b/src/piglit/glut_wrap.h
@@ -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>
diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
index cb32d93..836e437 100644
--- a/tests/util/CMakeLists.txt
+++ b/tests/util/CMakeLists.txt
@@ -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
)
diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c
index bc0d460..441e271 100644
--- a/tests/util/piglit-framework-gl.c
+++ b/tests/util/piglit-framework-gl.c
@@ -21,11 +21,6 @@
* IN THE SOFTWARE.
*/
-/**
- * Simple test case framework.
- *
- * \author Ian Romanick <ian.d.romanick at 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);
}
--
1.7.12.1
More information about the Piglit
mailing list