From 743c9429eecd14f31c916397ec9b65e059a10956 Mon Sep 17 00:00:00 2001 From: Elizabeth LeGros Date: Thu, 25 Feb 2021 18:16:52 -0600 Subject: [PATCH 1/3] fixing error message that used to attach to the master node to print a debug log until we get a better way to handle graph-wide errors --- .../Editor/Data/Implementation/GraphObject.cs | 5 +++++ .../Editor/Generation/Processors/Generator.cs | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/com.unity.shadergraph/Editor/Data/Implementation/GraphObject.cs b/com.unity.shadergraph/Editor/Data/Implementation/GraphObject.cs index 245007c9597..ff49b9e64f4 100644 --- a/com.unity.shadergraph/Editor/Data/Implementation/GraphObject.cs +++ b/com.unity.shadergraph/Editor/Data/Implementation/GraphObject.cs @@ -22,6 +22,11 @@ class GraphObject : ScriptableObject, ISerializationCallbackReceiver [SerializeField] string m_AssetGuid; + internal string AssetGuid + { + get => m_AssetGuid; + } + [NonSerialized] GraphData m_Graph; diff --git a/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs b/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs index 63746047c35..2bbe8afac92 100644 --- a/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs +++ b/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs @@ -113,7 +113,16 @@ void BuildShader() if (m_GraphData.GetKeywordPermutationCount() > ShaderGraphPreferences.variantLimit) { - m_GraphData.AddValidationError(m_OutputNode.objectId, ShaderKeyword.kVariantLimitWarning, Rendering.ShaderCompilerMessageSeverity.Error); + string graphName = ""; + if(m_GraphData.owner != null) + { + string path = AssetDatabase.GUIDToAssetPath(m_GraphData.owner.AssetGuid); + if(path != null) + { + graphName = Path.GetFileNameWithoutExtension(path); + } + } + Debug.LogError($"Error in Shader Graph {graphName}:{ShaderKeyword.kVariantLimitWarning}"); m_ConfiguredTextures = shaderProperties.GetConfiguredTextures(); m_Builder.AppendLines(ShaderGraphImporter.k_ErrorShader); From 4b533f03181fd8697383bdb4e07d330925a121a4 Mon Sep 17 00:00:00 2001 From: elizabeth-legros <59933602+elizabeth-legros@users.noreply.github.com> Date: Fri, 26 Feb 2021 11:06:56 -0600 Subject: [PATCH 2/3] Update CHANGELOG.md --- com.unity.shadergraph/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.shadergraph/CHANGELOG.md b/com.unity.shadergraph/CHANGELOG.md index 2df55553207..f30f5746b4c 100644 --- a/com.unity.shadergraph/CHANGELOG.md +++ b/com.unity.shadergraph/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed virtual texture layer reference names allowing invalid characters [1304146] - Fixed issue with SRP Batcher compatibility [1310624] - Fixed issue with Hybrid renderer compatibility [1296776] +- Fixed an issue where the shader variant limit exceeded message was not getting passed [1304168] (https://issuetracker.unity3d.com/product/unity/issues/guid/1304168) ## [11.0.0] - 2020-10-21 From b48900b7e3320e829fd9146bc3ef2bfbbe14395d Mon Sep 17 00:00:00 2001 From: Elizabeth LeGros Date: Mon, 1 Mar 2021 11:08:46 -0600 Subject: [PATCH 3/3] formatting --- .../Editor/Generation/Processors/Generator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs b/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs index 2bbe8afac92..94e08c28fff 100644 --- a/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs +++ b/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs @@ -114,10 +114,10 @@ void BuildShader() if (m_GraphData.GetKeywordPermutationCount() > ShaderGraphPreferences.variantLimit) { string graphName = ""; - if(m_GraphData.owner != null) + if (m_GraphData.owner != null) { string path = AssetDatabase.GUIDToAssetPath(m_GraphData.owner.AssetGuid); - if(path != null) + if (path != null) { graphName = Path.GetFileNameWithoutExtension(path); }