Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

M1 and Metal vs Rosetta and OpenGL - Rosetta / OpenGL wins easily

Discussion in 'macOS' started by catfink, Aug 31, 2021.

  1. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    176
    My game can run on M1 native or it can run Rosetta using Metal or OpenGL.

    Testing FPS between these two builds and M1 native with Metal is close to 100 fps SLOWER.
    Additionally Rosetta on Metal goes almost the identical fps - so running native apple silicon gains nothing.

    Rosetta OpenGL I get an extra 100 fps and not only that it is much much smoother and performant. Where as Metal is stuttery and horrible as well as being much slower.

    So I don't get it - what is the point of Apple Silicon support and Metal if it's worse performance than running Rosetta and OpenGL. I mean it is the exact opposite of what I expected and by a huge margin - how can this be?
     
  2. Deleted User

    Deleted User

    Guest

    Interesting; I wonder how you get more than 60 fps on M1. Referring to this. How do you test that ?
    I'd love to compare on mine if you have any sample project to share ? Thanks
     
  3. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    176
    I'm not using a Mac Mini - using a M1 Macbook Air
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    Are you sure you're running on OpenGL? I'm pretty sure we force disable it on Apple silicon devices, even when running on Rosetta. What does the player log say?

    Also when you say 100 fps slower, is it like from 120 fps to 100 fps? Or 1200 fps to 1080 fps?

    Lastly, what kind of stutters are those? Are they from bad frame pacing? Or just low frame rate?
     
  5. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    176

    Yes I am sure, we have the option on our game launcher to switch between Metal/OpenGL and the differences are so obvious in terms of the performance, plus you can see the library loaded in the log file.

    If you build for Mac Intel 64 then OpenGL will function no problem on an M1 Mac. If you select any build type that involves apple silicon then you are locked to Metal (even if you select OpenGL in our game launcher).

    On OpenGL on a M1 Macbook air I get between 150 and 200fps in our game, if I switch to Metal I get 80-100fps. The difference in how smoothly it runs is also very marked, running OpenGL the movement is very smooth as you would expect, on Metal there are pauses and jitter to the motion and it is anything but smooth. The frame rate monitor isn't showing big changes in the fps, it seems to be reasonably consistent (varying slightly as you would expect) but even with vysnc on that stutter and jitter still remains.

    No errors going to the log in either version - so the stutter and jitter is purely related to switching the graphic library.

    This is using Unity 2020.3.8
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    Can you report a bug for that stutter/jitter? Does it also stutter when you enable vsync?

    It's weird that OpenGL works for you, as a year ago when I was bringing the platform up it would just crash. But you're right, I just checked code and it's only force disabled if the app is compiled as ARM64 or you're running the editor on rosetta. Running the player on Rosetta will allow the "-force-opengl" flag to work.
     
  7. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    176
    I will be asked for a recreation project and this is a huge project (300gb+) for a commercial game - so I can never provide what is asked for when reporting a bug. All I can do is tell you there is an issue here.

    And yes the stutter/jitter is there with vsync as well. But not at all with OpenGL enabled.
     
  8. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    176
    I could provide a development build with profiling enabled if you want to look at it from a performance profiler. But I think that's probably the best I can do.
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    While some jitter/stuttering is expected when running with vsync disabled (as metal doesn't really play nice with that), jittering with VSync enabled is a totally different scenario. Have you tried logging Time.deltaTime values to see if they come out uneven? Have you tried filming the build with a slow-motion camera (any smartphone would do) to see if it's actually the frames show up on the display at an uneven rate, or whether the objects move uneven amount even if the frames are actually evenly spaced out?
     
  10. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    176
    Well I rebuilt the game using Mac Intel64 as the target - here it is completely smooth with vsync turned on and using Metal. So the issue seems to be that I only see the problem when making a build that is for Mac interl64 + Apple silicon - then it is stuttering with Metal with vsync on or off.

    I have not tried just building for apple silicone only.

    I should also add that vsync off on metal is not that smooth on the intel 64 build - as you indicated but this has always been the case. OpenGL is much better vysnc off and very smooth.
     
    Last edited: Sep 2, 2021