Search Unity

Compute Shaders Don't Work on Android with Linear Lighting

Discussion in 'Shaders' started by Shane_Michael, Jan 12, 2019.

  1. Shane_Michael

    Shane_Michael

    Joined:
    Jul 8, 2013
    Posts:
    158
    I spent a whole day trying to get a simple compute shader to work on Android until I finally stumbled up on issue 1064321. Apparently compute shaders don't work on Android with linear lighting "by design" which seems kind of odd, and the issue was resolved without elaborating on it at all.

    Has anyone ever stumbled upon this and found a workaround? Or have any idea why this is? Is it a driver issue that will eventually be solved, or is it not on the road map at all?

    For now I guess I will have to just deal with gamma lighting because the use of compute shaders is central to a project I am working on now.

    At the very least, if anyone else runs into this issue, they will find this post before burning a whole day trying to debug a perfectly functional compute shader that simply fails silently when deployed to a device.
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,023
    Hi!
    From the resolution notes:
    "Using UAV texture in compute shader with OpenGL and linear color space is not supported."
     
  3. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,550
    Not my issue, but curious about this... is this some sort of limit in OpenGL? Or something Unity simply has not implemented for some reason?
     
  4. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,023
    In linear mode all the render textures are created as srgb. However, you cannot bind srgb textures for random write in GL. You need to use a separate texture view for it. Unfortunately this approach in GLES is only supported via extension (GL_EXT_texture_view/GL_OES_texture_view) that is not very common. So RWTextures are really not supported on gles mobiles when using linear color space.
     
    Invertex likes this.