diff options
author | Paul Berry <stereotype441@gmail.com> | 2011-10-18 12:15:07 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2011-10-18 13:22:36 -0600 |
commit | 3e31dc7d602def24821469d37b0b37ff162f1a30 (patch) | |
tree | 35fb9303b2c3e4ad957966c60329e6bbe6eb980e | |
parent | 81087864dd3959feabe463d2cacdd99089976945 (diff) |
Fix too-specific GL version checks
This patch fixes several version checks that are too specific
(e.g. checking that the GL version is 2.x or 3.x when the intent is to
make sure the GL version is >= 2.0).
We now perform the version check using GLUtils::getVersion() function.
Signed-off-by: Brian Paul <brianp@vmware.com>
-rw-r--r-- | src/glean/tapi2.cpp | 3 | ||||
-rw-r--r-- | src/glean/tshaderapi.cpp | 7 | ||||
-rw-r--r-- | src/glean/tstencil2.cpp | 11 | ||||
-rw-r--r-- | src/glean/ttexunits.cpp | 8 | ||||
-rw-r--r-- | src/glean/tvertarraybgra.cpp | 3 |
5 files changed, 9 insertions, 23 deletions
diff --git a/src/glean/tapi2.cpp b/src/glean/tapi2.cpp index f180bc3..9a88f9f 100644 --- a/src/glean/tapi2.cpp +++ b/src/glean/tapi2.cpp @@ -181,8 +181,7 @@ bool API2Test::setup(void) { // check that we have OpenGL 2.0 - const char *version = (const char *) glGetString(GL_VERSION); - if (version[0] != '2' || version[1] != '.') { + if (GLUtils::getVersion() < 2.0) { //env->log << "OpenGL 2.0 not supported\n"; return false; } diff --git a/src/glean/tshaderapi.cpp b/src/glean/tshaderapi.cpp index 1769bfd..9c651ba 100644 --- a/src/glean/tshaderapi.cpp +++ b/src/glean/tshaderapi.cpp @@ -569,15 +569,12 @@ ShaderAPIResult::getresults(istream &s) bool ShaderAPITest::isApplicable() const { - const char *version = (const char *) glGetString(GL_VERSION); - if (strncmp(version, "2.0", 3) == 0 || - strncmp(version, "2.1", 3) == 0 || - strncmp(version, "3.0", 3) == 0) { + if (GLUtils::getVersion() >= 2.0) { return true; } else { env->log << name - << ": skipped. Requires GL 2.0, 2.1 or 3.0.\n"; + << ": skipped. Requires GL >= 2.0.\n"; return false; } } diff --git a/src/glean/tstencil2.cpp b/src/glean/tstencil2.cpp index d0c783a..7db3a06 100644 --- a/src/glean/tstencil2.cpp +++ b/src/glean/tstencil2.cpp @@ -111,20 +111,13 @@ Stencil2Test::have_EXT_stencil_two_side(void) const bool Stencil2Test::have_GL2_stencil_two_side(void) const { - const char *version = (const char *) glGetString(GL_VERSION); - if (strncmp(version, "2.", 2) == 0 || - strncmp(version, "3.0", 3) == 0) { - return true; - } - return false; + return GLUtils::getVersion() >= 2.0; } bool Stencil2Test::have_stencil_wrap(void) const { - const char *version = (const char *) glGetString(GL_VERSION); - if (strncmp(version, "2.", 2) == 0 || - strncmp(version, "3.0", 3) == 0) { + if (GLUtils::getVersion() >= 2.0) { return true; } else if (GLUtils::haveExtension("GL_EXT_stencil_wrap")) { diff --git a/src/glean/ttexunits.cpp b/src/glean/ttexunits.cpp index 309f4be..62dd750 100644 --- a/src/glean/ttexunits.cpp +++ b/src/glean/ttexunits.cpp @@ -69,11 +69,9 @@ TexUnitsTest::reportFailure(const char *msg, GLint unit) const bool TexUnitsTest::setup(void) { - // check that we have OpenGL 2.x or 3.x - const char *verString = (const char *) glGetString(GL_VERSION); - - if (verString[0] != '2' && verString[0] != '3') { - env->log << "OpenGL 2.x or 3.x not supported\n"; + // check that we have at least OpenGL 2.0 + if (GLUtils::getVersion() < 2.0) { + env->log << "OpenGL >= 2.0 not supported\n"; return false; } diff --git a/src/glean/tvertarraybgra.cpp b/src/glean/tvertarraybgra.cpp index fede919..05e03bc 100644 --- a/src/glean/tvertarraybgra.cpp +++ b/src/glean/tvertarraybgra.cpp @@ -70,8 +70,7 @@ VertArrayBGRATest::testAPI(void) // Get glVertexAttrib() function PFNGLVERTEXATTRIBPOINTERARBPROC VertexAttribPointer = NULL; - const char *version = (const char *) glGetString(GL_VERSION); - if (version[0] == '2') { + if (GLUtils::getVersion() >= 2.0) { VertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERARBPROC) GLUtils::getProcAddress("glVertexAttribPointer"); } |