From 5fa929bbba7bf62590221c1029006c2f6aead0c3 Mon Sep 17 00:00:00 2001 From: The Dax Date: Fri, 12 Sep 2014 16:16:13 -0400 Subject: [PATCH] Win32: Add a command-line argument to pick the GPU backend. --- Windows/main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Windows/main.cpp b/Windows/main.cpp index d4ff963d40..24fa8dcc95 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -435,6 +435,8 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin bool debugLogLevel = false; + const std::wstring gpuBackend = L"--gfx="; + // The rest is handled in NativeInit(). for (size_t i = 1; i < wideArgs.size(); ++i) { @@ -461,6 +463,16 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin if (wideArgs[i] == L"--windowed") g_Config.bFullScreen = false; + + if (wideArgs[i].find(gpuBackend) != std::wstring::npos && wideArgs[i].size() > gpuBackend.size()) + { + const std::wstring restOfOption = wideArgs[i].substr(gpuBackend.size()); + + if (restOfOption == L"d3d") + g_Config.iGPUBackend = GPU_BACKEND_DIRECT3D9; + else if (restOfOption == L"ogl") + g_Config.iGPUBackend = GPU_BACKEND_OPENGL; + } } } #ifdef _DEBUG