From: Toni Wilen Date: Wed, 9 May 2018 16:13:22 +0000 (+0300) Subject: Do not use texture allocation for mode change checks. Update also RTG mode when D3D11... X-Git-Tag: 4000~66 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=c21254d21cde5f27dbb3d39df5ffd6efec062be7;p=francis%2Fwinuae.git Do not use texture allocation for mode change checks. Update also RTG mode when D3D11 changes state. --- diff --git a/gfxboard.cpp b/gfxboard.cpp index a94c3a17..e73e5b6c 100644 --- a/gfxboard.cpp +++ b/gfxboard.cpp @@ -852,16 +852,24 @@ uint8_t *surface_data(DisplaySurface *s) void gfxboard_refresh(int monid) { - if (monid > 0) { + if (monid >= 0) { for (int i = 0; i < MAX_RTG_BOARDS; i++) { - struct rtggfxboard *gb = &rtggfxboards[i]; - if (gb->monitor_id == monid) { - gb->fullrefresh = 2; + struct rtgboardconfig *rbc = &currprefs.rtgboards[i]; + if (rbc->monitor_id == monid && rbc->rtgmem_size) { + if (rbc->rtgmem_type >= GFXBOARD_HARDWARE) { + struct rtggfxboard *gb = &rtggfxboards[i]; + gb->fullrefresh = 2; + } else { + picasso_refresh(monid); + } } } } else { - if (rtg_visible[monid] >= 0) { - rtggfxboards[rtg_visible[monid]].fullrefresh = 2; + for (int i = 0; i < MAX_RTG_BOARDS; i++) { + struct rtgboardconfig *rbc = &currprefs.rtgboards[i]; + if (rbc->rtgmem_size) { + gfxboard_refresh(rbc->monitor_id); + } } } } diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index 632b05e6..83b57ee8 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -3235,10 +3235,11 @@ static void D3D_showframe2 (struct d3dstruct *d3d, bool dowait) } } -static void xD3D_restore(int monid) +static void xD3D_restore(int monid, bool checkonly) { struct d3dstruct *d3d = &d3ddata[monid]; - + if (checkonly) + return; d3d->renderdisabled = false; } diff --git a/od-win32/direct3d.h b/od-win32/direct3d.h index b71f5437..eb6796d1 100644 --- a/od-win32/direct3d.h +++ b/od-win32/direct3d.h @@ -18,7 +18,7 @@ extern int(*D3D_goodenough)(void); extern bool(*D3D_setcursor)(int, int x, int y, int width, int height, bool visible, bool noscale); extern uae_u8* (*D3D_setcursorsurface)(int, int *pitch); extern float(*D3D_getrefreshrate)(int); -extern void(*D3D_restore)(int); +extern void(*D3D_restore)(int, bool); extern void(*D3D_resize)(int, int); extern void(*D3D_change)(int, int); extern bool(*D3D_getscalerect)(int, float *mx, float *my, float *sx, float *sy); diff --git a/od-win32/direct3d11.cpp b/od-win32/direct3d11.cpp index 6061cc02..7422edda 100644 --- a/od-win32/direct3d11.cpp +++ b/od-win32/direct3d11.cpp @@ -25,6 +25,7 @@ using Microsoft::WRL::ComPtr; #include "statusline.h" #include "hq2x_d3d.h" #include "gui.h" +#include "gfxboard.h" #include "d3dx.h" @@ -57,7 +58,7 @@ int (*D3D_goodenough)(void); bool (*D3D_setcursor)(int, int x, int y, int width, int height, bool visible, bool noscale); uae_u8* (*D3D_setcursorsurface)(int, int *pitch); float (*D3D_getrefreshrate)(int); -void(*D3D_restore)(int); +void(*D3D_restore)(int, bool); void(*D3D_resize)(int, int); void (*D3D_change)(int, int); bool(*D3D_getscalerect)(int, float *mx, float *my, float *sx, float *sy); @@ -4503,6 +4504,7 @@ static void D3D11_resize_do(struct d3d11struct *d3d) resizemode(d3d); notice_screen_contents_lost(d3d - d3d11data); + gfxboard_refresh(d3d - d3d11data); write_log(_T("D3D11 resize exit\n")); } @@ -4621,8 +4623,10 @@ static void xD3D11_flushtexture(int monid, int miny, int maxy) struct d3d11struct *d3d = &d3d11data[monid]; } -static void xD3D11_restore(int monid) +static void xD3D11_restore(int monid, bool checkonly) { + struct d3d11struct *d3d = &d3d11data[monid]; + recheck(d3d); } static void xD3D11_vblank_reset(double freq) @@ -4718,6 +4722,7 @@ static void xD3D11_guimode(int monid, int guion) } else if (guion == 0) { d3d->delayedfs = 1; notice_screen_contents_lost(monid); + gfxboard_refresh(monid); } write_log(_T("fs guimode end\n")); } diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index ce28632c..eb0ba3c5 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -1835,7 +1835,7 @@ static LRESULT CALLBACK AmigaWindowProc(HWND hWnd, UINT message, WPARAM wParam, ignorelbutton = true; break; case WM_ACTIVATEAPP: - D3D_restore(0); + D3D_restore(0, false); //write_log(_T("WM_ACTIVATEAPP %08x\n"), wParam); if (!wParam && isfullscreen() > 0 && D3D_resize && !gui_active) { write_log(_T("WM_ACTIVATEAPP inactive %p\n"), hWnd); diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index ab75a72c..8862f319 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -997,6 +997,8 @@ void S2X_render(int monid, int y_start, int y_end) bufmem_ptr = sptr; if (d3d) { + if (D3D_restore) + D3D_restore(monid, true); surfstart = D3D_locktexture(monid, &pitch, &surf_height, true); if (surfstart == NULL) return;