Search Unity

compute shader problem on android

Discussion in 'Shaders' started by Cybernoise, Jul 9, 2017.

  1. Cybernoise

    Cybernoise

    Joined:
    Apr 9, 2014
    Posts:
    5
    im sorry for my english, but i try :


    Greetings to all shader gurus. I've been fighting for a few days on a single task - there are 2 textures, we take 1, we conjure with it in a compute shader and put result it in 2 texture. In the editor, everything is fine, in the build on the PC too, but on the android through-time. Sometimes you see the desired result, sometimes psychedelic glitches, sometimes the desired result is mixed with glitches ... With SystemInfo.supportsComputeShaders everything is fine, enableRandomWrite is enabled, in the script all the rules are:

    _kernelID = computeShader.FindKernel(_name);
    computeShader.GetKernelThreadGroupSizes(_kernelID, out _kernelX, out _kernelY, out _kernelZ);
    computeShader.SetTexture(_kernelID, "result", outputTexture);
    computeShader.SetTexture(_kernelID, "inputTex", inputWebCamTexture);
    ...
    computeShader.Dispatch(_kernelID, width / (int)_kernelX, height / (int)_kernelY, (int)_kernelZ);

    compute shader code :

    Texture2D<float4> inputTex;
    SamplerState samplerinputTex;
    RWTexture2D<float4> result;

    #pragma kernel Red
    [numthreads(8,8,1)] void Red (uint3 id : SV_DispatchThreadID){
    result[id.xy] = float4(1.0, 0.0, 0.0, 1.0);
    }

    #pragma kernel Normal
    [numthreads(8,8,1)] void Normal (uint3 id : SV_DispatchThreadID){
    result[id.xy] = inputTex[id.xy];
    }

    can some one tell me why i have glitches on android ?