SFML community forums

Help => Graphics => Topic started by: j.keller51 on December 18, 2020, 10:38:17 pm

Title: Possible issue with Apple M1 processor
Post by: j.keller51 on December 18, 2020, 10:38:17 pm
I'm not making an issue for this yet because I don't have access to a computer with Apple's new M1 processor, so I can't confirm 100% if the issue lies with SFML or not. But just something to keep an eye out for:

Users of my application on M1 are not seeing any graphics that are being drawn to an sf::RenderTexture. Everything drawn directly to the window seems to be working fine.
Title: Re: Possible issue with Apple M1 processor
Post by: j.keller51 on February 04, 2021, 02:54:38 am
I can confirm that the issue does not lie with SFML.

The max antialiasing level on M1 chips is 4, and my code was set to use 8. When I changed it to 4, all RenderTextures worked again (still compiled for x86_64 and run through Rosetta).

I went a step further and compiled my project for arm64 and it runs natively on the M1 flawlessly.
Title: Re: Possible issue with Apple M1 processor
Post by: eXpl0it3r on February 04, 2021, 09:26:55 am
I went a step further and compiled my project for arm64 and it runs natively on the M1 flawlessly.
Does that mean you also built SFML and its dependencies for arm64?
Title: Re: Possible issue with Apple M1 processor
Post by: j.keller51 on February 04, 2021, 04:04:20 pm
It does indeed! No changes to the source were required.
Title: Re: Possible issue with Apple M1 processor
Post by: j.keller51 on February 04, 2021, 06:07:09 pm
^ An addendum -- I had manually changed the build architecture through Xcode to arm64 and it worked without changing any source.

However, I wanted CMake to set the architecture automatically, so I set CMAKE_OSX_ARCHITECTURES to "x86_64;arm64". However, SFML's CMakeLists.txt is hardcoded to reject anything that is not x86_64 on Mac.

I made an issue for this:

https://github.com/SFML/SFML/issues/1749

For the time being, I just commented out the architecture check in the SFML CMakeLists in my local copy.
Title: Re: Possible issue with Apple M1 processor
Post by: unflippedbit on February 20, 2021, 04:34:37 am
I went a step further and compiled my project for arm64 and it runs natively on the M1 flawlessly.

Hey, thanks for this thread, I've been trying to run sfml on my new m1 macbook for a while with little success. I actually tried compiling directly to arm 64 like you said, but immediately got this: imgur.com/a/LrydYjM do you think I have the wrong libraries/dylink installed, or is the issue with my compilation settings? Sorry, I'm pretty new to all the C++ building processes. Thanks in advance.
Title: Re: Possible issue with Apple M1 processor
Post by: eXpl0it3r on February 20, 2021, 07:49:00 pm
The M1 chip uses a completely different architecture, as such you can't reuse existing library builds, but you have to recompile everything. You need to compile SFML from source and for that you need to compile all of SFML's dependencies from source.
Title: Re: Possible issue with Apple M1 processor
Post by: eXpl0it3r on March 23, 2021, 08:20:45 pm
Good news, I've just merged the dependency update PR (https://github.com/SFML/SFML/pull/1761), with that you should be able to use SFML on a device with an Apple M1 chip targeting arm64.

Additionally, a Mac Mini with an M1 chip has joined our CI fleet and is also publishing snapshot builds (https://artifacts.sfml-dev.org/by-branch/master/) for those who don't want to build from source.