[Piglit] [PATCH 08/15] glean: call glewInit()

Kenneth Graunke kenneth at whitecape.org
Sat Mar 3 01:01:18 PST 2012


On 03/02/2012 03:40 PM, Paul Berry wrote:
> Previously glean didn't initialize GLEW, presumably because glean only
> uses GL 1.0 functions, and those functions bypass GLEW.

Not...exactly.  Have you seen glean/tglsl1.cpp?  It tests GL2 
functionality, but appears to manually go grab a ton of function pointers.

Presumably all this "roll-your-own" stuff could get replaced by GLEW 
(likely) or your new code (most definitely).

> But once we
> switch to using piglit-dispatch instead of GLEW, we will need to
> initialize it in order for any GL functions to work.  This patch adds
> a call to glewInit() in the place where a call to
> piglit_dispatch_default_init() will eventually be needed.
> ---
>   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;



More information about the Piglit mailing list