Is there any way to get ComputeShaders working on an OSX device? Here's the hardware of my machine (if it matters); - MacBook Pro (Retina, 13-inch, Late 2013) - 2.8 GHz Intel Core i7 - 8 GB 1600 MHz DDR3 - Intel Iris 1536 MB If there's not a way to directly get this functioning properly, is there a way to virtualize GPU threads for the sake of developing while mobile?
While the hardware used in Macs have had support for OpenGL computer shaders for a few years, OSX itself does not. Compute shaders are a core feature of OpenGL 4.3 and later, but OSX only has support for OpenGL 4.1. The only way to use OpenGL compute shaders on a Mac is to install Windows. Alternately the Unity 5.6 beta has support for Apple's Metal graphics API with compute for both OSX and iOS.
I'm trying to run the ComputeBuffer on the beta, still getting the same "not supported" error. Is the metal API accessed differently than a typical ComputeBuffer call?
By default the editor runs in OpenGL mode, you likely have to force enable Metal via a command line, though I do not know what that command line argument is. I don't have a Mac. It should be listed here, but the document hasn't been updated yet.
I found that I could enable metal by modifying the build settings. After doing, this, however, trying to declare a ComputeShader object freezes unity forever.
Could you solve the problem? I set the Mac Graphics API in the player settings to metal and still get this error, when dispatching a compute shader kernel: "Platform does not support compute shaders" The kernel can't be found as well in a script: computeShader.FindKernel ("CSXX"); => "Kernel 'CSXX' not found" When I click on the ComputeShader file in the Editor, the Inspector shows the kernels correctly: Kernels: CSXX Metal OpenGLCore (Unity 5.6 b5)
It is not enough to just select Metal as the API - you also need to tick the box in Player settings that enabled Metal support in the Unity editor.
Are GetData calls non-blocking in iOS due to the GPU and CPU memory being shared? Will Unity still make a copy of the object to support its internal pipeline?
I did this and now the Unity Editor freezes forever like radicalEd described it before. When I build the app and run it, it won't freeze, but the compute shaders aren't executed as well. So this might be a bug in the beta?
If you still have those sorts of issues with latest beta of Unity 5.6, I would recommend posting about your experience in the following thread in the beta forum: https://forum.unity3d.com/threads/metal-editor.450548/ Some bugs/isues probably are hardware/vendor/driver specific so always best to mention that sort of thing. macOS version matters too - only Sierra is supported properly as far as I was told, though I cant remember if that applies to both editor and runtime or just editor metal mode.
Hi! Looking into porting a current project using ComandBuffers on Windows to iOS and Metal Graphics API. I have had some issues and come to the conclusion that the editor hangs when adding a command buffer to a camera. Right now I have no clue what can be the problem more than it is when setting the commmandbuffer to the camera. Okay I managed to track the issue down a bit further to this line: commandBuffer.DispatchCompute(computeShader, kernelIndex: 0, threadGroupsX: 1, threadGroupsY: 1, threadGroupsZ: 1); Edit: Realized it was one of the bug fixes to the Unity 2017.2. However it didnt solved my issue. I have narrowed it down to that the issue appears when I'm modifying a float inside in a manner similar to this: void kernel(....){ float counter for(){ if(condition){ counter++; } } bufferOut = counter; } Any ideas on why this happens? Moving it outside of the if (in the for ) works...
No clue, but FYI, I'm running OSX with Metal enabled both for the graphics API and the editor and I'm still getting the "Platform does not support compute shaders" error running Unity 2018.1.0f2.
Compute Shaders have worked on the mac with Unity using Metal graphics API for a long time now. If it isnt working for you then its either a bug or you dont have suitable mac hardware or macos version or are using a really old version of Unity or some setting is wrong or your compute shader code has issues.
I have everything up to date, but I think that the shader I was using wasn't made for metal or something. My intereste was mostly for particle systems though (inspired by the development of Tonandi on magic Leap), but in the meantime someone told me that shader graph supports GPU based particle systems as well. So I guess I don't need to learn compute shaders after all
The Unity VFX Graph for the HDRP is a modern GPU particle system. https://unity.com/visual-effect-graph Its been a little while since I used it on a mac but it certainly worked when I tried it.