Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Serious Bug in computeshader on Vulkan,fail to copy data, data changed(Any workaround?)

Discussion in 'Shaders' started by TigerFudo, Dec 12, 2019.

  1. TigerFudo

    TigerFudo

    Joined:
    Nov 30, 2012
    Posts:
    27
    Fail in computeshader on Vulkan(in both player and editor),You can reproduce it with the attachment.

    1.The simple computeshader(BugShader.compute) in attachment is to copy data from one buffer to another.It works fine and corretly on DX11 and OpenGLES3,only encounter bug on Vulkan.
    When the data is simple native system type(int,float),it works fine,but if the data type is (float3,float4,int4..),it will fail.
    2. Open the DemoScene in attachment and run on Vulkan(both Editor and Player have the same bug).
    Left is the corret result(using float),right is the bug error(using float4)

    I have reported the bug:
    https://fogbugz.unity3d.com/default.asp?1201840_mras0im6r5lh184f

    Has anyone here ecountered the same issue? any workaround?

    Many thanks in advance.
     

    Attached Files:

  2. TigerFudo

    TigerFudo

    Joined:
    Nov 30, 2012
    Posts:
    27
    Code (CSharp):
    1. #pragma kernel CSMain
    2. RWBuffer<float4>  DestBuffer;
    3. [numthreads(3,1,1)
    4. void CSMain (uint3 id : SV_DispatchThreadID)
    5. {
    6.     DestBuffer[id.x] = float4(1, 1, 1, 1);
    7. }
    I just found ,even the simple fill value shader is also wrong. On vulkan ,you will get the result like this:
    error.PNG
     
  3. TigerFudo

    TigerFudo

    Joined:
    Nov 30, 2012
    Posts:
    27
    [Closed]Using RWStructuredBuffer instead. Thanks Ramojus.