keep trying to ReleaseDirect3D in case the first try fails
This commit is contained in:
parent
f70a085f08
commit
227bbc8280
2 changed files with 9 additions and 10 deletions
2
ddraw.rc
2
ddraw.rc
|
@ -2,7 +2,7 @@
|
|||
#define vxstr(a,b,c,d) str(a##.##b##.##c##.##d)
|
||||
#define str(s) #s
|
||||
|
||||
#define VERSION 1,2,1,0
|
||||
#define VERSION 1,2,1,1
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION VERSION
|
||||
|
|
|
@ -237,6 +237,8 @@ static void Render()
|
|||
DWORD tickStart = 0;
|
||||
DWORD tickEnd = 0;
|
||||
BOOL active = TRUE;
|
||||
BOOL released = TRUE;
|
||||
LONG minimized = TRUE;
|
||||
|
||||
while (ddraw->render.run && WaitForSingleObject(ddraw->render.sem, 200) != WAIT_FAILED)
|
||||
{
|
||||
|
@ -244,6 +246,9 @@ static void Render()
|
|||
{
|
||||
Sleep(500);
|
||||
|
||||
if (!released && (released = ReleaseDirect3D()) && minimized)
|
||||
ShowWindow(ddraw->hWnd, SW_MINIMIZE);
|
||||
|
||||
if (!InterlockedExchangeAdd(&ddraw->minimized, 0) && CreateDirect3D())
|
||||
{
|
||||
active = TRUE;
|
||||
|
@ -319,21 +324,15 @@ static void Render()
|
|||
|
||||
HRESULT hr = D3dDev->lpVtbl->TestCooperativeLevel(D3dDev);
|
||||
LONG modeChanged = InterlockedExchange(&ddraw->displayModeChanged, FALSE);
|
||||
LONG minimized = InterlockedExchangeAdd(&ddraw->minimized, 0);
|
||||
minimized = InterlockedExchangeAdd(&ddraw->minimized, 0);
|
||||
|
||||
if (minimized || modeChanged)
|
||||
{
|
||||
active = FALSE;
|
||||
BOOL released = ReleaseDirect3D();
|
||||
Sleep(100);
|
||||
released = ReleaseDirect3D();
|
||||
|
||||
if (minimized)
|
||||
{
|
||||
if (released && minimized)
|
||||
ShowWindow(ddraw->hWnd, SW_MINIMIZE);
|
||||
|
||||
if (!released)
|
||||
ChangeDisplaySettings(&ddraw->mode, 0);
|
||||
}
|
||||
}
|
||||
else if (hr == D3DERR_DEVICENOTRESET && D3dpp.Windowed)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue