Commit ff77995e authored by Jordan Justen's avatar Jordan Justen

Move extensions checking entirely to piglit-util-gl-common.c

Signed-off-by: Jordan Justen's avatarJordan Justen <jordan.l.justen@intel.com>
Reviewed-by: default avatarChad Versace <chad.versace@linux.intel.com>
parent 2495e56e
......@@ -62,15 +62,6 @@ static piglit_error_function_ptr get_proc_address_failure = NULL;
*/
static int gl_version = 0;
/**
* The GL extension string returned by glGetString(GL_EXTENSIONS).
*
* We cache this here because calling glGetString is prohibited
* between glBegin and glEnd, and to avoid the inefficiency of
* redundant glGetString queries.
*/
static const char *gl_extensions = NULL;
/**
* True if piglit_dispatch_init has been called.
*/
......@@ -134,7 +125,7 @@ check_version(int required_version)
static inline bool
check_extension(const char *name)
{
return piglit_is_extension_in_string(gl_extensions, name);
return piglit_is_extension_supported(name);
}
#include "generated_dispatch.c"
......@@ -195,7 +186,6 @@ piglit_dispatch_init(piglit_dispatch_api api,
* check_extension().
*/
gl_version = piglit_get_gl_version();
gl_extensions = (const char *) glGetString(GL_EXTENSIONS);
}
/**
......
......@@ -25,6 +25,15 @@
#include <ctype.h>
/**
* The GL extension string returned by glGetString(GL_EXTENSIONS).
*
* We cache this here because calling glGetString is prohibited
* between glBegin and glEnd, and to avoid the inefficiency of
* redundant glGetString queries.
*/
static const char *gl_extensions = NULL;
bool piglit_is_gles()
{
const char *version_string = (const char *) glGetString(GL_VERSION);
......@@ -55,10 +64,11 @@ int piglit_get_gl_version()
bool piglit_is_extension_supported(const char *name)
{
const char *const extensions =
(const char*) glGetString(GL_EXTENSIONS);
if (gl_extensions == NULL) {
gl_extensions = (const char *) glGetString(GL_EXTENSIONS);
}
return piglit_is_extension_in_string(extensions, name);
return piglit_is_extension_in_string(gl_extensions, name);
}
void piglit_require_gl_version(int required_version_times_10)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment