summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-25 18:35:05 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-25 18:35:05 +0300
commit201fd8962f269dbe1aeacd7185720ec86e2ac5b7 (patch)
tree1d728ec33a064287335ef276a26cc26eabe8ea75 /src
parent84d56b88a03054d35b84dc1ecbd7ad4614f8ac86 (diff)
downloadmv-201fd8962f269dbe1aeacd7185720ec86e2ac5b7.tar.gz
mv-201fd8962f269dbe1aeacd7185720ec86e2ac5b7.tar.bz2
mv-201fd8962f269dbe1aeacd7185720ec86e2ac5b7.tar.xz
mv-201fd8962f269dbe1aeacd7185720ec86e2ac5b7.zip
Add shaders version logging and checking.
Diffstat (limited to 'src')
-rw-r--r--src/graphicsmanager.cpp11
-rw-r--r--src/graphicsmanager.h9
2 files changed, 19 insertions, 1 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 7a7a25709..f60bf1aa4 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -107,8 +107,11 @@ GraphicsManager::GraphicsManager() :
mGlVersionString(),
mGlVendor(),
mGlRenderer(),
+ mGlShaderVersionString(),
mMinor(0),
mMajor(0),
+ mSLMinor(0),
+ mSLMajor(0),
mPlatformMinor(0),
mPlatformMajor(0),
mMaxVertices(500),
@@ -729,6 +732,8 @@ void GraphicsManager::setGLVersion()
sscanf(mGlVersionString.c_str(), "%5d.%5d", &mMajor, &mMinor);
mGlVendor = getGLString(GL_VENDOR);
mGlRenderer = getGLString(GL_RENDERER);
+ mGlShaderVersionString = getGLString(GL_SHADING_LANGUAGE_VERSION);
+ sscanf(mGlShaderVersionString.c_str(), "%5d.%5d", &mSLMajor, &mSLMinor);
}
void GraphicsManager::logVersion() const
@@ -736,6 +741,7 @@ void GraphicsManager::logVersion() const
logger->log("gl vendor: " + mGlVendor);
logger->log("gl renderer: " + mGlRenderer);
logger->log("gl version: " + mGlVersionString);
+ logger->log("glsl version: " + mGlShaderVersionString);
}
bool GraphicsManager::checkGLVersion(const int major, const int minor) const
@@ -743,6 +749,11 @@ bool GraphicsManager::checkGLVersion(const int major, const int minor) const
return mMajor > major || (mMajor == major && mMinor >= minor);
}
+bool GraphicsManager::checkSLVersion(const int major, const int minor) const
+{
+ return mSLMajor > major || (mSLMajor == major && mSLMinor >= minor);
+}
+
bool GraphicsManager::checkPlatformVersion(const int major,
const int minor) const
{
diff --git a/src/graphicsmanager.h b/src/graphicsmanager.h
index c50645942..455632d07 100644
--- a/src/graphicsmanager.h
+++ b/src/graphicsmanager.h
@@ -113,6 +113,9 @@ class GraphicsManager final
bool checkGLVersion(const int major, const int minor)
const A_WARN_UNUSED;
+ bool checkSLVersion(const int major, const int minor)
+ const A_WARN_UNUSED;
+
bool checkPlatformVersion(const int major, const int minor)
const A_WARN_UNUSED;
@@ -181,14 +184,18 @@ class GraphicsManager final
std::string mGlRenderer;
+ std::string mGlShaderVersionString;
#ifdef USE_OPENGL
static GLenum mLastError;
#endif
-
int mMinor;
int mMajor;
+ int mSLMinor;
+
+ int mSLMajor;
+
int mPlatformMinor;
int mPlatformMajor;