Windows: If neither OpenGL nor D3D9 is available, offer an escape route into D3D11.

This does happen on some fresh Win10 installations.

We really should do something much nicer and more automatic, but that's for later.
This commit is contained in:
Henrik Rydgård 2018-05-03 22:18:26 +02:00
parent 554029b477
commit 3f7602227c
3 changed files with 7 additions and 3 deletions

View File

@ -249,7 +249,7 @@ bool WindowsGLContext::InitFromRenderThread(std::string *error_message) {
ExitProcess(1);
}
const char *defaultError = "Insufficient OpenGL driver support detected!\n\n"
"Your GPU reports that it does not support OpenGL 2.0. Would you like to try using DirectX 9 instead?\n\n"
"Your GPU reports that it does not support OpenGL 2.0. Would you like to try using DirectX instead?\n\n"
"DirectX is currently compatible with less games, but on your GPU it may be the only choice.\n\n"
"Visit the forums at http://forums.ppsspp.org for more information.\n\n";
@ -262,7 +262,10 @@ bool WindowsGLContext::InitFromRenderThread(std::string *error_message) {
if (yes) {
// Change the config to D3D and restart.
g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D9;
const char *d3d9Or11 = "Direct3D 9? (Or no for Direct3D 11)";
std::wstring whichD3D9 = ConvertUTF8ToWString(err->T("D3D9or11", d3d9Or11));
bool d3d9 = IDYES == MessageBox(hWnd_, whichD3D9.c_str(), title.c_str(), MB_YESNO);
g_Config.iGPUBackend = d3d9 ? (int)GPUBackend::DIRECT3D9 : (int)GPUBackend::DIRECT3D11;
g_Config.Save();
W32Util::ExitAndRestart();

View File

@ -26,6 +26,7 @@ enum class VKRRenderCommand : uint8_t {
DRAW,
DRAW_INDEXED,
PUSH_CONSTANTS,
NUM_RENDER_COMMANDS,
};
struct VkRenderData {

View File

@ -623,7 +623,7 @@ static void RemoveDrawCommands(std::vector<VkRenderData> *cmds) {
}
static void CleanupRenderCommands(std::vector<VkRenderData> *cmds) {
size_t lastCommand[256];
size_t lastCommand[(int)VKRRenderCommand::NUM_RENDER_COMMANDS];
memset(lastCommand, -1, sizeof(lastCommand));
// Find any duplicate state commands (likely from RemoveDrawCommands.)