yuzu icon indicating copy to clipboard operation
yuzu copied to clipboard

MacOS compatibility

Open VHRanger opened this issue 4 years ago • 88 comments

This PR revives PR #3593 and updates the code to up-to-date to changes in the intervening months. There is still work to do for MacOS to be playable especially on 3d games:

  • Fix macOS SDL frontend
  • Much more testing needed on games.

Here are some tips to build on a MacOS machine:

  • OSX version 10.14 or higher (this could be moved to 10.13)

Get Homebrew and run the following on command line:

brew install mbedtls
brew install zstd
brew install openssl
brew install gpm
brew install pkgconfig
brew install sdl2
brew install qt5 # note if you have a QT erorr do brew remove qt than brew install qt5
brew install cmake
brew install conan
git clone --recursive https://github.com/yuzu-emu/yuzu
cd yuzu
git submodule update --init --recursive

When building (from yuzu folder):

export Qt5_DIR=$(brew --prefix)/opt/qt5
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4

VHRanger avatar Jun 25 '20 20:06 VHRanger

This is nice. Thanks for reviving macOS Support. Intel Macs will still be supported for another 5-7 Years. Some people think macOS support isn't worth it because 1 Macbook Air will release in 2021 and that's the doom of Intel macs. but it just isn't. I hope this PR gets into master and official macOS support gets re-added. It would be a shame not to as it's working nicely.

Veemyu avatar Jun 25 '20 21:06 Veemyu

Can you upload a build i will do testing

Still needs some development before being in a state where we're actually testing on games. We're getting a lot of vulkan crashes at the moment.

VHRanger avatar Jun 25 '20 23:06 VHRanger

If 10.13.x support is possible, it would be great for NVIDIA gpu users since you can't install web drivers for newer cards past that

Morph1984 avatar Jun 27 '20 15:06 Morph1984

If 10.13.x support is possible, it would be great for NVIDIA gpu users since you can't install web drivers for newer cards past that

Sadly it seems that trying to build for MacOS 10.13 raises this compilation error:

/yuzu/src/video_core/memory_manager.cpp:84:54: error: 'value' is unavailable: introduced in macOS
      10.14
               .UnlockForDeviceAddressSpace(cpu_addr.value(), size)

I can try to investigate a fix at a later point but I'm still unfamiliar with the codebase to see if it's feasible and would rather focus on getting it to run 3d games first.

On the other hand, 10.15 supports additional Vulkan features because it's on metal 3. So it's better to pin the build against the minimal supported version (to avoid maintaining branching feature sets if possible)

VHRanger avatar Jun 27 '20 18:06 VHRanger

I‘m so exited for that! But will it work with Catalina or BigSur? Or is that impossible do to deprecation?

iMonZ avatar Jul 15 '20 09:07 iMonZ

If it works for 10.14 (the minimum target) it should work for 10.15. Not sure about Big Sur.

We're currently getting a lot of crashes due to shaders not compiling correctly. I'll only have time to dig into it more next week.

VHRanger avatar Jul 15 '20 13:07 VHRanger

10.15 got a lot of deprecation like with 32 bit Code can’t be executed and Wine also doesn’t work anymore (I think OpenGL does also not work anymore) And 10.16 (or 11) deprecated a lot of kernel extension types so VirtualBox is currently not working anymore! Maybe Yuzu is using one of this Tools

Am 15.07.2020 um 15:03 schrieb Matt Ranger [email protected]:

 If it works for 10.14 (the minimum target) it should work for 10.15. Not sure about Big Sur.

We're currently getting a lot of crashes due to shaders not compiling correctly. I'll only have time to dig into it more next week.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

iMonZ avatar Jul 15 '20 13:07 iMonZ

Hey! Did you get further with the MacOS Support?

iMonZ avatar Jul 16 '20 13:07 iMonZ

Hi,

I haven't had time to work on it, I'm swamped with my normal work.

You'll see here when I have time to start working on it again.

The problems at this point are mainly some vulkan shaders refusing to compile. I'm not sure where those errors are coming from.

VHRanger avatar Jul 22 '20 17:07 VHRanger

Hi @VHRanger! Really appreciate the work being done here! Excited for the changes that you have in store for this pull request. Also, you probably won't need my help but let me know if you do! :-)

jakejaylee123 avatar Aug 11 '20 15:08 jakejaylee123

hey, anything new? Yuzu on Apple silicon would be really great! I would definitely help when I could!

