From 201fd8962f269dbe1aeacd7185720ec86e2ac5b7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 25 Jun 2014 18:35:05 +0300 Subject: Add shaders version logging and checking. --- src/graphicsmanager.cpp | 11 +++++++++++ src/graphicsmanager.h | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3-70-g09d2