Skip to content

Commit 5de7415

Browse files
svc-reach-platform-supportEvergreen
authored andcommitted
[Port] [6000.3] [ShaderGraph] Fix Enum Labels and a few other issues
1 parent 5e90f71 commit 5de7415

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

Packages/com.unity.shadergraph/Editor/Data/Nodes/Channel/SwizzleNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public string maskInput
3636
get { return _maskInput; }
3737
set
3838
{
39-
if (_maskInput.Equals(value))
39+
if (value == null || _maskInput.Equals(value))
4040
return;
4141
_maskInput = value;
4242
UpdateNodeAfterDeserialization();

Packages/com.unity.shadergraph/Editor/Data/Nodes/Utility/KeywordNode.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo
154154
sb.AppendLine(string.Format($"{outputSlot.concreteValueType.ToShaderString()} {GetVariableNameForSlot(OutputSlotId)};"));
155155
for(int i = 0; i < keyword.entries.Count; ++i)
156156
{
157-
string keywordName = $"{keyword.referenceName}_{keyword.entries[i].referenceName}";
158-
var value = GetSlotValue(i + 1, generationMode);
157+
var keywordEntry = keyword.entries[i];
158+
string keywordName = $"{keyword.referenceName}_{keywordEntry.referenceName}";
159+
var value = GetSlotValue(keywordEntry.id, generationMode);
159160
sb.AppendLine(string.Format($"{(i != 0 ? "else" : "")} if({keywordName}) {GetVariableNameForSlot(OutputSlotId)} = {value};"));
160161
}
161162
break;

Packages/com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,8 @@ void BuildKeywordFields(PropertySheet propertySheet, ShaderInput shaderInput)
16001600
return;
16011601
keyword.keywordDefinition = (KeywordDefinition)newValue;
16021602
UpdateEnableState();
1603-
this._postChangeValueCallback(true, ModificationScope.Nothing);
1603+
this._postChangeValueCallback(true);
1604+
this._keywordChangedCallback();
16041605
},
16051606
keyword.keywordDefinition,
16061607
"Definition",
@@ -1960,6 +1961,7 @@ void KeywordAddCallbacks()
19601961
keyword.entries[index] = new KeywordEntry(entry.id, displayName, referenceName);
19611962

19621963
this._postChangeValueCallback(true);
1964+
this._keywordChangedCallback();
19631965
}
19641966
};
19651967

@@ -2066,6 +2068,8 @@ void KeywordReorderEntries(ReorderableList list)
20662068
{
20672069
this._preChangeValueCallback("Reorder Keyword Entry");
20682070
this._postChangeValueCallback(true);
2071+
this._keywordChangedCallback();
2072+
20692073
}
20702074

20712075
public string GetDuplicateSafeEnumDisplayName(int id, string name)

Packages/com.unity.shadergraph/Editor/Generation/Processors/Generator.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,10 +597,7 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo
597597
List<AbstractMaterialNode> nodeList, List<MaterialSlot> slotList)
598598
{
599599
if (passBlockMask == null)
600-
{
601-
Profiler.EndSample();
602600
return;
603-
}
604601

605602
Profiler.BeginSample("ProcessStackForPass");
606603
foreach (var blockFieldDescriptor in passBlockMask)
@@ -832,7 +829,6 @@ void ProcessStackForPass(ContextData contextData, BlockFieldDescriptor[] passBlo
832829
// Generated structs and Packing code
833830
Profiler.BeginSample("StructsAndPacking");
834831
var interpolatorBuilder = new ShaderStringBuilder(humanReadable: m_HumanReadable);
835-
836832
if (passStructs != null)
837833
{
838834
var packedStructs = new List<StructDescriptor>();

0 commit comments

Comments
 (0)