[Piglit] [PATCH 27/29] dispatch: Switch to use dispatch for EGL and GLES
Pauli Nieminen
pauli.nieminen at linux.intel.com
Mon May 21 11:09:02 PDT 2012
Using dispatch for GLES and EGL allows all test drop include and link
dependency to EGL and GLES libraries.
Signed-off-by: Pauli Nieminen <pauli.nieminen at linux.intel.com>
---
cmake/piglit_glapi.cmake | 16 ++++++++-
src/piglit/gl_wrap.h | 20 +-----------
tests/egl/egl-query-surface.c | 2 +-
tests/egl/egl-util.h | 2 -
tests/spec/oes_draw_texture/oes_draw_texture.c | 2 -
tests/util/CMakeLists.gl.txt | 1 +
tests/util/CMakeLists.txt | 2 +
tests/util/piglit-dispatch.h | 42 ++++++++++++++++++++++++
tests/util/piglit-framework.c | 4 +--
tests/util/piglit-util-egl.c | 1 -
tests/util/piglit-util-egl.h | 2 -
11 files changed, 63 insertions(+), 31 deletions(-)
diff --git a/cmake/piglit_glapi.cmake b/cmake/piglit_glapi.cmake
index bdc0390..7137ef3 100644
--- a/cmake/piglit_glapi.cmake
+++ b/cmake/piglit_glapi.cmake
@@ -28,13 +28,27 @@ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/glapi)
set(piglit_glapi_output ${CMAKE_BINARY_DIR}/glapi/glapi.json)
-set(piglit_glapi_inputs
+set(piglit_glapi_inputs)
+
+set(piglit_glapi_inputs_all
${piglit_glapi_src_dir}/parse_glspec.py
${piglit_glapi_src_dir}/gl.tm
${piglit_glapi_src_dir}/gl.spec
${piglit_glapi_src_dir}/enumext.spec
+ ${OPENGL_INCLUDE_DIR}/GLES2/gl2.h
+ ${OPENGL_INCLUDE_DIR}/GLES2/gl2ext.h
+ ${OPENGL_INCLUDE_DIR}/GLES/gl.h
+ ${OPENGL_INCLUDE_DIR}/GLES/glext.h
+ ${OPENGL_INCLUDE_DIR}/EGL/egl.h
+ ${OPENGL_INCLUDE_DIR}/EGL/eglext.h
)
+foreach(f ${piglit_glapi_inputs_all})
+ if(EXISTS ${f})
+ LIST(APPEND piglit_glapi_inputs ${f})
+ endif(EXISTS ${f})
+endforeach(f)
+
add_custom_command(
OUTPUT ${piglit_glapi_output}
DEPENDS ${piglit_glapi_inputs}
diff --git a/src/piglit/gl_wrap.h b/src/piglit/gl_wrap.h
index 3ccc365..fe5b504 100644
--- a/src/piglit/gl_wrap.h
+++ b/src/piglit/gl_wrap.h
@@ -42,25 +42,7 @@ extern "C" {
#include <windows.h>
#endif
-#if defined(USE_OPENGL)
-# include "piglit-dispatch.h"
-
-#elif defined(USE_OPENGL_ES1)
-# include <GLES/gl.h>
-# include <GLES/glext.h>
-
- /* for source level compatibility */
-# define GL_TEXTURE_CUBE_MAP_POSITIVE_X GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES
-# define GL_TEXTURE_CUBE_MAP_POSITIVE_Y GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES
-# define GL_TEXTURE_CUBE_MAP_POSITIVE_Z GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES
-# define GL_TEXTURE_CUBE_MAP_NEGATIVE_X GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES
-# define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES
-# define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES
-
-#elif defined(USE_OPENGL_ES2)
-# include <GLES2/gl2.h>
-# include <GLES2/gl2ext.h>
-#endif
+#include "piglit-dispatch.h"
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/tests/egl/egl-query-surface.c b/tests/egl/egl-query-surface.c
index c61ab5e..431578a 100644
--- a/tests/egl/egl-query-surface.c
+++ b/tests/egl/egl-query-surface.c
@@ -29,7 +29,7 @@
* For usage information, see usage_error().
*/
-#include <EGL/egl.h>
+#include "piglit-util.h"
#include "piglit-util-egl.h"
#include "egl-util.h"
diff --git a/tests/egl/egl-util.h b/tests/egl/egl-util.h
index ef523ab..ebaa9c3 100644
--- a/tests/egl/egl-util.h
+++ b/tests/egl/egl-util.h
@@ -12,8 +12,6 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
#include "piglit-util.h"
diff --git a/tests/spec/oes_draw_texture/oes_draw_texture.c b/tests/spec/oes_draw_texture/oes_draw_texture.c
index 623a40c..76ac382 100644
--- a/tests/spec/oes_draw_texture/oes_draw_texture.c
+++ b/tests/spec/oes_draw_texture/oes_draw_texture.c
@@ -28,8 +28,6 @@
* Test GL_OES_draw_texture.
*/
-#include <EGL/egl.h>
-
#include "piglit-util.h"
#define TEXTURE_SIZE 2
diff --git a/tests/util/CMakeLists.gl.txt b/tests/util/CMakeLists.gl.txt
index 7790e4f..3085b05 100644
--- a/tests/util/CMakeLists.gl.txt
+++ b/tests/util/CMakeLists.gl.txt
@@ -35,6 +35,7 @@ IF(BUILD_GLX_TESTS)
piglit-glx-util.c
piglit-dispatch.c
piglit-dispatch-init.c
+ piglit-util-egl.c
)
set (UTIL_SOURCES
${UTIL_SOURCES}
diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
index 8866c2c..c70b453 100644
--- a/tests/util/CMakeLists.txt
+++ b/tests/util/CMakeLists.txt
@@ -18,6 +18,8 @@ set(UTIL_SOURCES
shader-load.c
piglit-framework.c
rgb9e5.c
+ piglit-dispatch.c
+ piglit-dispatch-init.c
)
if(OPENGL_egl_LIBRARY)
diff --git a/tests/util/piglit-dispatch.h b/tests/util/piglit-dispatch.h
index 6979a14..06516ab 100644
--- a/tests/util/piglit-dispatch.h
+++ b/tests/util/piglit-dispatch.h
@@ -101,6 +101,48 @@ struct _cl_event;
typedef GLintptr GLvdpauSurfaceNV;
typedef unsigned short GLhalfNV;
+/* GLES types */
+typedef int32_t GLfixed;
+typedef void * GLeglImageOES;
+typedef int32_t GLclampx;
+
+/* EGL types */
+typedef unsigned int EGLBoolean;
+typedef unsigned int EGLenum;
+typedef int32_t EGLint;
+typedef void *EGLConfig;
+typedef void *EGLContext;
+typedef void *EGLDisplay;
+typedef void *EGLSurface;
+typedef void *EGLClientBuffer;
+typedef void (*__eglMustCastToProperFunctionPointerType)(void);
+
+/* EGL platforms types that needs to be translated to native types inside
+ * dispatch.
+ */
+typedef uintptr_t EGLNativeDisplayType;
+typedef uintptr_t EGLNativePixmapType;
+typedef uintptr_t EGLNativeWindowType;
+
+/* EGLTimeKHR */
+typedef void* EGLSyncKHR;
+typedef uint64_t EGLTimeKHR;
+
+/* EGL_KHR_image */
+typedef void *EGLImageKHR;
+
+/* EGL_HI_clientpixmap */
+struct EGLClientPixmapHI
+{
+ void* pData;
+ EGLint iWidth;
+ EGLint iHeight;
+ EGLint iStride;
+};
+
+/* EGL_NV_system_time */
+typedef uint64_t EGLuint64NV;
+
typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
diff --git a/tests/util/piglit-framework.c b/tests/util/piglit-framework.c
index 301c353..0ddfa14 100644
--- a/tests/util/piglit-framework.c
+++ b/tests/util/piglit-framework.c
@@ -121,9 +121,7 @@ piglit_framework_glut_init(int argc, char *argv[])
glutReshapeFunc(reshape);
glutKeyboardFunc(piglit_escape_exit_key);
-#ifdef USE_OPENGL
glewInit();
-#endif
}
#ifdef USE_GLX
@@ -177,8 +175,8 @@ piglit_framework_fbo_init()
piglit_framework_fbo_glx_init();
-#ifdef USE_OPENGL
glewInit();
+#ifdef USE_OPENGL
if (piglit_get_gl_version() < 20)
return false;
diff --git a/tests/util/piglit-util-egl.c b/tests/util/piglit-util-egl.c
index 80025b2..5c7235f 100644
--- a/tests/util/piglit-util-egl.c
+++ b/tests/util/piglit-util-egl.c
@@ -23,7 +23,6 @@
#include "piglit-util-egl.h"
-#include <EGL/egl.h>
#include <stdio.h>
#ifdef USE_WAFFLE
diff --git a/tests/util/piglit-util-egl.h b/tests/util/piglit-util-egl.h
index 59f4e27..61d6d28 100644
--- a/tests/util/piglit-util-egl.h
+++ b/tests/util/piglit-util-egl.h
@@ -23,8 +23,6 @@
#pragma once
-#include <EGL/egl.h>
-
#include "piglit-util.h"
#ifdef __cplusplus
--
1.7.5.4
More information about the Piglit
mailing list