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.
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
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.
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:
Validation: Function `Unity_SimpleNoise_RandomValue_$precision` has conflicting implementations:
inline $precision Unity_SimpleNoise_RandomValue_$precision ($precision2 uv)
{
$precision angle = dot(uv, $precision2(12.9898, 78.233));
#if defined(SHADER_API_MOBILE) && (defined(SHADER_API_GLES) || defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN))
// 'sin()' has bad precision on Mali GPUs for inputs > 10000
angle = fmod(angle, TWO_PI); // Avoid large inputs to sin()
#endif
return frac(sin(angle)*43758.5453);
}
inline $precision Unity_SimpleNoise_RandomValue_$precision ($precision2 uv)
{
$precision angle = dot(uv, $precision2(12.9898, 78.233));
#if defined(SHADER_API_MOBILE) && (defined(SHADER_API_GLES) || defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN))
// 'sin()' has bad precision on Mali GPUs for inputs > 10000
angle = fmod(angle, TWO_PI); // Avoid large inputs to sin()
#endif
return frac(sin(angle)*43758.5453);
}
I guess for now I will take out the Simple Noise node from the subgraph I am creating.
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.
TestSSG is just a Simple Noise node connected to a Vector4 output:
Curiously, using two of the same sub graphs works:
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.