diff options
author | Pauli Nieminen <pauli.nieminen@linux.intel.com> | 2012-05-29 03:43:22 +0300 |
---|---|---|
committer | Pauli Nieminen <pauli.nieminen@linux.intel.com> | 2012-05-31 18:42:31 +0300 |
commit | f7701081e7008106ad8e784033002e2594ff617a (patch) | |
tree | 8d2876a67a954b915f538453d037d6c19a05e512 | |
parent | 227859cc17a7cec08f0529832b74d74290bfdd90 (diff) |
util: Add mix all util variants together
To allow single tests use more than one flavor GL and GLES utils needs to
be mixed together. There is still some ifdef magic that needs to be
changed runtime configured before piglit can use single util library for
all tests.
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
-rw-r--r-- | tests/util/CMakeLists.gl.txt | 11 | ||||
-rw-r--r-- | tests/util/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tests/util/piglit-dispatch.c | 6 | ||||
-rw-r--r-- | tests/util/piglit-util-gles.c | 23 | ||||
-rw-r--r-- | tests/util/piglit-util-gles1.c | 27 |
5 files changed, 56 insertions, 14 deletions
diff --git a/tests/util/CMakeLists.gl.txt b/tests/util/CMakeLists.gl.txt index 52ed8ebe..83781868 100644 --- a/tests/util/CMakeLists.gl.txt +++ b/tests/util/CMakeLists.gl.txt @@ -23,6 +23,15 @@ IF(BUILD_GLX_TESTS) ${GLPROTO_INCLUDE_DIRS} ) + set(EGL_UTILS "") + if(OPENGL_egl_LIBRARY) + set(EGL_UTILS + piglit-util-egl.c + piglit-util-gles.c + piglit-util-gles1.c + ) + endif(OPENGL_egl_LIBRARY) + add_definitions ( -DUSE_GLX ) piglit_add_library (piglitglxutil piglit-shader.c @@ -35,7 +44,7 @@ IF(BUILD_GLX_TESTS) piglit-glx-util.c piglit-dispatch.c piglit-dispatch-init.c - piglit-util-egl.c + ${EGL_UTILS} ) set (UTIL_SOURCES ${UTIL_SOURCES} diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt index b88ae1f7..bd9611bf 100644 --- a/tests/util/CMakeLists.txt +++ b/tests/util/CMakeLists.txt @@ -27,12 +27,15 @@ set(UTIL_SOURCES rgb9e5.c piglit-dispatch.c piglit-dispatch-init.c + piglit-util-gl.c ) if(OPENGL_egl_LIBRARY) set(UTIL_SOURCES ${UTIL_SOURCES} piglit-util-egl.c + piglit-util-gles.c + piglit-util-gles1.c ) link_libraries(${OPENGL_egl_LIBRARY}) add_definitions ( -DUSE_EGL ) diff --git a/tests/util/piglit-dispatch.c b/tests/util/piglit-dispatch.c index 28c3233f..c183b399 100644 --- a/tests/util/piglit-dispatch.c +++ b/tests/util/piglit-dispatch.c @@ -331,14 +331,10 @@ static void piglit_dispatch_util_detect(void) const struct piglit_dispatch_util *cur; if (!util_head) { /* Register util dispatch vtbls */ -#if defined(USE_OPENGL) piglit_gl_register_dispatch(); -#elif defined(USE_OPENGL_ES1) +#ifdef HAVE_EGL_EGL_H piglit_gles1_register_dispatch(); -#elif defined(USE_OPENGL_ES2) piglit_gles2_register_dispatch(); -#else -#error no opengl flavor selected #endif } diff --git a/tests/util/piglit-util-gles.c b/tests/util/piglit-util-gles.c index e32da23a..982dae31 100644 --- a/tests/util/piglit-util-gles.c +++ b/tests/util/piglit-util-gles.c @@ -21,6 +21,13 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* Build gles2 for piglitutil by default while gles1 is wrapped to separate C + * file. + */ +#if !defined(OPENGL_ES1) +#define OPENGL_ES2 +#endif + #if defined(_WIN32) #include <windows.h> #endif @@ -199,7 +206,7 @@ piglit_gles_probe_rect_rgb(int x, int y, int w, int h, const float *expected) static void draw_arrays(const GLvoid *verts, const GLvoid *tex) { -#if defined(USE_OPENGL_ES1) +#if defined(OPENGL_ES1) if (verts) { glVertexPointer(4, GL_FLOAT, 0, verts); glEnableClientState(GL_VERTEX_ARRAY); @@ -216,7 +223,7 @@ draw_arrays(const GLvoid *verts, const GLvoid *tex) glDisableClientState(GL_VERTEX_ARRAY); if (tex) glDisableClientState(GL_TEXTURE_COORD_ARRAY); -#elif defined(USE_OPENGL_ES2) +#elif defined(OPENGL_ES2) if (verts) { glVertexAttribPointer(PIGLIT_ATTRIB_POS, 4, GL_FLOAT, GL_FALSE, 0, verts); glEnableVertexAttribArray(PIGLIT_ATTRIB_POS); @@ -540,7 +547,7 @@ piglit_gles_gen_ortho_projection(double left, double right, double bottom, double top, double near_val, double far_val, GLboolean push) { -#if defined(USE_OPENGL_ES1) +#if defined(OPENGL_ES1) glMatrixMode(GL_PROJECTION); glLoadIdentity(); if (push) @@ -553,7 +560,7 @@ piglit_gles_gen_ortho_projection(double left, double right, double bottom, glLoadIdentity(); #else piglit_report_result(PIGLIT_SKIP); -#endif /* USE_OPENGL_ES1 */ +#endif /* OPENGL_ES1 */ } @@ -563,14 +570,14 @@ piglit_gles_gen_ortho_projection(double left, double right, double bottom, static void piglit_gles_ortho_projection(int w, int h, GLboolean push) { -#if defined(USE_OPENGL_ES1) +#if defined(OPENGL_ES1) /* Set up projection matrix so we can just draw using window * coordinates. */ piglit_gen_ortho_projection(0, w, 0, h, -1, 1, push); #else piglit_report_result(PIGLIT_SKIP); -#endif /* USE_OPENGL_ES1 */ +#endif /* OPENGL_ES1 */ } @@ -579,7 +586,7 @@ static int piglit_gles_util_detect(void) if (!piglit_is_gles()) return false; -#if defined(USE_OPENGL_ES1) +#if defined(OPENGL_ES1) return piglit_get_gl_version() < 20; #else return piglit_get_gl_version() >= 20; @@ -606,7 +613,7 @@ static struct piglit_dispatch_util piglit_gles_dispatch = { }; void -#ifdef USE_OPENGL_ES1 +#ifdef OPENGL_ES1 piglit_gles1_register_dispatch(void) #else piglit_gles2_register_dispatch(void) diff --git a/tests/util/piglit-util-gles1.c b/tests/util/piglit-util-gles1.c new file mode 100644 index 00000000..c42d4fa3 --- /dev/null +++ b/tests/util/piglit-util-gles1.c @@ -0,0 +1,27 @@ +/* + * Copyright © 2012 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + */ + +#define OPENGL_ES1 + +#include "piglit-util-gles.c" |