summaryrefslogtreecommitdiff
path: root/src/test/testlauncher.cpp
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/testlauncher.cpp
parente195e09e86d18c45676431813f98c56d85cc8201 (diff)
downloadmanaplus-8e6ab562dd62383d191806e88548e89b4d0a9d65.tar.gz
manaplus-8e6ab562dd62383d191806e88548e89b4d0a9d65.tar.bz2
manaplus-8e6ab562dd62383d191806e88548e89b4d0a9d65.tar.xz
manaplus-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/testlauncher.cpp')
-rw-r--r--src/test/testlauncher.cpp37
1 files changed, 36 insertions, 1 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;