New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Vulkan/MoltenVK on macOS yet again #8666
Merged
Merged
+41
−32
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We need this because we need to pass the layer to MoltenVK, not the view handle. But the input subsystem still needs the window.
Again, needed for MoltenVK.
Gets rid of the warning for calling [NSView layer] off the main thread.
This is related to https://bugs.dolphin-emu.org/issues/10958 which uses Qt to clear out the window so the game list isn't displayed while the core is booting. Instead, we use the video backend to render a black screen, which means Qt doesn't have to flip between paint engines.
We no longer need this since the video backend handles clearing the window, and it fixes MoltenVK with Qt 5.14.
spycrab
approved these changes
Mar 11, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM
|
Working as advertised. The delay is barely noticeable. Thank you. |
|
Well done! I confirm that it fixes issue #12002. |
kemenaran
added a commit
to kemenaran/dolphin
that referenced
this pull request
Apr 5, 2020
Since dolphin-emu#8666, when running Dolphin using gfx-portability instead of MoltenVK, it crashes with an exception: ``` $ LIBVULKAN_PATH=/usr/local/lib/libportability.dylib /Applications/Dolphin.app/Contents/MacOS/Dolphin 2020-04-05 21:05:53.416 Dolphin[73210:890862] -[CAMetalLayer layer]: unrecognized selector sent to instance 0x7fa0be67a710 2020-04-05 21:05:53.436 Dolphin[73210:890862] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CAMetalLayer layer]: unrecognized selector sent to instance 0x7fa0be67a710' *** First throw call stack: ( 0 CoreFoundation 0x00007fff30a16acd __exceptionPreprocess + 256 1 libobjc.A.dylib 0x00007fff5b11aa17 objc_exception_throw + 48 2 CoreFoundation 0x00007fff30a908d6 -[NSObject(NSObject) __retain_OA] + 0 3 CoreFoundation 0x00007fff309b893f ___forwarding___ + 1485 4 CoreFoundation 0x00007fff309b82e8 _CF_forwarding_prep_0 + 120 5 libportability.dylib 0x000000010c315758 _ZN17gfx_backend_metal8Instance26create_surface_from_nsview17h127760c1704de68dE + 72 6 libportability.dylib 0x000000010c284cff _ZN15portability_gfx5impls24gfxCreateMacOSSurfaceMVK17h9f931ad376c6842eE + 207 7 Dolphin 0x00000001009c8fd1 _ZN6Vulkan9SwapChain19CreateVulkanSurfaceEP12VkInstance_TRK16WindowSystemInfo + 65 ) libc++abi.dylib: terminating with uncaught exception of type NSException ``` This seems to be because `vkCreateWin32SurfaceKHR` expects an NSView (per the documentation), but after dolphin-emu#8666 it receives a CAMetalLayer. This PR fixes the crash by passing the CAMetalLayer-backed NSView instead.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Well, this was a fun debugging experience. At least it wasn't as borked as the last time.
Basically, the auto-fill-background stuff changing out paint engines broke on Qt 5.14. I'm swapping this out with a better method - letting the graphics backend take care of clearing the screen instead. The downside is there will be a slightly longer delay before it is cleared as the graphics API needs to initialize, but it's much cleaner code-wise.
It also now passes the layer to MoltenVK instead of the view, which prevents
[NSView layer]from being called off the main thread. Which currently is just a warning, but with the way Apple seems to be going at some point in the future it'll probably become an error, and cause Dolphin to crash, so better safe than sorry.... hopefully this stays working for a while this time. I don't like debugging Mac issues :(