[Piglit] [PATCH 2/2] util: Aggregate identical GL/GLES2 versions of some functions
chad at chad-versace.us
chad at chad-versace.us
Wed Apr 27 13:10:48 PDT 2011
From: Chad Versace <chad.versace at intel.com>
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().
Signed-off-by: Chad Versace <chad.versace at intel.com>
---
tests/util/piglit-util-gl.c | 17 ------------
tests/util/piglit-util-gles2.c | 56 ----------------------------------------
tests/util/piglit-util.c | 17 ++++++++++++
3 files changed, 17 insertions(+), 73 deletions(-)
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index be6bacc..1508ed9 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -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.
diff --git a/tests/util/piglit-util-gles2.c b/tests/util/piglit-util-gles2.c
index 2e3af69..ccc14da 100644
--- a/tests/util/piglit-util-gles2.c
+++ b/tests/util/piglit-util-gles2.c
@@ -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.
diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 0f58de1..6227dd3 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -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
--
1.7.4.4
More information about the Piglit
mailing list