summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-25 17:50:46 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-25 17:50:46 +0300
commit8e6ab562dd62383d191806e88548e89b4d0a9d65 (patch)
tree36fa576cdb6ff9aa950ec04165eab095f794f385 /src/test
parente195e09e86d18c45676431813f98c56d85cc8201 (diff)
downloadmv-8e6ab562dd62383d191806e88548e89b4d0a9d65.tar.gz
mv-8e6ab562dd62383d191806e88548e89b4d0a9d65.tar.bz2
mv-8e6ab562dd62383d191806e88548e89b4d0a9d65.tar.xz
mv-8e6ab562dd62383d191806e88548e89b4d0a9d65.zip
Add support for simple texture size detection.
This test check from 1024 to max texture size reported by driver.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/testlauncher.cpp37
-rw-r--r--src/test/testlauncher.h2
-rw-r--r--src/test/testmain.cpp32
-rw-r--r--src/test/testmain.h12
4 files changed, 75 insertions, 8 deletions
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp
index 26ad10174..f2167af24 100644
--- a/src/test/testlauncher.cpp
+++ b/src/test/testlauncher.cpp
@@ -35,8 +35,8 @@
#include "resources/dye.h"
#include "resources/image.h"
-#include "resources/imagehelper.h"
#include "resources/imagewriter.h"
+#include "resources/openglimagehelper.h"
#include "resources/surfaceimagehelper.h"
#include "resources/wallpaper.h"
@@ -74,6 +74,8 @@ int TestLauncher::exec()
return testFps();
else if (mTest == "11")
return testBatches();
+ else if (mTest == "14" || mTest == "15")
+ return testTextures();
else if (mTest == "99")
return testVideoDetection();
else if (mTest == "100")
@@ -183,6 +185,39 @@ int TestLauncher::testBatches()
return 0;
}
+int TestLauncher::testTextures()
+{
+ int maxSize = 1024;
+ int nextSize = 1024;
+ int sz = OpenGLImageHelper::getTextureSize() + 1;
+ if (sz < 16500)
+ sz = 16500;
+
+ for (nextSize = 512; nextSize < sz; nextSize *= 2)
+ {
+ SDL_Surface *const surface = imageHelper->create32BitSurface(
+ nextSize, nextSize);
+ if (!surface)
+ break;
+ graphicsManager.getLastError();
+ graphicsManager.resetCachedError();
+ Image *const image = imageHelper->load(surface);
+ if (!image)
+ break;
+ if (graphicsManager.getLastErrorCached() != GL_NO_ERROR)
+ break;
+
+ delete image;
+ SDL_FreeSurface(surface);
+
+ maxSize = nextSize;
+ }
+
+ file << mTest << std::endl;
+ file << maxSize << std::endl;
+ return 0;
+}
+
int TestLauncher::testInternal()
{
timeval start;
diff --git a/src/test/testlauncher.h b/src/test/testlauncher.h
index 296cc5b29..a7ebadf4a 100644
--- a/src/test/testlauncher.h
+++ b/src/test/testlauncher.h
@@ -64,6 +64,8 @@ class TestLauncher final
int testBatches();
+ int testTextures();
+
private:
std::string mTest;
diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp
index d21cd2dac..c42efc23e 100644
--- a/src/test/testmain.cpp
+++ b/src/test/testmain.cpp
@@ -79,6 +79,8 @@ int TestMain::exec(const bool testAudio)
int softFps = 0;
int fastOpenGLFps = 0;
int safeOpenGLFps = 0;
+ int textureSize1 = 1024;
+ int textureSize2 = 1024;
RenderType openGLMode = RENDER_SOFTWARE;
int detectMode = 0;
@@ -199,6 +201,14 @@ int TestMain::exec(const bool testAudio)
batchSize = readValue2(11);
if (batchSize < 256)
batchSize = 256;
+
+ if (!invokeFastOpenBatchTest("14"))
+ textureSize1 = readValue2(14);
+ if (!invokeFastOpenBatchTest("15"))
+ textureSize2 = readValue2(15);
+ textureSize1 = std::min(textureSize1, textureSize2);
+ if (textureSize1 < 1024)
+ textureSize1 = 1024;
}
// if OpenGL implimentation is not good, disable it.
@@ -206,13 +216,17 @@ int TestMain::exec(const bool testAudio)
openGLMode = RENDER_SOFTWARE;
writeConfig(openGLMode, rescaleTest[static_cast<size_t>(openGLMode)],
- soundTest, info, batchSize, detectMode);
+ soundTest, info, batchSize, textureSize1, detectMode);
return 0;
}
-void TestMain::writeConfig(const RenderType openGLMode, const int rescale,
- const int sound, const std::string &info,
- const int batchSize A_UNUSED, const int detectMode)
+void TestMain::writeConfig(const RenderType openGLMode,
+ const int rescale,
+ const int sound,
+ const std::string &info,
+ const int batchSize A_UNUSED,
+ const int textureSize,
+ const int detectMode)
{
mConfig.init(client->getConfigDirectory() + "/config.xml");
@@ -229,6 +243,7 @@ void TestMain::writeConfig(const RenderType openGLMode, const int rescale,
mConfig.setValue("altfpslimit", 2);
mConfig.setValue("safemode", false);
mConfig.setValue("enableMapReduce", true);
+ mConfig.setValue("textureSize", textureSize);
// max batch size
// mConfig.setValue("batchsize", batchSize);
@@ -320,6 +335,15 @@ int TestMain::invokeFastOpenBatchTest(const std::string &test)
return ret;
}
+int TestMain::invokeMobileOpenBatchTest(const std::string &test)
+{
+ mConfig.setValue("opengl", static_cast<int>(RENDER_GLES_OPENGL));
+ mConfig.write();
+ const int ret = execFileWait(fileName, fileName, "-t", test, 30);
+// log->log("%s: %d", test.c_str(), ret);
+ return ret;
+}
+
int TestMain::invokeSafeOpenGLRenderTest(const std::string &test)
{
mConfig.setValue("opengl", static_cast<int>(RENDER_SAFE_OPENGL));
diff --git a/src/test/testmain.h b/src/test/testmain.h
index 72411417e..d4bae14ce 100644
--- a/src/test/testmain.h
+++ b/src/test/testmain.h
@@ -64,13 +64,19 @@ class TestMain final
int invokeFastOpenBatchTest(const std::string &test);
+ int invokeMobileOpenBatchTest(const std::string &test);
+
int invokeSafeOpenGLRenderTest(const std::string &test);
void testsMain();
- void writeConfig(const RenderType openGLMode, const int rescale,
- const int sound, const std::string &info,
- const int batchSize, const int detectMode);
+ void writeConfig(const RenderType openGLMode,
+ const int rescale,
+ const int sound,
+ const std::string &info,
+ const int batchSize,
+ const int textureSize,
+ const int detectMode);
int readValue2(const int ver);