[Piglit] [PATCH 14/15] Switch to using piglit-dispatch instead of GLEW.
Paul Berry
stereotype441 at gmail.com
Fri Mar 2 15:40:32 PST 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).
---
src/piglit/gl_wrap.h | 4 ++--
tests/glean/glwrap.h | 2 +-
tests/glean/tbase.h | 2 +-
tests/shaders/glsl-fs-pointcoord.c | 7 -------
tests/spec/arb_instanced_arrays/instanced_arrays.c | 4 ----
tests/util/CMakeLists.gl.txt | 13 ++++---------
tests/util/glxew.h | 1 -
tests/util/piglit-dispatch.h | 7 +++++++
8 files changed, 15 insertions(+), 25 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/spec/arb_instanced_arrays/instanced_arrays.c b/tests/spec/arb_instanced_arrays/instanced_arrays.c
index 2fd0c22..ce8318f 100644
--- a/tests/spec/arb_instanced_arrays/instanced_arrays.c
+++ b/tests/spec/arb_instanced_arrays/instanced_arrays.c
@@ -162,10 +162,6 @@ piglit_init(int argc, char **argv)
piglit_require_GLSL();
piglit_require_extension("GL_ARB_instanced_arrays");
- /* Workaround a GLEW bug: */
- glDrawArraysInstancedARB = (PFNGLDRAWARRAYSINSTANCEDARBPROC)piglit_get_proc_address("glDrawArraysInstancedARB");
- glDrawElementsInstancedARB = (PFNGLDRAWELEMENTSINSTANCEDARBPROC)piglit_get_proc_address("glDrawElementsInstancedARB");
-
VertShader = piglit_compile_shader_text(GL_VERTEX_SHADER, VertShaderText);
assert(VertShader);
diff --git a/tests/util/CMakeLists.gl.txt b/tests/util/CMakeLists.gl.txt
index 13daa80..523bd80 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
@@ -15,13 +16,6 @@ set(UTIL_SOURCES
sized-internalformats.c
)
-# glew.c is copied verbatim from upstream and has C99 on MacOSX so silent the warnings
-if (C_COMPILER_FLAG_WDECL_AFTER_STMT)
- set_property (SOURCE glew.c
- PROPERTY COMPILE_FLAGS -Wno-declaration-after-statement
- )
-endif ()
-
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions ( -DUSE_GLX )
add_library (piglitglxutil
@@ -33,7 +27,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 28eac98..2e2fb75 100644
--- a/tests/util/piglit-dispatch.h
+++ b/tests/util/piglit-dispatch.h
@@ -94,6 +94,13 @@ void piglit_dispatch_init(piglit_dispatch_api api,
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.
*/
--
1.7.7.6
More information about the Piglit
mailing list