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

Paul Berry stereotype441 at gmail.com
Sat Mar 3 09:32:27 PST 2012


On 3 March 2012 01:01, Kenneth Graunke <kenneth at whitecape.org> wrote:

> 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).


Oh, you're right.  That makes much more sense.

In the interest of minimizing code churn, I'd rather not rip out Glean's
"roll-your-own" stuff until piglit-dispatch has proven its worth.  So for
the moment I think I'll just modify glutils.cpp's getProcAddress() function
to call piglit_get_proc_address(), and in turn I'll modify
piglit_get_proc_address() to fetch the function pointer from
piglit-dispatch.

I'll post follow-up patches that do this.


>
>
>  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;
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20120303/5185f39f/attachment-0001.htm>


More information about the Piglit mailing list