Search Unity

Shaders targeting multiple pipelines are now broken in 2019.3?

Discussion in 'Universal Render Pipeline' started by Kronnect, Feb 7, 2020.

  1. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Before 2019.3, we could write a shader with several SubShader sections using the "RenderPipeline" tag so same shader can work for built-in and for other pipelines.

    Example:

    SubShader {
    Tags { "RenderPipeline" = "" }
    Pass {
    // this pass only get executed in built-in
    ...
    SubShader {
    Tags { "RenderPipeline" = "LightweightPipeline" }
    Pass {
    // this pass only get executed in LWRP
    ...

    Now, after updating to 2019.3, these shaders no longer work.
    I wonder if there's a different syntax or if it's a breaking change.
    Any advice? /cc @Tim-C @phil_lira
     
  2. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
  3. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    looking at the changes i think that i broke this sometime during the 19.3 beta. thanks for letting me know we'll make a fix and get it into a 19.3 patch release (it requires core unity changes). Thanks for bringing this to our attention.
     
    Kronnect likes this.
  4. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Thanks Tim.

    What would be the recommended way to reference each pipeline option?

    Currently we have:

    No Render Pipeline tag: this could be an unlit shader that works perfectly on both built-in and URP.
    "RenderPipeline" = "": this means the shader works only for built-in.
    "RenderPipeline" = "UniversalPipeline" : only URP.

    Is this correct?
     
  5. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    yep that looks right :)
     
    Kronnect likes this.
  6. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Hey @Tim-C,

    What's the status of the implementation of the above?
    Currently, any shader with "RenderPipeline"="" is not rendered as of Unity 2019.3.2f1 in builtin.
    Removing the tag, makes it work again, but then, it will also render in URP which is not what I want.
     
  7. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    I made the fix last week, but it's still waiting to land :( Will be a bit longer, but it _is_ coming!
     
  8. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,906
    Thank you Tim. I appreciate your fast response and glad to see the fix coming.

    I found a workround that seems to work although I prefer the fix obviously. The workaround works by moving the subshader with the RenderPipeline tag = "" below the subshader for URP. As the system seems to pick the first one compatible with the platform, this seems to do the trick.