]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
If texture allocation is called when device is not allocated (for example GUI entered...
authorToni Wilen <twilen@winuae.net>
Fri, 2 Aug 2024 19:11:25 +0000 (22:11 +0300)
committerToni Wilen <twilen@winuae.net>
Fri, 2 Aug 2024 19:11:25 +0000 (22:11 +0300)
od-win32/direct3d.cpp
od-win32/direct3d11.cpp
od-win32/gdirender.cpp

index 1d672f9af684b5b86c30c8f73b281a34627067b2..75914e25364b12fa5c9a4ead9eccec5d8cdd95c8 100644 (file)
@@ -3086,10 +3086,15 @@ static const TCHAR *xD3D_init (HWND ahwnd, int monid, int w_w, int w_h, int dept
 
 static bool alloctextures (struct d3dstruct *d3d)
 {
-       if (!createtexture (d3d, d3d->tout_w, d3d->tout_h, d3d->window_w, d3d->window_h))
+       if (!d3d->d3ddev) {
                return false;
-       if (!createamigatexture (d3d, d3d->tin_w, d3d->tin_h))
+       }
+       if (!createtexture (d3d, d3d->tout_w, d3d->tout_h, d3d->window_w, d3d->window_h)) {
+               return false;
+       }
+       if (!createamigatexture (d3d, d3d->tin_w, d3d->tin_h)) {
                return false;
+       }
        return true;
 }
 
index a8f0b0f7b45d0d4f612dede9c2196df5336456df..0fcbc052afbe4ac7b46958980aea11315acd8426 100644 (file)
@@ -5046,8 +5046,9 @@ static bool xD3D11_alloctexture(int monid, int w, int h)
 
        recheck(d3d, monid);
 
-       if (d3d->invalidmode)
+       if (d3d->invalidmode || !d3d->m_device) {
                return false;
+       }
 
        d3d->m_bitmapWidth = w;
        d3d->m_bitmapHeight = h;
index 0997fd43785385244745eaada6800545a53e6bac..56b99b47fdf3c427eb2488047b40679fb5d7b1d3 100644 (file)
@@ -242,6 +242,10 @@ static bool gdi_alloctexture(int monid, int w, int h)
 
        freetexture(monid);
 
+       if (!gdi->hwnd) {
+               return false;
+       }
+
        gdi->hdc = GetDC(gdi->hwnd);
        if (gdi->hdc) {
                SelectObject(gdi->hdc, GetStockObject(DC_PEN));