summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2014-10-03 15:52:25 -0600
committerBrian Paul <brianp@vmware.com>2014-11-01 08:59:27 -0600
commit88aa72ef863e9c757af11c788d38e8500e4e873f (patch)
treeedb0414fc4c440e6dd150783d6d176dca0dec78d
parentd014902154033339f0bea1a159cb1375ba6bd04d (diff)
downloadmesa-demos-88aa72ef863e9c757af11c788d38e8500e4e873f.zip
mesa-demos-88aa72ef863e9c757af11c788d38e8500e4e873f.tar.xz
glxinfo/wglinfo: reverse order of the gl_versions[] array
By going from newest to oldest we can simplify the glxinfo/wglinfo loops over the possible GL versions. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r--src/wgl/wglinfo.c2
-rw-r--r--src/xdemos/glinfo_common.h40
-rw-r--r--src/xdemos/glxinfo.c2
3 files changed, 23 insertions, 21 deletions
diff --git a/src/wgl/wglinfo.c b/src/wgl/wglinfo.c
index f628768..30b1307 100644
--- a/src/wgl/wglinfo.c
+++ b/src/wgl/wglinfo.c
@@ -189,7 +189,7 @@ print_screen_info(HDC _hdc, GLboolean limits, GLboolean singleLine,
return;
}
- for (i = NUM_GL_VERSIONS - 2; i > 0 ; i--) {
+ for (i = 0; gl_versions[i].major > 0; i++) {
int attribs[10], n;
/* don't bother below GL 3.1 */
diff --git a/src/xdemos/glinfo_common.h b/src/xdemos/glinfo_common.h
index b050d5a..0830c7f 100644
--- a/src/xdemos/glinfo_common.h
+++ b/src/xdemos/glinfo_common.h
@@ -85,29 +85,31 @@ struct options
/** list of known OpenGL versions */
static const struct { int major, minor; } gl_versions[] = {
- {1, 0},
- {1, 1},
- {1, 2},
- {1, 3},
- {1, 4},
- {1, 5},
- {2, 0},
- {2, 1},
- {3, 0},
- {3, 1},
- {3, 2},
- {3, 3},
- {4, 0},
- {4, 1},
- {4, 2},
- {4, 3},
- {4, 4},
{4, 5},
+ {4, 4},
+ {4, 3},
+ {4, 2},
+ {4, 1},
+ {4, 0},
+
+ {3, 3},
+ {3, 2},
+ {3, 1},
+ {3, 0},
+
+ {2, 1},
+ {2, 0},
+
+ {1, 5},
+ {1, 4},
+ {1, 3},
+ {1, 2},
+ {1, 1},
+ {1, 0},
+
{0, 0} /* end of list */
};
-#define NUM_GL_VERSIONS ELEMENTS(gl_versions)
-
void
print_extension_list(const char *ext, GLboolean singleLine);
diff --git a/src/xdemos/glxinfo.c b/src/xdemos/glxinfo.c
index 2d187f6..779aaa7 100644
--- a/src/xdemos/glxinfo.c
+++ b/src/xdemos/glxinfo.c
@@ -268,7 +268,7 @@ create_context_with_config(Display *dpy, GLXFBConfig config,
* GL that we're aware of. If we don't specify the version
*/
int i;
- for (i = NUM_GL_VERSIONS - 2; i > 0 ; i--) {
+ for (i = 0; gl_versions[i].major > 0; i++) {
/* don't bother below GL 3.0 */
if (gl_versions[i].major == 3 &&
gl_versions[i].minor == 0)