[Piglit] [PATCH v2 10/13] piglit-dispatch: Switch to using piglit-dispatch instead of GLEW.

Paul Berry stereotype441 at gmail.com
Mon Mar 12 14:41:44 PDT 2012


Previous patches set up the piglit-dispatch infrastructure but did not
use it.  This patch enables piglit-dispatch and uses it instead of
GLEW.

No piglit regressions on Intel SandyBridge (Linux) or Mac OSX.
---
 src/piglit/gl_wrap.h               |    4 ++--
 tests/glean/glwrap.h               |    2 +-
 tests/glean/tbase.h                |    2 +-
 tests/shaders/glsl-fs-pointcoord.c |    7 -------
 tests/util/CMakeLists.gl.txt       |    6 ++++--
 tests/util/glxew.h                 |    1 -
 tests/util/piglit-dispatch.h       |    7 +++++++
 tests/util/piglit-util.h           |    6 +-----
 8 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/piglit/gl_wrap.h b/src/piglit/gl_wrap.h
index 8fddd2f..bce8043 100644
--- a/src/piglit/gl_wrap.h
+++ b/src/piglit/gl_wrap.h
@@ -43,8 +43,8 @@ extern "C" {
 #endif
 
 #if defined(USE_OPENGL)
-#	include "glew.h"
-	/* Include the real headers too, in case GLEW misses something. */
+#	include "piglit-dispatch.h"
+	/* Include the real headers too, in case piglit-dispatch misses something. */
 #	ifdef __APPLE__
 #		include <OpenGL/gl.h>
 #		include <OpenGL/glu.h>
diff --git a/tests/glean/glwrap.h b/tests/glean/glwrap.h
index 465acf1..d3404b4 100644
--- a/tests/glean/glwrap.h
+++ b/tests/glean/glwrap.h
@@ -48,7 +48,7 @@
 #ifndef __glwrap_h__
 #define __glwrap_h__
 
-#include "../util/glew.h"
+#include "../util/piglit-dispatch.h"
 
 #if defined(__WIN__)
 #  include <windows.h>
diff --git a/tests/glean/tbase.h b/tests/glean/tbase.h
index 748ee62..f0ec272 100644
--- a/tests/glean/tbase.h
+++ b/tests/glean/tbase.h
@@ -106,7 +106,7 @@ and tbasic.cpp.
 #ifndef __tbase_h__
 #define __tbase_h__
 
-#include "glew.h"
+#include "piglit-dispatch.h"
 
 #ifdef __UNIX__
 #include <unistd.h>
diff --git a/tests/shaders/glsl-fs-pointcoord.c b/tests/shaders/glsl-fs-pointcoord.c
index 586789f..267c4e7 100644
--- a/tests/shaders/glsl-fs-pointcoord.c
+++ b/tests/shaders/glsl-fs-pointcoord.c
@@ -41,13 +41,6 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <sys/stat.h>
-#define GL_GLEXT_PROTOTYPES
-#include "glew.h"
-#if defined(__APPLE__)
-#include <GLUT/glut.h>
-#else
-#include "GL/glut.h"
-#endif
 
 #include "piglit-util.h"
 
diff --git a/tests/util/CMakeLists.gl.txt b/tests/util/CMakeLists.gl.txt
index b612f41..e6e80ab 100644
--- a/tests/util/CMakeLists.gl.txt
+++ b/tests/util/CMakeLists.gl.txt
@@ -6,7 +6,8 @@ include_directories(
 
 set(UTIL_SOURCES
 	${UTIL_SOURCES}
-	glew.c
+	piglit-dispatch.c
+	piglit-dispatch-init.c
 	piglit-shader.c
 	piglit-shader-gl.c
 	piglit-transform-feedback.c
@@ -39,7 +40,8 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
 		    piglit-util-gl.c
 		    piglit-glx-framework.c
 		    piglit-glx-util.c
-		    glew.c
+		    piglit-dispatch.c
+		    piglit-dispatch-init.c
 	)
 	set (UTIL_SOURCES
 		${UTIL_SOURCES}
diff --git a/tests/util/glxew.h b/tests/util/glxew.h
index 1c80ec9..2e855c1 100644
--- a/tests/util/glxew.h
+++ b/tests/util/glxew.h
@@ -97,7 +97,6 @@
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xmd.h>
-#include "glew.h"  /* NOTE: changed for piglit, was <GL/glew.h> */
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/tests/util/piglit-dispatch.h b/tests/util/piglit-dispatch.h
index 55d9101..1b71d23 100644
--- a/tests/util/piglit-dispatch.h
+++ b/tests/util/piglit-dispatch.h
@@ -135,6 +135,13 @@ piglit_dispatch_resolve_function(const char *name);
 
 void piglit_dispatch_default_init();
 
+/* As a temporary measure, redirect glewInit() to
+ * piglit_dispatch_default_init(), so that we don't have to modify
+ * initialization code in old tests that were written before the
+ * piglit-dispatch mechanism.
+ */
+#define glewInit piglit_dispatch_default_init
+
 /* Prevent gl.h from being included, since it will attempt to define
  * the functions we've already defined.
  */
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index bb17c2f..d74317d 100755
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -101,11 +101,7 @@ int asprintf(char **strp, const char *fmt, ...)
 #  define NAN (INFINITY - INFINITY)
 #endif
 
-#ifdef _WIN32
-#  define piglit_get_proc_address(x) wglGetProcAddress(x)
-#else
-#  define piglit_get_proc_address(x) glutGetProcAddress(x)
-#endif
+#define piglit_get_proc_address(x) piglit_dispatch_resolve_function(x)
 
 enum piglit_result {
 	PIGLIT_PASS,
-- 
1.7.7.6



More information about the Piglit mailing list