diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-16 21:10:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-16 21:27:20 +0300 |
commit | 71a8401df046ac856d3bb02d6f44733890883f44 (patch) | |
tree | e37e6c9b47ff4a9c45a41860286a78bd12f61616 | |
parent | a82331f46657298d335c36f9276ab3007b327d4b (diff) | |
download | mv-71a8401df046ac856d3bb02d6f44733890883f44.tar.gz mv-71a8401df046ac856d3bb02d6f44733890883f44.tar.bz2 mv-71a8401df046ac856d3bb02d6f44733890883f44.tar.xz mv-71a8401df046ac856d3bb02d6f44733890883f44.zip |
Add max texture size detection for all modes.
-rw-r--r-- | src/defaults.cpp | 2 | ||||
-rw-r--r-- | src/graphicsmanager.cpp | 14 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_video.cpp | 2 | ||||
-rw-r--r-- | src/resources/atlasmanager.cpp | 3 | ||||
-rw-r--r-- | src/settings.h | 2 | ||||
-rw-r--r-- | src/test/testlauncher.cpp | 4 | ||||
-rw-r--r-- | src/test/testmain.cpp | 78 | ||||
-rw-r--r-- | src/test/testmain.h | 2 |
8 files changed, 60 insertions, 47 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp index a98f7468a..1c83782d5 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -367,7 +367,7 @@ DefaultsData* getConfigDefaults() AddDEF("addwatermark", true); AddDEF("hidesupport", false); AddDEF("showserverpos", false); - AddDEF("textureSize", 1024); + AddDEF("textureSize", "1024,1024,1024"); return configData; } diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index 3e9701115..81296b1cb 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -485,6 +485,17 @@ void GraphicsManager::initGraphics() detectPixelSize(); setVideoMode(); } +#if !defined(ANDROID) && !defined(__APPLE__) + const std::string str = config.getStringValue("textureSize"); + std::vector<int> sizes; + splitToIntVector(sizes, str, ','); + const size_t pos = static_cast<size_t>(openGLMode); + if (sizes.size() <= pos) + settings.textureSize = 1024; + else + settings.textureSize = sizes[pos]; + logger->log("Detected max texture size: %d", settings.textureSize); +#endif // !defined(ANDROID) && !defined(__APPLE__) #endif } @@ -1271,7 +1282,8 @@ void GraphicsManager::detectVideoSettings() if (val != -1) config.setValue("compresstextures", val); } - config.setValue("textureSize", conf.getValueInt("textureSize", 1024)); + config.setValue("textureSize", conf.getValue("textureSize", + "1024,1024,1024")); config.setValue("testInfo", conf.getValue("testInfo", "")); delete test; } diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index 6bc8d07e9..9e79aba3f 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -455,7 +455,7 @@ void Setup_Video::action(const ActionEvent &event) mOpenGLDropDown->setSelected(renderToIndex[val]); } config.setValue("textureSize", - conf.getValueInt("textureSize", 1024)); + conf.getValue("textureSize", "1024,1024,1024")); config.setValue("testInfo", conf.getValue("testInfo", "")); delete test; } diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp index cdbd26a65..c78c9911f 100644 --- a/src/resources/atlasmanager.cpp +++ b/src/resources/atlasmanager.cpp @@ -25,6 +25,7 @@ #include "resources/atlasmanager.h" #include "configuration.h" +#include "settings.h" #ifdef DEBUG_IMAGES #include "logger.h" @@ -61,7 +62,7 @@ AtlasResource *AtlasManager::loadTextureAtlas(const std::string &name, loadImages(files, images); int maxSize = OpenGLImageHelper::getTextureSize(); #if !defined(ANDROID) && !defined(__APPLE__) - const int sz = config.getIntValue("textureSize"); + int sz = settings.textureSize; if (maxSize > sz) maxSize = sz; #endif diff --git a/src/settings.h b/src/settings.h index 15b26faae..847600c95 100644 --- a/src/settings.h +++ b/src/settings.h @@ -51,6 +51,7 @@ class Settings final updateMirrors(), options(), guiAlpha(1.0F), + textureSize(1024), persistentIp(true), limitFps(false), inputFocused(true), @@ -76,6 +77,7 @@ class Settings final std::vector<std::string> updateMirrors; Options options; float guiAlpha; + unsigned int textureSize; bool persistentIp; bool limitFps; bool inputFocused; diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index 8dc292177..c6c9d5128 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -80,7 +80,7 @@ int TestLauncher::exec() return testFps(); else if (mTest == "11") return testBatches(); - else if (mTest == "14" || mTest == "15" || mTest == "16") + else if (mTest == "14" || mTest == "15" || mTest == "16" || mTest == "20") return testTextures(); else if (mTest == "99") return testVideoDetection(); @@ -352,6 +352,8 @@ int TestLauncher::testTextures() file << mTest << std::endl; file << maxSize << std::endl; + printf("OpenGL max size: %d\n", sz); + printf("actual max size: %d\n", maxSize); return 0; } diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp index 5b860eb92..f26366596 100644 --- a/src/test/testmain.cpp +++ b/src/test/testmain.cpp @@ -74,19 +74,21 @@ int TestMain::exec(const bool testAudio) initConfig(); int softwareTest = invokeSoftwareRenderTest("1"); int soundTest = -1; - int rescaleTest[5]; + int rescaleTest[6]; int softFps = 0; int normalOpenGLFps = 0; int safeOpenGLFps = 0; int modernOpenGLFps = 0; - int textureSize1 = 1024; - int textureSize2 = 1024; - int textureSize3 = 1024; + int textureSize[6]; + std::string textureSizeStr; RenderType openGLMode = RENDER_SOFTWARE; int detectMode = 0; - for (int f = 0; f < f; f ++) + for (int f = 0; f < 6; f ++) + { rescaleTest[f] = -1; + textureSize[f] = 1024; + } std::string info; const int videoDetectTest = invokeTest("99"); @@ -224,51 +226,45 @@ int TestMain::exec(const bool testAudio) int batchSize = 256; - // if OpenGL mode is normal mode we can try detect max batch sizes - if (openGLMode == RENDER_NORMAL_OPENGL - || openGLMode == RENDER_GLES_OPENGL - || openGLMode == RENDER_MODERN_OPENGL) + if (!invokeNormalOpenBatchTest("11")) + batchSize = readValue2(11); + if (batchSize < 256) + batchSize = 256; + + if (!invokeNormalOpenBatchTest("14")) { - if (!invokeNormalOpenBatchTest("11")) - batchSize = readValue2(11); - if (batchSize < 256) - batchSize = 256; - - if (!invokeNormalOpenBatchTest("14")) - textureSize1 = readValue2(14); - if (!invokeModernOpenBatchTest("15")) - textureSize2 = readValue2(15); - if (!invokeSafeOpenBatchTest("16")) - textureSize3 = readValue2(16); - info.append(strprintf(",%d,%d,%d,-", - textureSize1, textureSize2, textureSize3)); - textureSize1 = std::min(textureSize1, textureSize2); - textureSize1 = std::min(textureSize1, textureSize3); - if (textureSize1 < 1024) - textureSize1 = 1024; + textureSize[static_cast<size_t>(RENDER_NORMAL_OPENGL)] + = readValue2(14); } - else if (openGLMode == RENDER_SAFE_OPENGL) + if (!invokeModernOpenBatchTest("15")) { - if (!invokeSafeOpenBatchTest("16")) - textureSize3 = readValue2(16); - textureSize1 = textureSize3; - if (normalOpenGLTest != -1) - { - if (!invokeNormalOpenBatchTest("14")) - textureSize1 = readValue2(14); - } - info.append(strprintf(",%d,%d,-", textureSize1, textureSize3)); - textureSize1 = std::min(textureSize1, textureSize3); - if (textureSize1 < 1024) - textureSize1 = 1024; + textureSize[static_cast<size_t>(RENDER_MODERN_OPENGL)] + = readValue2(15); } + if (!invokeSafeOpenBatchTest("16")) + { + textureSize[static_cast<size_t>(RENDER_SAFE_OPENGL)] + = readValue2(16); + } + if (!invokeMobileOpenBatchTest("20")) + { + textureSize[static_cast<size_t>(RENDER_GLES_OPENGL)] + = readValue2(20); + } + for (int f = 0; f < 6; f ++) + info.append(strprintf(",%d", textureSize[f])); + info.append(",-"); + + textureSizeStr = toString(textureSize[0]); + for (int f = 1; f < 6; f ++) + textureSizeStr.append(strprintf(",%d", textureSize[f])); // if OpenGL implimentation is not good, disable it. if (!(detectMode & 15)) openGLMode = RENDER_SOFTWARE; writeConfig(openGLMode, rescaleTest[static_cast<size_t>(openGLMode)], - soundTest, info, batchSize, textureSize1, detectMode); + soundTest, info, batchSize, textureSizeStr, detectMode); return 0; } @@ -277,7 +273,7 @@ void TestMain::writeConfig(const RenderType openGLMode, const int sound, const std::string &info, const int batchSize A_UNUSED, - const int textureSize, + const std::string &textureSize, const int detectMode) { mConfig.init(settings.configDir + "/config.xml"); diff --git a/src/test/testmain.h b/src/test/testmain.h index 93f305e22..3f0a85b0b 100644 --- a/src/test/testmain.h +++ b/src/test/testmain.h @@ -81,7 +81,7 @@ class TestMain final const int sound, const std::string &info, const int batchSize, - const int textureSize, + const std::string &textureSize, const int detectMode); int readValue2(const int ver); |