From 8e6ab562dd62383d191806e88548e89b4d0a9d65 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 25 May 2014 17:50:46 +0300 Subject: Add support for simple texture size detection. This test check from 1024 to max texture size reported by driver. --- src/test/testlauncher.cpp | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'src/test/testlauncher.cpp') 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; -- cgit v1.2.3-60-g2f50