diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-10-22 01:30:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-10-22 01:30:47 +0300 |
commit | 5bf1ce172ec746b030cc2d9bbd37f95ac402f684 (patch) | |
tree | e17e71df34fb50367da777f67949e3afa26d8ede | |
parent | 6f47614ffebe771a786afee07013a674bea04a8c (diff) | |
download | manaverse-5bf1ce172ec746b030cc2d9bbd37f95ac402f684.tar.gz manaverse-5bf1ce172ec746b030cc2d9bbd37f95ac402f684.tar.bz2 manaverse-5bf1ce172ec746b030cc2d9bbd37f95ac402f684.tar.xz manaverse-5bf1ce172ec746b030cc2d9bbd37f95ac402f684.zip |
dehardcode render values.
-rw-r--r-- | src/client.cpp | 19 | ||||
-rw-r--r-- | src/graphicsmanager.cpp | 18 | ||||
-rw-r--r-- | src/test/testmain.cpp | 10 |
3 files changed, 24 insertions, 23 deletions
diff --git a/src/client.cpp b/src/client.cpp index 946c4481b..01c114aff 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -2076,16 +2076,16 @@ void Client::initConfiguration() const config.setValue("hwaccel", false); #ifdef USE_OPENGL #if (defined __APPLE__) - config.setValue("opengl", 1); + config.setValue("opengl", static_cast<int>(RENDER_NORMAL_OPENGL)); #elif (defined ANDROID) - config.setValue("opengl", 3); + config.setValue("opengl", static_cast<int>(RENDER_GLES_OPENGL)); #elif (defined WIN32) - config.setValue("opengl", 2); + config.setValue("opengl", static_cast<int>(RENDER_SAFE_OPENGL)); #else - config.setValue("opengl", 0); + config.setValue("opengl", static_cast<int>(RENDER_SOFTWARE)); #endif #else - config.setValue("opengl", 0); + config.setValue("opengl", static_cast<int>(RENDER_SOFTWARE)); #endif config.setValue("screen", false); config.setValue("sound", true); @@ -2350,11 +2350,11 @@ void Client::storeSafeParameters() const config.setValue("hwaccel", false); #if defined(ANDROID) - config.setValue("opengl", 2); + config.setValue("opengl", static_cast<int>(RENDER_GLES_OPENGL)); #elif defined(__APPLE__) - config.setValue("opengl", 1); + config.setValue("opengl", static_cast<int>(RENDER_NORMAL_OPENGL)); #else - config.setValue("opengl", 0); + config.setValue("opengl", static_cast<int>(RENDER_SOFTWARE)); #endif config.setValue("altfpslimit", 3); config.setValue("sound", false); @@ -2379,13 +2379,14 @@ void Client::storeSafeParameters() const else { // if video mode not configured reset only video mode to safe - config.setValue("opengl", 0); #ifdef ANDROID config.setValue("screenwidth", 0); config.setValue("screenheight", 0); + config.setValue("opengl", static_cast<int>(RENDER_GLES_OPENGL)); #else config.setValue("screenwidth", 640); config.setValue("screenheight", 480); + config.setValue("opengl", static_cast<int>(RENDER_SOFTWARE)); #endif } diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index a571c496f..d6d8d508f 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -162,7 +162,7 @@ int GraphicsManager::detectGraphics() initOpenGL(); logVersion(); - int mode = 1; + RenderType mode = RENDER_NORMAL_OPENGL; // detecting features by known renderers or vendors if (findI(mGlRenderer, "gdi generic") != std::string::npos) @@ -170,35 +170,35 @@ int GraphicsManager::detectGraphics() // windows gdi OpenGL emulation logger->log("detected gdi drawing"); logger->log("disable OpenGL"); - mode = 0; + mode = RENDER_SOFTWARE; } else if (findI(mGlRenderer, "Software Rasterizer") != std::string::npos) { // software OpenGL emulation logger->log("detected software drawing"); logger->log("disable OpenGL"); - mode = 0; + mode = RENDER_SOFTWARE; } else if (findI(mGlRenderer, "Indirect") != std::string::npos) { // indirect OpenGL drawing logger->log("detected indirect drawing"); logger->log("disable OpenGL"); - mode = 0; + mode = RENDER_SOFTWARE; } else if (findI(mGlVendor, "VMWARE") != std::string::npos) { // vmware emulation logger->log("detected VMWARE driver"); logger->log("disable OpenGL"); - mode = 0; + mode = RENDER_SOFTWARE; } else if (findI(mGlRenderer, "LLVM") != std::string::npos) { // llvm opengl emulation logger->log("detected llvm driver"); logger->log("disable OpenGL"); - mode = 0; + mode = RENDER_SOFTWARE; } else if (findI(mGlVendor, "NVIDIA") != std::string::npos) { @@ -206,7 +206,7 @@ int GraphicsManager::detectGraphics() logger->log("detected NVIDIA driver"); config.setValue("useTextureSampler", true); textureSampler = 1; - mode = 1; + mode = RENDER_NORMAL_OPENGL; } // detecting feature based on OpenGL version @@ -214,7 +214,7 @@ int GraphicsManager::detectGraphics() { // very old OpenGL version logger->log("OpenGL version too old"); - mode = 0; + mode = RENDER_SOFTWARE; } if (mode > 0 && findI(mGlVersionString, "Mesa") != std::string::npos) @@ -224,7 +224,7 @@ int GraphicsManager::detectGraphics() compressTextures = 0; } - config.setValue("opengl", mode); + config.setValue("opengl", static_cast<int>(mode)); config.setValue("videoconfigured", true); config.write(); diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp index d9d003f93..f7cb65275 100644 --- a/src/test/testmain.cpp +++ b/src/test/testmain.cpp @@ -276,7 +276,7 @@ int TestMain::readValue(const int ver, int def) int TestMain::invokeTest(std::string test) { - mConfig.setValue("opengl", 0); + mConfig.setValue("opengl", static_cast<int>(RENDER_SOFTWARE)); mConfig.write(); const int ret = execFileWait(fileName, fileName, "-t", test); @@ -294,7 +294,7 @@ int TestMain::invokeTest4() int TestMain::invokeSoftwareRenderTest(std::string test) { - mConfig.setValue("opengl", 0); + mConfig.setValue("opengl", static_cast<int>(RENDER_SOFTWARE)); mConfig.write(); const int ret = execFileWait(fileName, fileName, "-t", test, 30); log->log("%s: %d", test.c_str(), ret); @@ -303,7 +303,7 @@ int TestMain::invokeSoftwareRenderTest(std::string test) int TestMain::invokeFastOpenGLRenderTest(std::string test) { - mConfig.setValue("opengl", 1); + mConfig.setValue("opengl", static_cast<int>(RENDER_NORMAL_OPENGL)); mConfig.write(); const int ret = execFileWait(fileName, fileName, "-t", test, 30); log->log("%s: %d", test.c_str(), ret); @@ -312,7 +312,7 @@ int TestMain::invokeFastOpenGLRenderTest(std::string test) int TestMain::invokeFastOpenBatchTest(std::string test) { - mConfig.setValue("opengl", 1); + mConfig.setValue("opengl", static_cast<int>(RENDER_NORMAL_OPENGL)); mConfig.write(); const int ret = execFileWait(fileName, fileName, "-t", test, 30); // log->log("%s: %d", test.c_str(), ret); @@ -321,7 +321,7 @@ int TestMain::invokeFastOpenBatchTest(std::string test) int TestMain::invokeSafeOpenGLRenderTest(std::string test) { - mConfig.setValue("opengl", 2); + mConfig.setValue("opengl", static_cast<int>(RENDER_SAFE_OPENGL)); mConfig.write(); const int ret = execFileWait(fileName, fileName, "-t", test, 30); log->log("%s: %d", test.c_str(), ret); |