From f35d6cd35d92ad16a55bf49f61f19153949497c0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 11 May 2012 21:55:28 +0300 Subject: Improve auto detection for best graphics mode. --- src/test/testlauncher.cpp | 10 ++++++++++ src/test/testlauncher.h | 2 ++ src/test/testmain.cpp | 20 +++++++++++++++++--- 3 files changed, 29 insertions(+), 3 deletions(-) (limited to 'src/test') diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index 6818c0b3c..b3fa729a0 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -23,6 +23,7 @@ #include "client.h" #include "configuration.h" #include "graphics.h" +#include "graphicsmanager.h" #include "localconsts.h" #include "logger.h" #include "sound.h" @@ -69,6 +70,8 @@ int TestLauncher::exec() return testRescale(); else if (mTest == "8" || mTest == "9" || mTest == "10") return testFps(); + else if (mTest == "99") + return testVideoDetection(); else if (mTest == "100") return testInternal(); @@ -207,6 +210,13 @@ int TestLauncher::testInternal() return 0; } +int TestLauncher::testVideoDetection() +{ + graphicsManager.detectGraphics(); + file << mTest << std::endl; + file << config.getIntValue("opengl") << std::endl; +} + int TestLauncher::calcFps(timeval *start, timeval *end, int calls) { long mtime; diff --git a/src/test/testlauncher.h b/src/test/testlauncher.h index 1f86dc396..5ca42eae7 100644 --- a/src/test/testlauncher.h +++ b/src/test/testlauncher.h @@ -47,6 +47,8 @@ class TestLauncher int testInternal(); + int testVideoDetection(); + private: std::string mTest; diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp index eb24a2c75..8ec48e6e2 100644 --- a/src/test/testmain.cpp +++ b/src/test/testmain.cpp @@ -78,9 +78,10 @@ int TestMain::exec() { initConfig(); int softwareTest = invokeSoftwareRenderTest("1"); - int fastOpenGLTest = invokeFastOpenGLRenderTest("2"); - int safeOpenGLTest = invokeSafeOpenGLRenderTest("3"); - int soundTest = invokeTest4(); + int fastOpenGLTest = -1; + int safeOpenGLTest = -1; + int videoDetectTest = -1; + int soundTest = -1; int rescaleTest[3]; int softFps = 0; int fastOpenGLFps = 0; @@ -88,11 +89,20 @@ int TestMain::exec() int openGLMode = 0; int maxFps = 0; + int detectMode = 0; rescaleTest[0] = -1; rescaleTest[1] = -1; rescaleTest[2] = -1; std::string info; + videoDetectTest = invokeTest("99"); + if (!videoDetectTest) + detectMode = readValue(99); + + fastOpenGLTest = invokeFastOpenGLRenderTest("2"); + safeOpenGLTest = invokeSafeOpenGLRenderTest("3"); + soundTest = invokeTest4(); + info += strprintf("%d.%d,%d,%d.", soundTest, softwareTest, fastOpenGLTest, safeOpenGLTest); @@ -184,6 +194,10 @@ int TestMain::exec() maxFps = safeOpenGLFps; } + // if OpenGL implimentation is not good, disable it. + if (!detectMode) + openGLMode = 0; + writeConfig(openGLMode, rescaleTest[openGLMode], soundTest, info); return 0; } -- cgit v1.2.3-70-g09d2