[Piglit] [PATCH v3 02/19] glean: use piglit-util and initialize GLEW.

Paul Berry stereotype441 at gmail.com
Wed Mar 21 08:58:01 PDT 2012


Later patches in this series will introduce a new mechanism for
binding Piglit to GL functions, called piglit-dispatch.  This
mechanism will reside in the piglit-util library, and will require
initialization.

To ease the transition, this patch causes Glean to link to
piglit-util, and initializes GLEW using the glewInit() function.  When
GLEW is replaced with piglit-dispatch, the call to glewInit() will
serve to initialize new piglit-dispatch mechanism.

Reviewed-by: Chad Versace <chad.versace at linux.intel.com>
---
 tests/glean/CMakeLists.gl.txt |    2 ++
 tests/glean/tbase.h           |    6 ++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt
index 04081a9..0221a25 100644
--- a/tests/glean/CMakeLists.gl.txt
+++ b/tests/glean/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ include_directories(
 	${GLEXT_INCLUDE_DIR}
 	${OPENGL_INCLUDE_PATH}
 	${TIFF_INCLUDE_DIR}
+	${piglit_SOURCE_DIR}/tests/util
 )
 
 add_executable (glean
@@ -88,6 +89,7 @@ add_executable (glean
 )
 
 target_link_libraries (glean
+	piglitutil
 	${OPENGL_gl_LIBRARY}
 	${OPENGL_glu_LIBRARY}
 	${GLUT_glut_LIBRARY}
diff --git a/tests/glean/tbase.h b/tests/glean/tbase.h
index 16fe251..748ee62 100644
--- a/tests/glean/tbase.h
+++ b/tests/glean/tbase.h
@@ -106,6 +106,8 @@ and tbasic.cpp.
 #ifndef __tbase_h__
 #define __tbase_h__
 
+#include "glew.h"
+
 #ifdef __UNIX__
 #include <unistd.h>
 #endif
@@ -309,6 +311,10 @@ public:
 					// XXX need to throw exception here
 				}
 
+				// Make sure glew is initialized so we can call
+				// GL functions safely.
+				glewInit();
+
 				// Check if test is applicable to this context
 				if (!isApplicable())
 					continue;
-- 
1.7.7.6



More information about the Piglit mailing list