Skip to content

Commit

Permalink
UWP 4K fix: align MESA reading of ClientRect to retroarch procedure, …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
e.canepa committed May 13, 2024
1 parent 47499d3 commit 45c43d1
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/msvc-uwp/RetroArch-msvcUWP/MESA/README.md
Original file line number Diff line number Diff line change
@@ -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.
Binary file modified pkg/msvc-uwp/RetroArch-msvcUWP/MESA/x64/libEGL.dll
Binary file not shown.
Binary file modified pkg/msvc-uwp/RetroArch-msvcUWP/MESA/x64/libGLESv2.dll
Binary file not shown.
Binary file modified pkg/msvc-uwp/RetroArch-msvcUWP/MESA/x64/libgallium_wgl.dll
Binary file not shown.
Binary file modified pkg/msvc-uwp/RetroArch-msvcUWP/MESA/x64/libglapi.dll
Binary file not shown.
Binary file modified pkg/msvc-uwp/RetroArch-msvcUWP/MESA/x64/opengl32.dll
Binary file not shown.
Binary file modified pkg/msvc-uwp/RetroArch-msvcUWP/MESA/x64/z-1.dll
Binary file not shown.
13 changes: 12 additions & 1 deletion uwp/uwp_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -1012,7 +1023,7 @@ extern "C" {
if (corewindow)
corewindow->Dispatcher->ProcessEvents(Windows::UI::Core::CoreProcessEventsOption::ProcessAllIfPresent);
}

current_width = returnValue;
return returnValue;
}

Expand Down

0 comments on commit 45c43d1

Please sign in to comment.