Search Unity

GraphicsFence for Metal?

Discussion in 'General Graphics' started by ecurtz, Feb 11, 2020.

  1. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    640
    Is there any chance GraphicsFence will be supported on Metal in the 2020 release cycle? AFAICT it's basically impossible to use Compute Shaders together with Rendering on Metal because there's no way to wait for them to finish (and no way to even query if they have finished for that matter). The automatic resource locking doesn't seem to work either, presumably for the same reason.
     
  2. slime73

    slime73

    Joined:
    May 14, 2017
    Posts:
    107
    GraphicsFence is just for async compute (i.e. a rendering CommandBuffer run via ExecuteCommandBufferAsync and friends) - if you use ComputeShader.Dispatch/DispatchIndirect or CommandBuffer.DispatchCompute on a non-async CommandBuffer, it won't be useful to you.

    Ordering of non-async compute dispatches is guaranteed, and if that's not the case it sounds like there might be a bug in Unity. They'll probably want a project that can reproduce the issue, if so.
     
  3. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    640
    I was in fact trying to use it with ExecuteCommandBufferAsync, but admittedly that was only out of desperation after trying everything else I could think of to force it to complete before the buffer was used for rendering.
     
  4. slime73

    slime73

    Joined:
    May 14, 2017
    Posts:
    107
    How are you determining that it's not completing before rendering?
     
  5. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    640
    I'm doing skinning calculations and if I calculate the buffer in the Compute Shader it has random "flickering" from frame to frame as only partial results have been computed. If I run the same code on the CPU and then SetData() on the buffer it's fine.
     
  6. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    640
    User Error - thanks for sanity checking me @slime73 turned out to be a packing issue with my compute buffer data. :oops:

    The GraphicsFence functionality would still be nice for other purposes.
     
    Last edited: Feb 12, 2020