[Piglit] [PATCH 1/3] Move extensions checking entirely to piglit-util-gl-common.c
Jordan Justen
jordan.l.justen at intel.com
Sat Sep 1 10:15:36 PDT 2012
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
tests/util/piglit-dispatch.c | 12 +-----------
tests/util/piglit-util-gl-common.c | 16 +++++++++++++---
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/tests/util/piglit-dispatch.c b/tests/util/piglit-dispatch.c
index 33f93f5..4b7f4fa 100644
--- a/tests/util/piglit-dispatch.c
+++ b/tests/util/piglit-dispatch.c
@@ -63,15 +63,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.
*/
static bool is_initialized = false;
@@ -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);
}
/**
diff --git a/tests/util/piglit-util-gl-common.c b/tests/util/piglit-util-gl-common.c
index 1bf3b93..b319197 100644
--- a/tests/util/piglit-util-gl-common.c
+++ b/tests/util/piglit-util-gl-common.c
@@ -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)
--
1.7.9.5
More information about the Piglit
mailing list