UWP 4K fix: align MESA reading of ClientRect to retroarch procedure, this fixes max resolution being set to 1080p. As reading must be done inside an UI thread and is in fact an async operation which might delay frame generation, the reading itself is doen once and cached, give that changing resolution while the app is running is an unlikely corner-case use

This commit is contained in:
e.canepa 2024-05-13 09:44:57 +02:00 committed by LibretroAdmin
parent e0537c0548
commit 448dea5beb
8 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,5 @@
# MESA PreBuilt Libraries
The Binaries in this folder are compiled from a custom version of [MESA](https://github.com/aerisarn/mesa-uwp).
These are based on this [tag](https://github.com/aerisarn/mesa-uwp/releases/tag/alpha-2-resfix).
These are based on this [branch](https://github.com/aerisarn/mesa-uwp/releases/tag/alpha-2-hack-fixes), which is the
stable branch for MESA integration into Retroarch.

View File

@ -939,8 +939,13 @@ extern "C" {
return (void*)CoreWindow::GetForCurrentThread();
}
int current_height = -1;
int uwp_get_height(void)
{
if (current_height != -1)
return current_height;
/* This function must be performed within UI thread,
* otherwise it will cause a crash in specific cases
* https://github.com/libretro/RetroArch/issues/13491 */
@ -974,11 +979,17 @@ extern "C" {
if (corewindow)
corewindow->Dispatcher->ProcessEvents(Windows::UI::Core::CoreProcessEventsOption::ProcessAllIfPresent);
}
current_height = ret;
return ret;
}
int current_width = -1;
int uwp_get_width(void)
{
if (current_width != -1)
return current_width;
/* This function must be performed within UI thread,
* otherwise it will cause a crash in specific cases
* https://github.com/libretro/RetroArch/issues/13491 */
@ -1012,7 +1023,7 @@ extern "C" {
if (corewindow)
corewindow->Dispatcher->ProcessEvents(Windows::UI::Core::CoreProcessEventsOption::ProcessAllIfPresent);
}
current_width = returnValue;
return returnValue;
}