iMonZ avatar Sep 20 '20 11:09 iMonZ

Hi again @VHRanger! I forgot to mention I'm getting the refusing to compile error too.

(Disclaimer: the following sentences are coming from a noob programmer that only programmed in C++98 back in college, circa 2014)

Calls (not sure if it's some, most, or all) to the 'vkCreateGraphicsPipelines' function returns a 'VK_ERROR_INVALID_SHADER_NV,' which goes back to your comment about the shaders refusing to compile. To get the actual errors I had to turn on Vulkan's 'VK_EXT_debug_report' extension. I attached the part of my yuzu_log that shows the actual errors that were logged after getting that extension working. I also grepped the immediate errors that were in the log (also attached).

Looks like all the errors are either ambiguous calls to some functions or disallowed conversions from 'bool' to 'int/uint'. Not sure if you got this far but thought I should mention. Will investigate further. This is actually fun! Let me know what you think.

yuzu_log.txt yuzu_log_shader_compile_errors.txt

jakejaylee123 avatar Oct 12 '20 00:10 jakejaylee123

Thanks @jakejaylee123 !

I haven't had time to work on this in the last 2 months due to being swamped with work and life, but this helps a lot. I'll try to put some work in this week.

Most of the time the shaders compiled last I looked at them, but we were missing some draws and the performance was absolutely horrid (which shouldn't be since it isn't in Dolphin and LoL which both use the moltenVK pipeline).

VHRanger avatar Oct 13 '20 11:10 VHRanger

Thanks @jakejaylee123 !

I haven't had time to work on this in the last 2 months due to being swamped with work and life, but this helps a lot. I'll try to put some work in this week.

Most of the time the shaders compiled last I looked at them, but we were missing some draws and the performance was absolutely horrid (which shouldn't be since it isn't in Dolphin and LoL which both use the moltenVK pipeline).

Hey! Any new news? It would be great if you could commit your updated work so I can try to compile! Thank you

iMonZ avatar Nov 04 '20 07:11 iMonZ

Hey @VHRanger,

is an OpenGL yuzu implementation with Zink possible? https://www.collabora.com/news-and-blog/blog/2018/10/31/introducing-zink-opengl-implementation-vulkan/ https://www.phoronix.com/scan.php?page=news_item&px=Zink-macOS-OpenGL-Vulkan

iMonZ avatar Nov 10 '20 14:11 iMonZ

As far as I'm aware, Zink still relies on the Mesa internals for presentation.

K0bin avatar Nov 10 '20 15:11 K0bin

Thanks @jakejaylee123 !

I haven't had time to work on this in the last 2 months due to being swamped with work and life, but this helps a lot. I'll try to put some work in this week.

Most of the time the shaders compiled last I looked at them, but we were missing some draws and the performance was absolutely horrid (which shouldn't be since it isn't in Dolphin and LoL which both use the moltenVK pipeline).

Hi @VHRanger! Ah, looks like things got a little hectic for me too with work. You'd think the opposite would be happening around this time of year. But it's cool to know that at least most of the shaders compiled! For my particular situation it looks like there were problems when the shaders get converted to Metal, but I have to continue looking to confirm that. Hopefully more updates to come!

jakejaylee123 avatar Dec 02 '20 17:12 jakejaylee123

Hey, can you try to use a more recent version of MoltenVK? Maybe this will fix some issues

iMonZ avatar Dec 13 '20 20:12 iMonZ

Hey, can you try to use a more recent version of MoltenVK? Maybe this will fix some issues

Yeah I saw dolphin moved to 1.1 in their latest update. I'll give it a try as soon as I have a break, it should be a quick win if anything.

VHRanger avatar Dec 13 '20 22:12 VHRanger

Hey, can you try to use a more recent version of MoltenVK? Maybe this will fix some issues

Yeah I saw dolphin moved to 1.1 in their latest update. I'll give it a try as soon as I have a break, it should be a quick win if anything.

Sounds great!

yuzu.zip (compiled with the old MoltenVK version ) The good news is that I can get into the loading screen in Superliminal

So game like Mario odyssey doesn't start at all: https://pastebin.com/Q6zGnsmL

But with Superliminal I can go into the loading screen but after that I will get a crash too: https://pastebin.com/Kh3NshxK

iMonZ avatar Dec 16 '20 09:12 iMonZ

emmmm, I get a CMakeOutput.log file when I use 'cmake .. -DCMAKE_BUILD_TYPE=Release' on MacOs 10.13.6, this log is too long, I can't find Specific error

xiaoweiQ avatar Dec 22 '20 02:12 xiaoweiQ

emmmm, I get a CMakeOutput.log file when I use 'cmake .. -DCMAKE_BUILD_TYPE=Release' on MacOs 10.13.6, this log is too long, I can't find Specific error

Yeah it doesn't build on 10.13 sadly, because apple's C++ compiler on that version of MacOS is missing a couple of features used in the codebase.

The minimum target version is 10.14 right now

VHRanger avatar Dec 22 '20 04:12 VHRanger

Have you guys heard about this project? https://github.com/daeken/PsychopompNX

https://9to5mac.com/2020/12/22/nintendo-switch-games-have-been-successfully-emulated-on-m1-macs/

oresttokovenko avatar Dec 22 '20 18:12 oresttokovenko

Have you guys heard about this project? https://github.com/daeken/PsychopompNX

https://9to5mac.com/2020/12/22/nintendo-switch-games-have-been-successfully-emulated-on-m1-macs/

Nope, seems interesting. I'm getting my wife a m1 macbook for christmas so in 2021 I'll get to try to compile Yuzu for apple silicon :)

