[Piglit] [PATCH v3 16/19] piglit-dispatch: Switch to using piglit-dispatch instead of GLEW.

Paul Berry stereotype441 at gmail.com
Wed Mar 21 08:58:15 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 the nVidia
  binary blob for Linux.

- One regression on Mac OSX: after this patch,
  shaders/gpu_shader4_attribs incorrectly skips.  This happens because
  the functions tested by shaders/gpu_shader4_attribs are defined in
  both EXT_gpu_shader4 and NV_vertex_program4 extensions.
  Piglit-dispatch is not yet capable of understanding that a function
  might be defined with the same name in multiple extension specs
  (because it is based on the gl.spec file from www.opengl.org, which
  fails to encode this information).  I plan to address this in a
  future patch.

- Spot checked on Microsoft Windows.

v2: Remove redundant includes of GL headers.
---
 src/piglit/gl_wrap.h               |   12 +-----------
 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, 15 insertions(+), 28 deletions(-)

diff --git a/src/piglit/gl_wrap.h b/src/piglit/gl_wrap.h
index 8fddd2f..3ccc365 100644
--- a/src/piglit/gl_wrap.h
+++ b/src/piglit/gl_wrap.h
@@ -43,17 +43,7 @@ extern "C" {
 #endif
 
 #if defined(USE_OPENGL)
-#	include "glew.h"
-	/* Include the real headers too, in case GLEW misses something. */
-#	ifdef __APPLE__
-#		include <OpenGL/gl.h>
-#		include <OpenGL/glu.h>
-#		include <OpenGL/glext.h>
-#	else
-#		include <GL/gl.h>
-#		include <GL/glu.h>
-#		include <GL/glext.h>
-#	endif
+#	include "piglit-dispatch.h"
 
 #elif defined(USE_OPENGL_ES1)
 #	include <GLES/gl.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 be3f46e..2c13a73 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 1eea0e3..08e4dae 100644
--- a/tests/util/piglit-dispatch.h
+++ b/tests/util/piglit-dispatch.h
@@ -146,6 +146,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 dd293bb..775dfe2 100755
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -104,11 +104,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