summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-08 13:21:45 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-08 13:21:45 +0300
commit3b343e2c62fd8035cd0be24f63aaea3fb203d73e (patch)
tree92bc4b69459278768c57245c4a0a8315c9d57406 /src
parent7760ed560001714494d7a7de470123a4cd565873 (diff)
downloadmv-3b343e2c62fd8035cd0be24f63aaea3fb203d73e.tar.gz
mv-3b343e2c62fd8035cd0be24f63aaea3fb203d73e.tar.bz2
mv-3b343e2c62fd8035cd0be24f63aaea3fb203d73e.tar.xz
mv-3b343e2c62fd8035cd0be24f63aaea3fb203d73e.zip
Store OpenGL renderer and vendor in graphics manager.
Diffstat (limited to 'src')
-rw-r--r--src/graphics.cpp5
-rw-r--r--src/graphicsmanager.cpp34
-rw-r--r--src/graphicsmanager.h8
3 files changed, 28 insertions, 19 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 4580c1015..9f45899f5 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -154,9 +154,8 @@ bool Graphics::setOpenGLMode()
}
#endif
- graphicsManager.logString("gl vendor: %s", GL_VENDOR);
- graphicsManager.logString("gl renderer: %s", GL_RENDERER);
- graphicsManager.logString("gl version: %s", GL_VERSION);
+ graphicsManager.setGLVersion();
+ graphicsManager.logVersion();
// Setup OpenGL
glViewport(0, 0, mWidth, mHeight);
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index dfab1c600..0688540a7 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -104,52 +104,47 @@ bool GraphicsManager::detectGraphics()
SDL_SetVideoMode(100, 100, 0, SDL_ANYFORMAT | SDL_OPENGL);
initOpenGL();
-
- std::string vendor = getGLString(GL_VENDOR);
- std::string renderer = getGLString(GL_RENDERER);
- logger->log("gl vendor: %s", vendor.c_str());
- logger->log("gl renderer: %s", renderer.c_str());
- logger->log("gl version: %s", mVersionString.c_str());
+ logVersion();
int mode = 1;
// detecting features by known renderers or vendors
- if (findI(renderer, "gdi generic") != std::string::npos)
+ if (findI(mGlRenderer, "gdi generic") != std::string::npos)
{
// windows gdi OpenGL emulation
logger->log("detected gdi drawing");
logger->log("disable OpenGL");
mode = 0;
}
- else if (findI(renderer, "Software Rasterizer") != std::string::npos)
+ else if (findI(mGlRenderer, "Software Rasterizer") != std::string::npos)
{
// software OpenGL emulation
logger->log("detected software drawing");
logger->log("disable OpenGL");
mode = 0;
}
- else if (findI(renderer, "Indirect") != std::string::npos)
+ else if (findI(mGlRenderer, "Indirect") != std::string::npos)
{
// indirect OpenGL drawing
logger->log("detected indirect drawing");
logger->log("disable OpenGL");
mode = 0;
}
- else if (findI(vendor, "VMWARE") != std::string::npos)
+ else if (findI(mGlVendor, "VMWARE") != std::string::npos)
{
// vmware emulation
logger->log("detected VMWARE driver");
logger->log("disable OpenGL");
mode = 0;
}
- else if (findI(renderer, "LLVM") != std::string::npos)
+ else if (findI(mGlRenderer, "LLVM") != std::string::npos)
{
// llvm opengl emulation
logger->log("detected llvm driver");
logger->log("disable OpenGL");
mode = 0;
}
- else if (findI(vendor, "NVIDIA") != std::string::npos)
+ else if (findI(mGlVendor, "NVIDIA") != std::string::npos)
{
// hope it can work well
logger->log("detected NVIDIA driver");
@@ -164,7 +159,7 @@ bool GraphicsManager::detectGraphics()
mode = 0;
}
- if (mode > 0 && findI(mVersionString, "Mesa") != std::string::npos)
+ if (mode > 0 && findI(mGlVersionString, "Mesa") != std::string::npos)
{
// Mesa detected
config.setValue("compresstextures", true);
@@ -449,8 +444,17 @@ std::string GraphicsManager::getGLString(int num) const
void GraphicsManager::setGLVersion()
{
- mVersionString = getGLString(GL_VERSION);
- sscanf(mVersionString.c_str(), "%5d.%5d", &mMajor, &mMinor);
+ mGlVersionString = getGLString(GL_VERSION);
+ sscanf(mGlVersionString.c_str(), "%5d.%5d", &mMajor, &mMinor);
+ mGlVendor = getGLString(GL_VENDOR);
+ mGlRenderer = getGLString(GL_RENDERER);
+}
+
+void GraphicsManager::logVersion()
+{
+ logger->log("gl vendor: " + mGlVendor);
+ logger->log("gl renderer: " + mGlRenderer);
+ logger->log("gl version: " + mGlVersionString);
}
void GraphicsManager::setVideoMode()
diff --git a/src/graphicsmanager.h b/src/graphicsmanager.h
index 1a095422e..51c9a9efc 100644
--- a/src/graphicsmanager.h
+++ b/src/graphicsmanager.h
@@ -93,6 +93,8 @@ class GraphicsManager final
bool getUseAtlases() const
{ return mUseAtlases; }
+ void logVersion();
+
#ifdef USE_OPENGL
bool isUseTextureSampler() const
{ return mUseTextureSampler; }
@@ -104,7 +106,11 @@ class GraphicsManager final
std::set<std::string> mPlatformExtensions;
- std::string mVersionString;
+ std::string mGlVersionString;
+
+ std::string mGlVendor;
+
+ std::string mGlRenderer;
int mMinor;