summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-09-21 14:40:19 -0600
committerBrian Paul <brianp@vmware.com>2010-09-21 14:40:19 -0600
commitaa1e912f8334942eef32f169859166088e5f5a6b (patch)
tree0aa020a4db09aae618323205ec96070132b91a4b
parent4a01a0f7f95aff97120285c9a45cfd2c76e828de (diff)
tglsl1: better version checking code
-rw-r--r--src/glean/tglsl1.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/glean/tglsl1.cpp b/src/glean/tglsl1.cpp
index b4ec9fc..79844a8 100644
--- a/src/glean/tglsl1.cpp
+++ b/src/glean/tglsl1.cpp
@@ -4389,12 +4389,13 @@ GLSLTest::setup(void)
#else
const char *glslVersion = NULL;
#endif
- if (!glslVersion || glslVersion[0] != '1') {
+ const float version = atof(glslVersion);
+ if (version < 1.00) {
env->log << "GLSL 1.x not supported\n";
return false;
}
- glsl_120 = (glslVersion[2] >= '2');
- glsl_130 = (glslVersion[2] >= '3');
+ glsl_120 = version >= 1.20;
+ glsl_130 = version >= 1.30;
if (!getFunctions()) {
env->log << "Unable to get pointer to an OpenGL 2.0 API function\n";
@@ -4858,16 +4859,13 @@ bool
GLSLTest::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 ||
- strncmp(version, "3.1", 3) == 0 ||
- strncmp(version, "3.2", 3) == 0) {
+ const float v = atof(version);
+ if (v >= 2.0) {
return true;
}
else {
env->log << name
- << ": skipped. Requires GL 2.0, 2.1 or 3.0.\n";
+ << ": skipped. Requires GL 2.0 or later.\n";
return false;
}
}