Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug SubGraph generate conflicting implementations

Discussion in 'Shader Graph' started by bangingdev, Oct 29, 2021.

  1. bangingdev

    bangingdev

    Joined:
    Nov 15, 2020
    Posts:
    12
    ShaderGraph: 12.1.0
    I upgrade unity 2020.2.2f1 to 2021.2.0f1. Then i find some shader compile error like this
    The Shader have node SimpleNoise and subGrpah.
    The SubGraph also have node SimpleNoise, Then compile error.

    If i delete node SimpleNoise or subGraph, compile is ok.

    upload_2021-10-29_14-46-0.png
     
  2. Cec

    Cec

    Joined:
    Apr 7, 2014
    Posts:
    92
    Same issue for me :(
     
  3. Jagrafess

    Jagrafess

    Joined:
    Apr 4, 2015
    Posts:
    4
    Yeah I'm seeing it too, I used GradientNoise to get around it for the moment, I think recreating the graph from scratch will fix it, but that's not a great solution

    Here's the error so other people who search for it will find it.
    Validation: Function `Unity_SimpleNoise_RandomValue_$precision` has conflicting implementations
     
  4. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    Yep, just updated to URP 12.1.2 and got this error. Anyone has found out how to fix this? Just deleting and adding the node again doesn't fix the problem.
     
  5. NSBryant

    NSBryant

    Joined:
    Jul 16, 2017
    Posts:
    8
    Same issue here. Anyone have a good workaround or a bug tracker link?
     
  6. maurosso

    maurosso

    Joined:
    Feb 19, 2017
    Posts:
    47
    I have the same issue.

    EDIT: I don't know why, but adding an empty Multiply node to the subGraph with the SimpleNoise node, fixed the issue for now.
     
    Last edited: Jan 14, 2022
  7. AustinMclEctro

    AustinMclEctro

    Joined:
    May 3, 2017
    Posts:
    16
    Does anyone from Unity have advice on this? No idea how to get around it. It seems to happen when a Simple Noise node in a shader subgraph is hooked up anywhere, and then the subgraph is used in a shadergraph. I'm not sure what causes the shadergraph using the subgraph to break yet.

    All of my nodes are set to inherit precision. Switching precision settings around has not resolved this. The shader graph using the subgraph is set to Single precision.

    Here is the error specifically. The two functions referenced in the error look the same:

    Code (CSharp):
    1. Validation: Function `Unity_SimpleNoise_RandomValue_$precision` has conflicting implementations:
    2.  
    3. inline $precision Unity_SimpleNoise_RandomValue_$precision ($precision2 uv)
    4. {
    5.     $precision angle = dot(uv, $precision2(12.9898, 78.233));
    6.     #if defined(SHADER_API_MOBILE) && (defined(SHADER_API_GLES) || defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN))
    7.         // 'sin()' has bad precision on Mali GPUs for inputs > 10000
    8.         angle = fmod(angle, TWO_PI); // Avoid large inputs to sin()
    9.     #endif
    10.     return frac(sin(angle)*43758.5453);
    11. }
    12.  
    13.  
    14. inline $precision Unity_SimpleNoise_RandomValue_$precision ($precision2 uv)
    15. {
    16.     $precision angle = dot(uv, $precision2(12.9898, 78.233));
    17.     #if defined(SHADER_API_MOBILE) && (defined(SHADER_API_GLES) || defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN))
    18.         // 'sin()' has bad precision on Mali GPUs for inputs > 10000
    19.         angle = fmod(angle, TWO_PI); // Avoid large inputs to sin()
    20.     #endif
    21.     return frac(sin(angle)*43758.5453);
    22. }
    23.  
    24.  
    I guess for now I will take out the Simple Noise node from the subgraph I am creating.

    Background diagnostics from me:
    • Unity 2021.2.7f1
    • HDRP 12.1.2, Shader Graph 12.1.2
    • Linear Color Space
    • Direct3D11 Graphics API (Windows)
     
    Last edited: Jun 11, 2022
  8. AustinMclEctro

    AustinMclEctro

    Joined:
    May 3, 2017
    Posts:
    16
    Just to isolate and showcase the problem, I'll post some pics.

    Here is an example shader graph with three nodes: Simple Noise, a sub graph TestSSG, and a mulitply node multiplying the sub graph's and Simple Noise's outputs together into the graph's Base Color input. As we can see, the graph is broken.
    upload_2022-6-12_17-42-5.png

    TestSSG is just a Simple Noise node connected to a Vector4 output:
    upload_2022-6-12_17-44-7.png

    Curiously, using two of the same sub graphs works:
    upload_2022-6-12_17-47-25.png

    Also, using a different sub graph (also with just a Simple Noise node inside) multiplied with our first sub graph works.

    My workaround for now is to make a shader sub graph called "Simple Noise Workaround" that is just a wrapper for the Simple Noise node. In my case currently this makes more sense than putting any nodes that use Simple Noise in their own sub graphs.

    I've attached this workaround sub graph in a .zip to this post in case anyone else wants a quick fix.

    I wonder if this has been fixed in Shader Graph for Unity 2021.3 LTS.
     

    Attached Files: