Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.shadergraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed a number of memory leaks that caused Shader Graph assets to stay in memory after closing the Shader Graph window.
- You can now smoothly edit controls on the `Dielectric Specular` node.
- Fixed Blackboard Properties to support scientific notation.
- Fixed a bug where warnings in the Shader Graph or Sub Graph were treated as errors.
- Fixed a bug where the error `Output value 'vert' is not initialized` displayed on all PBR graphs in Universal. [1210710](https://issuetracker.unity3d.com/issues/output-value-vert-is-not-completely-initialized-error-is-thrown-when-pbr-graph-is-created-using-urp)
- Fixed a bug where PBR and Unlit master nodes in Universal had Alpha Clipping enabled by default.
- Fixed an issue in where analytics wasn't always working.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ internal static string GetShaderText(string path, out List<PropertyCollector.Tex
configuredTextures = generator.configuredTextures;
sourceAssetDependencyPaths = generator.assetDependencyPaths;

if (graph.messageManager.nodeMessagesChanged)
if (graph.messageManager.AnyError())
{
shaderString = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public override void OnImportAsset(AssetImportContext ctx)
}
finally
{
if (messageManager.nodeMessagesChanged)
if (messageManager.AnyError())
{
graphAsset.isValid = false;
foreach (var pair in messageManager.GetNodeMessages())
Expand Down
18 changes: 18 additions & 0 deletions com.unity.shadergraph/Editor/Util/MessageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,23 @@ public static void Log(AbstractMaterialNode node, string path, ShaderMessage mes
Debug.LogWarning(errString, context);
}
}

public bool AnyError()
{
foreach(var messages in m_Messages.Values)
{
foreach(List<ShaderMessage> messageList in messages.Values)
{
foreach(var message in messageList)
{
if(message.severity == ShaderCompilerMessageSeverity.Error)
{
return true;
}
}
}
}
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,42 @@ public void ClearNodesFromProvider_LeavesOtherNodes()
var ret = GetListFrom(m_ComplexMgr);
Assert.AreEqual(3, ret.Find(kpv => kpv.Key.Equals(node1.guid)).Value.Count);
}

[Test]
public void ReportAnyErrors_EmptyManager()
{
var ret = m_EmptyMgr.AnyError();
Assert.IsFalse(ret);
}

[Test]
public void ReportAnyErrors_ComplexManager()
{
var ret = m_ComplexMgr.AnyError();
Assert.IsTrue(ret);
}

[Test]
public void ReportAnyErrors_EmptyManager_OnlyWarnings()
{
m_EmptyMgr.AddOrAppendError(p0, node0.guid, w0);
m_EmptyMgr.AddOrAppendError(p1, node1.guid, w1);

var ret = m_EmptyMgr.AnyError();
Assert.IsFalse(ret);
}

[Test]
public void ReportAnyErrors_EmptyManager_ErrorOneProvider()
{
m_EmptyMgr.AddOrAppendError(p0, node0.guid, w0);
m_EmptyMgr.AddOrAppendError(p1, node1.guid, e1);

var ret = m_EmptyMgr.AnyError();
Assert.IsTrue(ret);
}


}
}

Expand Down