Search Unity

Question Passing data from vert/frag shader to compute shader

Discussion in 'Shaders' started by elijad, May 26, 2020.

  1. elijad

    elijad

    Joined:
    Mar 19, 2020
    Posts:
    47
    I'm trying to do some shadow calculations in a compute shader and I want to send some extra data along with depth buffer to it. Is there a way to do that without reading it through cpu? It seems that reading compute buffers in vertex shaders is totally fine and works without issues, but the other way around (i.e. writing some data to buffer in vertex function and then accessing it in compute shader) is tricky. I managed to do it using async readback inside a command buffer, but performance is terrible as expected.

    Anyone has any info on that?
     
  2. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,550