libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
9.78k stars 1.78k forks source link

[Bounty Feature Request] Add MESA D3D12 & DOZEN Transition Layers to UWP for OpenGL & Vulkan on DirectX 12 #13462

Open danprice142 opened 2 years ago

danprice142 commented 2 years ago

Add support for Mesa to UWP this would allow Xbox One and Series Consoles to use OpenGL & Vulkan within UWP

https://www.phoronix.com/news/Microsoft-OpenGL-4.6-D3D12

https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14881

https://www.phoronix.com/scan.php?page=news_item&px=Mesa-Dozen-VLK-D3D12

https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14766

Bounty https://app.bountysource.com/issues/106702284-bounty-feature-request-add-mesa-d3d12-dozen-transition-layers-to-uwp-for-opengl-vulkan-on-directx-12

Mesa Release Notes https://docs.mesa3d.org/relnotes.html Compiling and Installing Docs https://docs.mesa3d.org/install.html https://github.com/pal1000/mesa-dist-win#installation-and-usage

I plan to keep adding to this bounty as and when I can I plan to keep adding to this bounty as and when I can

danprice142 commented 2 years ago

https://app.bountysource.com/issues/104542830-feature-request-replace-angle-with-mesa-d3d12

hizzlekizzle commented 2 years ago

mesa d3d12 instead of ANGLE sounds very promising.

I tried using that gfx-rs/portability lib awhile back and it's enough vulkan to get the menus and shaders working but not enough for any of the vulkan-dependent cores, unfortunately.

I don't have a Windows machine here, but would you mind testing whether the prebuilt 'openGLon12.dll' from here (https://github.com/pal1000/mesa-dist-win/releases/download/21.3.3/mesa3d-21.3.3-release-msvc.7z) can replace the existing OpenGL lib with a rename-and-replace?

danprice142 commented 2 years ago

I just got this email from Jessie Natalie about the Mesa drivers.

No, neither of these would currently work with UWP.

The primary reason is that neither Khronos API has extensions to initialize the winsys on top of the UWP core window infrastructure. In theory, you could initialize Dozen for offscreen rendering and then explicitly marshal the contents out – that would probably work actually. There’s 2 more gotchas there though: The ICD loaders (OpenGL32.dll, Vulkan-1.dll) are not available in the UWP environment. You could explicitly use the non-ICD version of GL (i.e. Mesa’s OpenGL32.dll from the libgl-gdi target), include the open-source Vulkan ICD loader, or use the ICD version of either (OpenGLOn12.dll/libgallium_wgl.dll for GL – I plan to delete the former at some point and just use the latter at some point; vulkan_dzn.dll for VK). There’s not currently extensions for D3D12 interop either spec’d or implemented.

There’s one more problem for GL that I don’t think is problematic for VK, which is that it uses APIs that are banned from the UWP environment, specifically around inserting window hooks for Win32 framebuffer lifetime management. So you’d probably have to build a custom version that has all of that stuff stripped out to get it to be shippable in a UWP.

We (Microsoft) don’t really have plans to add this kind of stuff, at least not in the near future, but I’d be open to accepting contributions that enable this.

hizzlekizzle commented 2 years ago

Sounds like some pretty major roadblocks, but that's really cool of them to provide such a detailed answer and to keep the door open for contributions.

danprice142 commented 1 year ago

If anyone would like to keep a eye or join in on the discussion about Mesa on UWP for Xbox One & Series Consoles check out the Mesa mailing list https://www.mail-archive.com/mesa-dev@lists.freedesktop.org/msg224324.html

UltraHDR commented 1 year ago

Might help but needs to be enabled for UWP

d3d12: Add support for Xbox GDK https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19022

colbsmcdolbs commented 1 year ago

@UltraHDR It looks like that PR got merged 2 weeks ago! I'm not the most knowledgeable on graphics libraries, but would sweet to get Yuzu running.

colbsmcdolbs commented 1 year ago

Oh actually I see that is only for the GDKX package that you have to buy from Microsoft.... Why are we stuck with this deprecated UWP API.....

Simp-ARMx64 commented 5 months ago

Just passin' here to say that someone actually managed to run the Mesa Gallium driver on the uwp platform (Xbox too):

https://github.com/aerisarn/glxgears-uwp