VHRanger avatar Dec 22 '20 18:12 VHRanger

Have you guys heard about this project? https://github.com/daeken/PsychopompNX https://9to5mac.com/2020/12/22/nintendo-switch-games-have-been-successfully-emulated-on-m1-macs/

Nope, seems interesting. I'm getting my wife a m1 macbook for christmas so in 2021 I'll get to try to compile Yuzu for apple silicon :)

This sounds really great!

Maybe sometimes in the future it would be possible to play Switch games on IOS.

But now when it runs on macOS Intel or Silicon this is just amazing!

iMonZ avatar Dec 22 '20 19:12 iMonZ

If you guys continue to do such great work with MoltenVK and Yuzu I imagine the M1 Systems to be one of the Fastest Systems one can run Yuzu on, or at least very similar to high end Desktops, but it still depends on the GPU Performance as MoltenVK even very optimised is still not 100% Optimal. Did they even include any changes to the Yuzu Renderer from this Fork in the Demo seems like they didn’t?

Veemyu avatar Dec 22 '20 20:12 Veemyu

I talked to the person who made this demo, it's based off a fork of Yuzu, but uses hypervisor.framework instead of CPU emulation.

They still use MoltenVK for GPU but apparently they plan to switch to a pure metal backend (godspeed to them in that effort!)

VHRanger avatar Dec 22 '20 22:12 VHRanger

My goodness, native Metal would be a godsend but also terribly difficult as Documentation is still Willy nilly. It's high risk and effort but also High reward. Even the dolphin team gave up on a pure Metal Backend, although the Wii obviously needs less GPU Features than the Switch so MoltenVK is easier and performs ok but it's still sad they didn't continue with the Metal Backend.

Veemyu avatar Dec 22 '20 22:12 Veemyu

Hey, I'm trying to build on my MacBook, but I'm receiving this error on make step:

[ 59%] Building CXX object externals/dynarmic/src/CMakeFiles/dynarmic.dir/backend/x64/exception_handler_macos.cpp.o
[ 59%] Building C object externals/dynarmic/src/CMakeFiles/dynarmic.dir/backend/x64/mig/mach_exc_server.c.o
[ 59%] Linking CXX static library libdynarmic.a
[ 69%] Built target dynarmic
[ 77%] Built target video_core
[ 77%] Built target audio_core
[ 95%] Built target core
src/tests/CMakeFiles/tests.dir/build.make:221: *** target pattern contains no `%'.  Stop.
make[1]: *** [src/tests/CMakeFiles/tests.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 96%] Built target input_common
make: *** [all] Error 2

What do I need to do? Did I forget anything?

cc @Morph1984 @german77

macabeus avatar Dec 28 '20 01:12 macabeus

Hi guys first of all I would like to thank you for all the efforts you put in to bring this magnificent emulator that is the Yuzu to the abandoned Mac platform Let's come to the topic: I tried to compile this branch to test the emulator on my Mac and got this error, Here is my configuration: MacBook Pro 16.1, intel i7 processor, 16Gb RAM, AMD Radeon Pro 5300M, The error log file and attached to my answer ... hope I helped you with my feedback, Good luck CMakeError.log CMakeOutput.log

PlatinumTsuki avatar Jan 03 '21 21:01 PlatinumTsuki