diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index 10a5109bbf..36d3041195 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -182,6 +182,7 @@ void TextureCacheVulkan::DeviceRestore(VulkanContext *vulkan) { void TextureCacheVulkan::ReleaseTexture(TexCacheEntry *entry) { DEBUG_LOG(G3D, "Deleting texture %p", entry->vkTex); delete entry->vkTex; + entry->vkTex = nullptr; } VkFormat getClutDestFormatVulkan(GEPaletteFormat format) { diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 6cb4997789..9d8d06a4f3 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -1119,3 +1119,7 @@ void EmuScreen::releaseButtons() { input.id = 0; touch(input); } + +void EmuScreen::resized() { + RecreateViews(); +} \ No newline at end of file diff --git a/UI/EmuScreen.h b/UI/EmuScreen.h index 15d08da81e..0d57297d48 100644 --- a/UI/EmuScreen.h +++ b/UI/EmuScreen.h @@ -41,6 +41,7 @@ public: void deviceRestore() override; void dialogFinished(const Screen *dialog, DialogResult result) override; void sendMessage(const char *msg, const char *value) override; + void resized() override; bool touch(const TouchInput &touch) override; bool key(const KeyInput &key) override; diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 0116a68585..019ebe22ee 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -774,7 +774,26 @@ void NativeRender(GraphicsContext *graphicsContext) { if (resized) { resized = false; + + if (uiContext) { + // Modifying the bounds here can be used to "inset" the whole image to gain borders for TV overscan etc. + // The UI now supports any offset but not the EmuScreen yet. + uiContext->SetBounds(Bounds(0, 0, dp_xres, dp_yres)); + // uiContext->SetBounds(Bounds(dp_xres/2, 0, dp_xres / 2, dp_yres / 2)); + + + // OSX 10.6 and SDL 1.2 bug. +#if defined(__APPLE__) && !defined(USING_QT_UI) + static int dp_xres_old = dp_xres; + if (dp_xres != dp_xres_old) { + // uiTexture->Load("ui_atlas.zim"); + dp_xres_old = dp_xres; + } +#endif + } + graphicsContext->Resize(); + screenManager->resized(); // TODO: Move this to new GraphicsContext objects for each backend. #ifndef _WIN32 @@ -991,24 +1010,8 @@ void NativeMessageReceived(const char *message, const char *value) { } void NativeResized() { + // NativeResized can come from any thread so we just set a flag, then process it later. resized = true; - - if (uiContext) { - // Modifying the bounds here can be used to "inset" the whole image to gain borders for TV overscan etc. - // The UI now supports any offset but not the EmuScreen yet. - uiContext->SetBounds(Bounds(0, 0, dp_xres, dp_yres)); - // uiContext->SetBounds(Bounds(dp_xres/2, 0, dp_xres / 2, dp_yres / 2)); - - -// OSX 10.6 and SDL 1.2 bug. -#if defined(__APPLE__) && !defined(USING_QT_UI) - static int dp_xres_old=dp_xres; - if (dp_xres != dp_xres_old) { - // uiTexture->Load("ui_atlas.zim"); - dp_xres_old = dp_xres; - } -#endif - } } void NativeShutdown() {