mirror of https://github.com/snes9xgit/snes9x.git
win32: Try to handle race in changing drivers.
This commit is contained in:
parent
4f08da4cd8
commit
54770ef3cc
|
@ -14,9 +14,15 @@ bool CVulkan::Initialize(HWND hWnd)
|
|||
current_width = window_rect.right - window_rect.left;
|
||||
current_height = window_rect.bottom - window_rect.top;
|
||||
|
||||
context = std::make_unique<Vulkan::Context>();
|
||||
if (!context->init_win32(0, hWnd))
|
||||
try {
|
||||
context = std::make_unique<Vulkan::Context>();
|
||||
if (!context->init_win32(0, hWnd))
|
||||
return false;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GUI.shaderEnabled && GUI.OGLshaderFileName && GUI.OGLshaderFileName[0])
|
||||
{
|
||||
|
|
|
@ -107,6 +107,9 @@ returns true if successful, false otherwise
|
|||
bool WinDisplayReset(void)
|
||||
{
|
||||
S9xDisplayOutput->DeInitialize();
|
||||
if (S9xDisplayOutput == (IS9xDisplayOutput *)&VulkanDriver && GUI.outputMethod == OPENGL)
|
||||
Sleep(500);
|
||||
|
||||
switch(GUI.outputMethod) {
|
||||
default:
|
||||
case DIRECT3D:
|
||||
|
@ -124,14 +127,23 @@ bool WinDisplayReset(void)
|
|||
S9xDisplayOutput = &VulkanDriver;
|
||||
break;
|
||||
}
|
||||
if(S9xDisplayOutput->Initialize(GUI.hWnd)) {
|
||||
|
||||
bool initialized = S9xDisplayOutput->Initialize(GUI.hWnd);
|
||||
|
||||
if (!initialized) {
|
||||
S9xDisplayOutput->DeInitialize();
|
||||
Sleep(500);
|
||||
initialized = S9xDisplayOutput->Initialize(GUI.hWnd);
|
||||
}
|
||||
|
||||
if (initialized) {
|
||||
S9xGraphicsDeinit();
|
||||
S9xSetWinPixelFormat ();
|
||||
S9xSetWinPixelFormat();
|
||||
S9xGraphicsInit();
|
||||
|
||||
if (GUI.DWMSync)
|
||||
{
|
||||
HMODULE dwmlib = LoadLibrary(TEXT("dwmapi"));
|
||||
if (GUI.DWMSync)
|
||||
{
|
||||
HMODULE dwmlib = LoadLibrary(TEXT("dwmapi"));
|
||||
DwmFlushProc = (DWMFLUSHPROC)GetProcAddress(dwmlib, "DwmFlush");
|
||||
DwmIsCompositionEnabledProc = (DWMISCOMPOSITIONENABLEDPROC)GetProcAddress(dwmlib, "DwmIsCompositionEnabled");
|
||||
|
||||
|
|
Loading…
Reference in New Issue