I’m writing to RWTexture2D texture in a compute shader. It corresponds to a RenderTexture on cpu side. It works on Windows with DX11, but doesn’t work on MacOS with Metal.
I’m using Unity 2017.2.0f3
Shader code:
RWTexture2D<float4> textureOut;
#pragma kernel pixelCalc
[numthreads(8,8,1)]
void pixelCalc (uint3 id : SV_DispatchThreadID){
textureOut[id.xy] = float4(1, 1, 1, 1);
}
Releveant parts of cpu side code:
outputTexture = new RenderTexture(1024, 1024, 32);
outputTexture.enableRandomWrite = true;
outputTexture.Create();
outputImage.material.mainTexture = outputTexture; // this is just an image I use to visualize the renderTexture on
_shader.SetTexture(kiCalc, "textureOut", outputTexture); // _shader is a prepared ComputeShader object
_shader.Dispatch(kiCalc, 32, 32, 1);
Does anyone have any idea, why doesn’t it work on Metal, or how to make it work?