From 69c8af4a2ea24f35d2ed2c1cbbe00fc1cd05d983 Mon Sep 17 00:00:00 2001 From: Michael Kamensky Date: Sat, 22 Aug 2020 18:02:37 +0300 Subject: [PATCH] - Reset the SDL texture to avoid the renderer hanging. --- src/include/86box/win_sdl.h | 1 + src/win/win_sdl.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/include/86box/win_sdl.h b/src/include/86box/win_sdl.h index c157c6f59..97ee42090 100644 --- a/src/include/86box/win_sdl.h +++ b/src/include/86box/win_sdl.h @@ -58,6 +58,7 @@ extern int sdl_inith_fs(HWND h); extern int sdl_pause(void); extern void sdl_resize(int x, int y); extern void sdl_enable(int enable); +extern void sdl_reinit_texture(); #endif /*WIN_SDL_H*/ diff --git a/src/win/win_sdl.c b/src/win/win_sdl.c index 11bb948b2..4be55fe34 100644 --- a/src/win/win_sdl.c +++ b/src/win/win_sdl.c @@ -181,6 +181,8 @@ sdl_stretch(int *w, int *h, int *x, int *y) *y = (int) dy; break; } + + sdl_reinit_texture(); } @@ -489,6 +491,18 @@ sdl_inith_fs(HWND h) } +void +sdl_reinit_texture() +{ + if (sdl_render == NULL) + return; + + SDL_DestroyTexture(sdl_tex); + sdl_tex = SDL_CreateTexture(sdl_render, SDL_PIXELFORMAT_ARGB8888, + SDL_TEXTUREACCESS_STREAMING, 2048, 2048); +} + + int sdl_pause(void) { @@ -514,6 +528,8 @@ sdl_resize(int x, int y) cur_w = x; cur_h = y; + + sdl_reinit_texture(); }