From 816020f4eb98df0d4857e17c68642a748bb9827c Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Thu, 21 Mar 2013 00:17:43 +0100 Subject: [PATCH] Prefer D3D11 and OpenGL over D3D9 by default. --- Source/Core/Common/Src/VideoBackendBase.cpp | 25 +++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Source/Core/Common/Src/VideoBackendBase.cpp b/Source/Core/Common/Src/VideoBackendBase.cpp index 62bb42997f..a5aa572039 100644 --- a/Source/Core/Common/Src/VideoBackendBase.cpp +++ b/Source/Core/Common/Src/VideoBackendBase.cpp @@ -29,6 +29,7 @@ std::vector g_available_video_backends; VideoBackend* g_video_backend = NULL; +static VideoBackend* s_default_backend = NULL; #ifdef _WIN32 // http://msdn.microsoft.com/en-us/library/ms725491.aspx @@ -49,17 +50,27 @@ static bool IsGteVista() void VideoBackend::PopulateList() { + VideoBackend* backends[4] = { NULL }; + + // D3D11 > OGL > D3D9 > SW #ifdef _WIN32 - g_available_video_backends.push_back(new DX9::VideoBackend); + g_available_video_backends.push_back(backends[2] = new DX9::VideoBackend); if (IsGteVista()) - g_available_video_backends.push_back(new DX11::VideoBackend); + g_available_video_backends.push_back(backends[0] = new DX11::VideoBackend); #endif #ifndef USE_GLES - g_available_video_backends.push_back(new OGL::VideoBackend); + g_available_video_backends.push_back(backends[1] = new OGL::VideoBackend); #endif - g_available_video_backends.push_back(new SW::VideoSoftware); + g_available_video_backends.push_back(backends[3] = new SW::VideoSoftware); - g_video_backend = g_available_video_backends.front(); + for (int i = 0; i < 4; ++i) + { + if (backends[i]) + { + s_default_backend = g_video_backend = backends[i]; + break; + } + } } void VideoBackend::ClearList() @@ -73,8 +84,8 @@ void VideoBackend::ClearList() void VideoBackend::ActivateBackend(const std::string& name) { - if (name.length() == 0) // If NULL, set it to the first one in the list. Expected behavior - g_video_backend = g_available_video_backends.front(); + if (name.length() == 0) // If NULL, set it to the default backend (expected behavior) + g_video_backend = s_default_backend; for (std::vector::const_iterator it = g_available_video_backends.begin(); it != g_available_video_backends.end(); ++it) if (name == (*it)->GetName())