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

Have anyone managed to make Compute Shaders work on Macs?

Discussion in 'macOS' started by Zolden, May 24, 2017.

  1. Zolden

    Zolden

    Joined:
    May 9, 2014
    Posts:
    141
    Unity 5.6 release notes say compute shaders can now work with Metal.

    I wrote a simple project, that uses compute shader to render a fractal. And tried to run it on Mac. It didn't work. The app started, but compute shader related part doesn't seem to render anything.

    Here's a test project: https://drive.google.com/open?id=0B22OLebalqvJQzBCUVFkLUtmYjA

    I'd like to ask Mac users to run it and confirm if it works or not. If it works, you should see something like this: http://i.imgur.com/YqwA1Lz.png

    Also: have anyone tried to compile compute shader related project to Mac and manage to make it work?
     
  2. Zolden

    Zolden

    Joined:
    May 9, 2014
    Posts:
    141
    I tried to use unity 2017 to build a project that utilizes compute shader for Metal. And it doesn't work again. Is there a solution? Have anyone tried and succeeded in making compute shader work on Mac?
     
  3. trepan

    trepan

    Joined:
    Feb 11, 2011
    Posts:
    113
    I just tried your app and: nope, not working for me either.

    It's pretty dismaying that a feature that has been proclaimed as working for a couple of major releases now is very clearly NOT working in simple test cases and with no acknowledgement of that fact from Unity :(
     
    Zolden likes this.
  4. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I have had a number of different compute shaders working fine on macOS ever since the first metal compute shader support came out in beta.

    Not everything works, and it can be hard to find the cause when some stuff does not work. There are also differences between metal in different versions of macOS, so I usually try to update as soon as possible (eg I'm on High Sierra now). Metal editor mode also has some issues at times, which don't always affect the build versions. Also sometimes the non-compute shaders in a project that was originally designed for platforms like DX11 have issues with metal because you have to make sure those shaders have the right pragma target (eg 4.5 not 5.0).

    So I'm afraid the devil is very much in the detail on this one.
     
  5. Zolden

    Zolden

    Joined:
    May 9, 2014
    Posts:
    141
    Hey elbows, thanks for answering, not much people seem to be into this area.

    Could you please bring any examples of what caused compute shader fail in your experiments? Some specific commands?

    Also, do you have any idea, what does the fact compute shader doesn't always mean? Is it because metal API has some differences with directX API? Or it's rather because Unity compiles something incorrectly?

    Btw, when I tried to build for Vulkan, the compiler complained on some commands, like if Vulkan has different requirements. Don't you have any experience with compute shader on Vulkan to share?
     
  6. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    No Vulkan experience I'm afraid.

    No specific commands either - the only compute shader stuff I've written myself works. It's certain projects that were originally for DX11 that are on GitHub or the asset store that I have had problems with, and they are often too large and complex for me to narrow down the problem area.

    I have seen warnings in the console that sometimes give clues, next time I get one I will post it here as an example. Other errors give no obvious clues and result in either missing visuals or even hard computer crashes (eg some scenes in the asset store item called TC particles).
     
    Zolden likes this.
  7. Zolden

    Zolden

    Joined:
    May 9, 2014
    Posts:
    141
    Alright, thank you. Good to know something works for you, I'll resume the experiments then.