Commit 5df1d947 authored by Chad Versace's avatar Chad Versace

util: Add function piglit_is_extension_supported()

And replace all occurences of glutExtensionSupported() in piglit-util.c.

Note: This belongs to a series that adds GLES2 support to Piglit.
Signed-off-by: default avatarChad Versace <chad.versace@intel.com>
parent 60b21426
......@@ -71,6 +71,24 @@ void piglit_get_gl_version(bool *es, float* version)
*version = strtof(buffer, NULL);
}
bool piglit_is_extension_supported(const char *name)
{
char *extensions;
bool found = false;
char *i;
assert(name != NULL);
extensions = strdup((const char*) glGetString(GL_EXTENSIONS));
for (i = strtok(extensions, " "); i != NULL; i = strtok(NULL, " ")) {
if (strcmp(name, i) == 0) {
found = true;
break;
}
}
free(extensions);
return found;
}
/* These texture coordinates should have 1 or -1 in the major axis selecting
* the face, and a nearly-1-or-negative-1 value in the other two coordinates
* which will be used to produce the s,t values used to sample that face's
......
......@@ -40,7 +40,7 @@ GLint piglit_ARBfp_pass_through = 0;
void piglit_require_extension(const char *name)
{
if (!glutExtensionSupported(name)) {
if (!piglit_is_extension_supported(name)) {
printf("Test requires %s\n", name);
piglit_report_result(PIGLIT_SKIP);
exit(1);
......@@ -49,7 +49,7 @@ void piglit_require_extension(const char *name)
void piglit_require_not_extension(const char *name)
{
if (glutExtensionSupported(name)) {
if (piglit_is_extension_supported(name)) {
piglit_report_result(PIGLIT_SKIP);
exit(1);
}
......
......@@ -85,6 +85,11 @@ extern const unsigned int fdo_bitmap_height;
*/
void piglit_get_gl_version(bool *es, float* version);
/**
* \precondition name is not null
*/
bool piglit_is_extension_supported(const char *name);
int FindLine(const char *program, int position);
void piglit_report_result(enum piglit_result result);
void piglit_require_extension(const char *name);
......
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