Commit aee9bc28 authored by Chad Versace's avatar Chad Versace

util: Aggregate identical GL/GLES2 versions of some functions

Remove duplicate definitions of piglit_require_extension() from
piglit-util-{gl,gles2}.c and define it just once in piglit-util.c. Do the
same for piglit_require_not_extension().
Reviewed-by: default avatarIan Romanick <ian.d.romanick@intel.com>
Signed-off-by: default avatarChad Versace <chad.versace@intel.com>
parent 5433fd53
......@@ -38,23 +38,6 @@
GLint piglit_ARBfp_pass_through = 0;
void piglit_require_extension(const char *name)
{
if (!piglit_is_extension_supported(name)) {
printf("Test requires %s\n", name);
piglit_report_result(PIGLIT_SKIP);
exit(1);
}
}
void piglit_require_not_extension(const char *name)
{
if (piglit_is_extension_supported(name)) {
piglit_report_result(PIGLIT_SKIP);
exit(1);
}
}
/**
* Read a pixel from the given location and compare its RGBA value to the
* given expected values.
......
......@@ -35,62 +35,6 @@
#include "piglit-util.h"
int
piglit_extension_supported(const char *name)
{
static const GLubyte *extensions = NULL;
const GLubyte *start;
GLubyte *where, *terminator;
/* Extension names should not have spaces. */
where = (GLubyte *) strchr(name, ' ');
if (where || *name == '\0')
return 0;
if (!extensions) {
extensions = glGetString(GL_EXTENSIONS);
}
/* It takes a bit of care to be fool-proof about parsing the
OpenGL extensions string. Don't be fooled by sub-strings,
etc. */
start = extensions;
for (;;) {
/* If your application crashes in the strstr routine below,
you are probably calling glutExtensionSupported without
having a current window. Calling glGetString without
a current OpenGL context has unpredictable results.
Please fix your program. */
where = (GLubyte *) strstr((const char *) start, name);
if (!where)
break;
terminator = where + strlen(name);
if (where == start || *(where - 1) == ' ') {
if (*terminator == ' ' || *terminator == '\0') {
return 1;
}
}
start = terminator;
}
return 0;
}
void piglit_require_extension(const char *name)
{
if (!piglit_extension_supported(name)) {
printf("Test requires %s\n", name);
piglit_report_result(PIGLIT_SKIP);
exit(1);
}
}
void piglit_require_not_extension(const char *name)
{
if (piglit_extension_supported(name)) {
piglit_report_result(PIGLIT_SKIP);
exit(1);
}
}
/**
* Read a pixel from the given location and compare its RGBA value to the
* given expected values.
......
......@@ -133,6 +133,23 @@ bool piglit_is_extension_supported(const char *name)
return found;
}
void piglit_require_extension(const char *name)
{
if (!piglit_is_extension_supported(name)) {
printf("Test requires %s\n", name);
piglit_report_result(PIGLIT_SKIP);
exit(1);
}
}
void piglit_require_not_extension(const char *name)
{
if (piglit_is_extension_supported(name)) {
piglit_report_result(PIGLIT_SKIP);
exit(1);
}
}
/* 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
......
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