Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Shaders targeting multiple pipelines are now broken in 2019.3?

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

  1. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,510
    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. Thrawn75

    Thrawn75

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

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,158
    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.
     
    Thrawn75 likes this.
  4. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,510
    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,158
    yep that looks right :)
     
    Thrawn75 likes this.
  6. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,510
    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,158
    I made the fix last week, but it's still waiting to land :( Will be a bit longer, but it _is_ coming!
     
  8. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,510
    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.
     
unityunity