Search Unity

Is better compute shader support coming soon for Mac?

Discussion in 'macOS' started by gecko, Mar 30, 2019.

  1. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Compute shader support on Mac OSX seems to lag behind Windows. I know almost nothing about shaders, so this will be quite vague, in hopes that more knowledgable people will chime in. All I know is that some tools like Advanced Terrain Grass and Vegetation Studio Pro have options like Instanced Indirect and Compute to render lots and lots of grass more rapidly, and these work great on Windows, but are actually worse on Mac than the standard methods provided by those tools. (Maybe @larsbertram1 and @LennartJohansen can explain this better about their shaders...)

    Anyways, I'm wondering if this is due to limitations inherent in OSX (and thus Apple's fault), or if it's something that Unity can improve, and if so, does anyone know whether that's likely to happen soon.

    thanks
    Dave
     
    catfink likes this.
  2. catfink

    catfink

    Joined:
    May 23, 2015
    Posts:
    176
    I am also interested in the answer to this - many of us make cross platform products. Having to do significantly different things for different platforms in order to get performance is a workload I could do with, lets say "less of", as I doubt I'll ever get to do without it at all.
     
  3. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Unity compute shader support for macs using Metal is actually pretty good. For example I run a 3D fluid sim that makes very heavy use of compute shaders and the same Unity compute shader HLSL code has worked for a number of years on Windows and MacOS without me having to do anything. Performance is harder to compare as I have different graphics cards in my systems. But I had have the same card on both operating systems in the past and there was a difference but it wasnt an insanely bad difference, just the typical differences that have always meant macOS graphics performance overall wasnt up to the levels achieved by all the years of Windows DirectX & driver optimisations.

    Also a lot of macs dont have very good gpus to begin with. I get round this using an external gpu enclosure & thunderbolt 3, but there is some performance overhead for that too.

    Sorry to say your question is probably much too vague and non-technical, including a lack of info about what hardware you are using. For example Instanced Indirect is different to the compute shader stuff I just spoke of, perhaps there is a bottleneck there, or somewhere else, but there isnt with compute shaders in general so there will be no magic fix from Unity on the compute shader front. Or the performance issue is somewhere else in those assets you mention. I dont really know what to tell you, except for my own experience and other stuff like the fact it is perfectly possible to get good results using Unitys HDRP on the mac, and that makes extensive use of compute shaders.
     
  4. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Well, yeah, it's vague because I don't understand this stuff. But using Vegetation Studio Pro as an example: It offers Instanced Indirect method, which I believe uses compute shaders. On Windows, I get a significant speed increase when I switch to this method. On Mac, I get an enormous slowdown. Using 2018.3.9:

    * WIndows 10 with GTX 1060: Grass rendering takes 2-4ms with indirect.
    * Mac OS 10.13 with Radeon 580 eGPU: Well, since GPU profiling doesn't work on Macs, I have no detailed breakdown, but when I enable Indirect, FPS drops from 30+ to 2, and the Rendering thread (shown in the Stats panel) rises to at least 100ms, often 300 or more.

    This is a known issue (at least by Lennart and LarsBertram and VSP-Mac users), not just something on my end.

    Is this due to OSX drivers? Metal implementation (by Apple or Unity)? Something else? That's what I am hoping someone knows....and whether it's possible/likely to improve in the near future.
     
    PeterB likes this.
  5. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    Yup, Mac is pain in the ... GPU ... this is so frustrating; I doubt Apple will anytime soon support 'gamers'; sad.
     
  6. PixelJ

    PixelJ

    Unity Technologies

    Joined:
    Nov 1, 2018
    Posts:
    216
    This sounds like a possible bug. Mind reporting it?
    https://unity3d.com/unity/qa/bug-reporting
     
    gecko likes this.
  7. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    @PixelJ I've submitted a repro project, Case 1153743
     
    PixelJ likes this.
  8. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    @PixelJ Any news about that repro (Case 1153743)? I got an email back saying it was confirmed, and would be passed along to the development team, but nothing since then....
     
  9. PixelJ

    PixelJ

    Unity Technologies

    Joined:
    Nov 1, 2018
    Posts:
    216
    Devs know it exists, but it's not currently being worked on.
     
    PeterB likes this.
  10. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    366
    Are they planning to? If so, when?
     
    Lars-Steenhoff likes this.
  11. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Must be some backlog, I'm sure it going to be worked on
     
  12. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    366
    Well, that bug has been around for years, so I'm personally not holding my breath.

    There's also the similar issue of the use of tesselation being incompatible with terrain instancing.

    The Metal world is unfortunately still full of weird deviations from what one usually expects. Collectively, these things impel people to consider other platforms or to avoid the Mac entirely. Part of it has to do with Apple's choices, other with Unity's inaction – or shall we say, Unity's priorities.

    Also, these things are not always clear even to developers of high-end graphics products. I remember debating the indirect instance issue with the author of Vegetation Studio Pro, who wasn't aware of this particular consideration. I also reported that my instanced terrains simply vanished to the author of MicroSplat, who also had no idea of what was going on, despite the fact the he develops on a Mac. So these things are sometimes a mystery even to the "high initiates". It would be good if Unity brought uniformity and clarity to these issues, for there has been confusion for years now and people have spent many hours trying to find workarounds which simply do not exist.

    I should add that both authors now have disabled those features on the Mac platform. Too messy, too many problems, no documentation from Unity, no response when filing bug reports, I guess.
     
    Last edited: Sep 8, 2019