Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Poor shader performance with OpenGLCore (OSX)

Discussion in '5.4 Beta' started by aaronjbaptiste, Mar 16, 2016.

  1. aaronjbaptiste

    aaronjbaptiste

    Joined:
    Dec 4, 2012
    Posts:
    62
    MrEsquire likes this.
  2. Juho_Oravainen

    Juho_Oravainen

    Unity Technologies

    Joined:
    Jun 5, 2014
    Posts:
    42
    Thank you for reporting this!

    The image effect in question does not seem to play well together with the GLCore shader translation pipeline, producing quite inefficient GLSL code. I'll push this forward so that the shader will be fixed in the standard assets package. However, you can workaround this by modifying the shader yourself:

    In the beginning of TiltShiftHdrLensBlur.shader there is this define
    Code (csharp):
    1. #ifdef SHADER_API_D3D11
    2.     #define SAMPLE_TEX(sampler, uv) tex2Dlod(sampler, float4(uv,0,1))
    3. #else
    4.     #define SAMPLE_TEX(sampler, uv) tex2D(sampler, uv)
    5. #endif
    Just change it so that the tex2Dlod version is being used and you should be all good again
    Code (csharp):
    1. #if defined(SHADER_API_D3D11) || defined(SHADER_API_GLCORE)
    2.     #define SAMPLE_TEX(sampler, uv) tex2Dlod(sampler, float4(uv,0,1))
    3. #else
    4.     #define SAMPLE_TEX(sampler, uv) tex2D(sampler, uv)
    5. #endif
     
    MrEsquire likes this.
  3. aaronjbaptiste

    aaronjbaptiste

    Joined:
    Dec 4, 2012
    Posts:
    62