Commit 42f6be8b authored by Matt Turner's avatar Matt Turner

Handle OpenGL ES-CM 1.x strings in piglit_get_gl_version

Otherwise, piglit would fail to parse the version string and report a
failure if glGetString(GL_VERSION) were called in an ES 1.x context.
parent d3c17725
......@@ -22,6 +22,7 @@
*/
#include "piglit-util-gl-common.h"
#include <ctype.h>
bool piglit_is_gles()
......@@ -33,19 +34,16 @@ bool piglit_is_gles()
int piglit_get_gl_version()
{
const char *version_string = (const char *) glGetString(GL_VERSION);
const char *version_number_string;
int scanf_count;
int major;
int minor;
/* skip to version number */
if (strncmp("OpenGL ES ", version_string, 10) == 0)
version_number_string = version_string + 10;
else
version_number_string = version_string;
while (!isdigit(*version_string) && *version_string != '\0')
version_string++;
/* Interpret version number */
scanf_count = sscanf(version_number_string, "%i.%i", &major, &minor);
scanf_count = sscanf(version_string, "%i.%i", &major, &minor);
if (scanf_count != 2) {
printf("Unable to interpret GL_VERSION string: %s\n",
version_string);
......
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