]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Do not reset d3d11 if display size has not changed
authorToni Wilen <twilen@winuae.net>
Sat, 21 Oct 2023 15:48:23 +0000 (18:48 +0300)
committerToni Wilen <twilen@winuae.net>
Sat, 21 Oct 2023 15:48:23 +0000 (18:48 +0300)
od-win32/direct3d11.cpp

index 58328bed22e490a7611fcf9ca15b70ed96a1a18e..4042bd24a1e1ace097fc0d8010d86c55e540a095 100644 (file)
@@ -3414,16 +3414,29 @@ static float xD3D_getrefreshrate(int monid)
        return d3d->vblank;
 }
 
-static void xD3D11_initvals(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t_h, int depth, int *freq, int mmulth, int mmultv)
+static bool xD3D11_initvals(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t_h, int depth, int *freq, int mmulth, int mmultv, bool doalloc)
 {
        struct d3d11struct *d3d = &d3d11data[monid];
+       bool changed = false;
 
+       if (d3d->m_screenWidth != w_w || d3d->m_screenHeight != w_h) {
+               changed = true;
+       }
+       if (doalloc && !changed && (d3d->m_bitmapWidth != t_w || d3d->m_bitmapHeight != t_h || d3d->dmultxh != mmulth || d3d->dmultxv != mmultv)) {
+               d3d->m_bitmapWidth = t_w;
+               d3d->m_bitmapHeight = t_h;
+               d3d->dmultxh = mmulth;
+               d3d->dmultxv = mmultv;
+               D3D_alloctexture(monid, t_w, t_h);
+       }
        d3d->m_bitmapWidth = t_w;
        d3d->m_bitmapHeight = t_h;
        d3d->m_screenWidth = w_w;
        d3d->m_screenHeight = w_h;
        d3d->dmultxh = mmulth;
        d3d->dmultxv = mmultv;
+
+       return changed;
 }
 
 static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t_h, int depth, int *freq, int mmulth, int mmultv)
@@ -3461,7 +3474,7 @@ static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t
                return 0;
        }
 
-       xD3D11_initvals(ahwnd, monid, w_w, w_h, t_w, t_h, depth, freq, mmulth, mmultv);
+       xD3D11_initvals(ahwnd, monid, w_w, w_h, t_w, t_h, depth, freq, mmulth, mmultv, false);
 
        d3d->ahwnd = ahwnd;
 
@@ -4204,8 +4217,9 @@ static const TCHAR *xD3D11_init(HWND ahwnd, int monid, int w_w, int w_h, int dep
                return _T("D3D11 INITIALIZATION ERROR");
        } else {
                struct d3d11struct *d3d = &d3d11data[monid];
-               xD3D11_initvals(ahwnd, monid, w_w, w_h, w_w, w_h, depth, freq, mmulth, mmultv);
-               d3d->fsresizedo = true;
+               if (xD3D11_initvals(ahwnd, monid, w_w, w_h, w_w, w_h, depth, freq, mmulth, mmultv, true)) {
+                       d3d->fsresizedo = true;
+               }
                return NULL;
        }
 }