**I am trying to use [this asset][1] to test out a compute shader on android**, that allows texture modification. I'm new to shaders, I could have misunderstood or not realizing some kind of limitation on mobile. I had assumed since the editor (while under android platform) worked that it would just work on android. I have tested this in the editor, on android platform, with opengl 3.1 as min graphics API, disabled the graphics emulation, and the asset works as expected. Player settings like this:
![alt text][2]
When testing it on android, the asset caused a force close on Unity 5.4, and on 5.5, it would complain about "*Kernel at index 0 is invalid*" when I ran the code the same as in the editor. If I modify the shader code by commenting out a section where it assigns to a RWTexture2D, then the error goes away, but obviously nothing is drawn to the screen.
This is a snippet of code to describe the problem area (cannot share complete code, its asset from asset store):
#pragma kernel pixelCalc
RWTexture2D textureOut;
[numthreads(32,32,1)]
void pixelCalc (uint3 id : SV_DispatchThreadID){
// some stuff happens here...
while (itn < 255 && d < 4){
// calculations and stuff...
itn++;
}
if (itn == 256) // if this line and 3 below it are commented out, runs on android!
textureOut[id.xy] = float4(0, 0, 0, 1);
else
textureOut[id.xy] = colors[itn];
}
**Hope somebody can confirm that RWTexture2D on a compute shader should work or not on android?** Has anybody had this error and found a way to make it work on android?
[1]: https://www.assetstore.unity3d.com/en/#!/content/72649
[2]: /storage/temp/83658-b8b256d68784a6cdb751453836cd2dee.png
↧