-
Notifications
You must be signed in to change notification settings - Fork 603
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
macOS: Apple Silicon support (interpreter only) #1255
base: main
Are you sure you want to change the base?
Conversation
I'll be honest, it will probably be a while until we have a decent ARM recompiler that will outperform Rosetta so this seems a bit early. But I generally don't want to stand in the way of adding new target platforms. That said, the changes made here are detrimental for other platforms. Just on a quick glance some obvious issues:
|
On OSX, C functions are compiled with a leading underscore and the header files define the ASM functions as a normal C function, resulting in functions being called with a leading underscore but defined without one.
Makes sense, I'll revert that and try something else
Ah, I wasn't sure but that's what I somewhat assumed. |
e9a00d3
to
0328901
Compare
6998fdd
to
ebb249c
Compare
…m64 rather than aarch64 cmake: Fix compiling for Apple Silicon
I've changed the range to accommodate for the Project Zero bug stated however I'm not sure if causes any other issues or if this is used, however it seems to work fine. Please correct me if true.
On Apple Silicon, PPCTimer estimates a terribily inaccurate RSTSC frequency and results in games (specifically tested Color Splash & MK8) run extremely fast especially in the title screens which unsurpisingly doesn't work that well. The value hardcoded is the same frequency as on Rosetta. Admittedly this probably isn't the best solution however it is accurate and it works.
"A MenuItem ID of Zero does not work under Mac"
Despite being disabled in InitBlendState, this still causes errors on MoltenVk, so just skip it altogether Seemingly fixes cemu-project#396 (there's a multitude of errors there in the comments, specifically referring to the issue), however I don't own BOTW and can't confirm
Apple seemed to not have offsets for arguments on the stack Either that or the offsets were just wrong, I'll test on a Linux VM and remove the conditonal if this still happens
For some reason, compiling with LLVM causes a segfault when any popup opens. This is specific to LLVM and works fine with the default compiler.
if (!_IsVkIntegerFormat(m_renderPassObj->GetColorFormat(0))) | ||
pipelineInfo.pColorBlendState = &colorBlending; |
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.
This should iterate each color attachment and when an integer format is used then disable blending only for that specific attachment. Having one color attachment in integer format does not prevent blending for all the non-integer attachments.
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.
Having one color attachment in integer format does not prevent blending for all the non-integer attachments.
I see how that could be an issue, however the main issue is that they are disabled, yet for some reason creating the pipeline on MoltenVk results in this error. The only other solution I could think of is to remove the color attachments entirely in InitBlendState
if they are integer formats, though I'm not sure how that could be done without massively rewriting the code for what appears to be an issue with MoltenVk.
I originally made it like this since, at least on MK8, only the first color attachment would ever be in integer format, and if it were, the rest followed by empty attachments, though I see that this wouldn't be the case for all games. Other than the potential solution above, I'm not sure how else to deal with this.
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.
I see. I don't want to chalk this down as a bug in MoltenVk yet because it seems to be too big of an oversight to me. I checked their code and I couldn't really see any logic that would enable blending if we didn't specifically ask for it. But more digging is required to understand this fully.
In the meantime an acceptable temporary workaround would be to disable all blending if ANY of the color attachments are integer format instead of only checking index 0. I also suggest making the workaround apply to MacOS/MoltenVk only.
Co-authored-by: Exzap <[email protected]>
This reverts commit 6b6a538. [skip ci]
Fixes #396(?), supersedes #1211 (I don't own BOTW and haven't been able to reproduce the issue on other games, but this fixes a similar error that only occurred on Apple Silicon)
The re-compiler hasn't been implemented and only the interpreter works. (and there's already an WIP aarch64 recompiler for cemu android, assuming that they plan on merging into this repo)