Reviewed-by: Ian Romanick <ian.d.roman...@intel.com> On 10/31/2014 08:54 AM, Brian Paul wrote: > By going from newest to oldest we can simplify the glxinfo/wglinfo > loops over the possible GL versions. > --- > src/wgl/wglinfo.c | 2 +- > src/xdemos/glinfo_common.h | 40 +++++++++++++++++++++------------------- > src/xdemos/glxinfo.c | 2 +- > 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) >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev