Skip to content

Commit 8b21995

Browse files
Fix migration issue in PR (Move shadergraph properties #1214)
1 parent 664fe24 commit 8b21995

File tree

9 files changed

+26
-5
lines changed

9 files changed

+26
-5
lines changed

com.unity.render-pipelines.high-definition/Editor/Material/Decal/ShaderGraph/DecalSubTarget.Migration.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ public bool TryUpgradeFromMasterNode(IMasterNode1 masterNode, out Dictionary<Blo
2020
blockMap = null;
2121
if(!(masterNode is DecalMasterNode1 decalMasterNode))
2222
return false;
23-
23+
24+
m_MigrateFromOldSG = true;
25+
2426
// Set data
2527
systemData.surfaceType = (SurfaceType)decalMasterNode.m_SurfaceType;
2628
systemData.dotsInstancing = decalMasterNode.m_DOTSInstancing;
@@ -67,4 +69,4 @@ public bool TryUpgradeFromMasterNode(IMasterNode1 masterNode, out Dictionary<Blo
6769
return true;
6870
}
6971
}
70-
}
72+
}

com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/EyeSubTarget.Migration.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public bool TryUpgradeFromMasterNode(IMasterNode1 masterNode, out Dictionary<Blo
2121
if(!(masterNode is EyeMasterNode1 eyeMasterNode))
2222
return false;
2323

24+
m_MigrateFromOldSG = true;
25+
2426
// Set data
2527
systemData.surfaceType = (SurfaceType)eyeMasterNode.m_SurfaceType;
2628
systemData.blendMode = HDSubShaderUtilities.UpgradeLegacyAlphaModeToBlendMode((int)eyeMasterNode.m_AlphaMode);

com.unity.render-pipelines.high-definition/Editor/Material/Fabric/ShaderGraph/FabricSubTarget.Migration.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public bool TryUpgradeFromMasterNode(IMasterNode1 masterNode, out Dictionary<Blo
2121
if(!(masterNode is FabricMasterNode1 fabricMasterNode))
2222
return false;
2323

24+
m_MigrateFromOldSG = true;
25+
2426
// Set data
2527
systemData.surfaceType = (SurfaceType)fabricMasterNode.m_SurfaceType;
2628
systemData.blendMode = HDSubShaderUtilities.UpgradeLegacyAlphaModeToBlendMode((int)fabricMasterNode.m_AlphaMode);

com.unity.render-pipelines.high-definition/Editor/Material/Hair/ShaderGraph/HairSubTarget.Migration.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public bool TryUpgradeFromMasterNode(IMasterNode1 masterNode, out Dictionary<Blo
2121
if(!(masterNode is HairMasterNode1 hairMasterNode))
2222
return false;
2323

24+
m_MigrateFromOldSG = true;
25+
2426
// Set data
2527
systemData.surfaceType = (SurfaceType)hairMasterNode.m_SurfaceType;
2628
systemData.blendMode = HDSubShaderUtilities.UpgradeLegacyAlphaModeToBlendMode((int)hairMasterNode.m_AlphaMode);

com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitSubTarget.Migration.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ sealed partial class HDLitSubTarget : LightingSubTarget, ILegacyTarget, IRequire
1717
{
1818
public bool TryUpgradeFromMasterNode(IMasterNode1 masterNode, out Dictionary<BlockFieldDescriptor, int> blockMap)
1919
{
20+
m_MigrateFromOldSG = true;
21+
2022
blockMap = null;
2123
switch(masterNode)
2224
{

com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDSubTarget.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ abstract class HDSubTarget : SubTarget<HDTarget>, IHasMetadata,
1818
{
1919
SystemData m_SystemData;
2020
protected bool m_MigrateFromOldCrossPipelineSG; // Use only for the migration to shader stack architecture
21+
protected bool m_MigrateFromOldSG; // Use only for the migration from early shader stack architecture to recent one
2122

2223
// Interface Properties
2324
SystemData IRequiresData<SystemData>.data

com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceSubTarget.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,14 @@ internal override void MigrateTo(ShaderGraphVersion version)
358358
if (version == ShaderGraphVersion.FirstTimeMigration)
359359
{
360360
#pragma warning disable 618
361-
builtinData.transparentDepthPrepass = systemData.m_TransparentDepthPrepass;
362-
builtinData.transparentDepthPostpass = systemData.m_TransparentDepthPostpass;
363-
builtinData.supportLodCrossFade = systemData.m_SupportLodCrossFade;
361+
// If we come from old master node, nothing to do.
362+
// Only perform an action if we are a shader stack
363+
if (!m_MigrateFromOldSG)
364+
{
365+
builtinData.transparentDepthPrepass = systemData.m_TransparentDepthPrepass;
366+
builtinData.transparentDepthPostpass = systemData.m_TransparentDepthPostpass;
367+
builtinData.supportLodCrossFade = systemData.m_SupportLodCrossFade;
368+
}
364369
#pragma warning restore 618
365370
}
366371
}

com.unity.render-pipelines.high-definition/Editor/Material/StackLit/ShaderGraph/StackLitSubTarget.Migration.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public bool TryUpgradeFromMasterNode(IMasterNode1 masterNode, out Dictionary<Blo
2121
if(!(masterNode is StackLitMasterNode1 stackLitMasterNode))
2222
return false;
2323

24+
m_MigrateFromOldSG = true;
25+
2426
// Set data
2527
systemData.surfaceType = (SurfaceType)stackLitMasterNode.m_SurfaceType;
2628
systemData.blendMode = HDSubShaderUtilities.UpgradeLegacyAlphaModeToBlendMode((int)stackLitMasterNode.m_AlphaMode);

com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitSubTarget.Migration.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public bool TryUpgradeFromMasterNode(IMasterNode1 masterNode, out Dictionary<Blo
3434
void UpgradeUnlitMasterNode(UnlitMasterNode1 unlitMasterNode, out Dictionary<BlockFieldDescriptor, int> blockMap)
3535
{
3636
m_MigrateFromOldCrossPipelineSG = true;
37+
m_MigrateFromOldSG = true;
3738

3839
// Set data
3940
systemData.surfaceType = (SurfaceType)unlitMasterNode.m_SurfaceType;
@@ -61,6 +62,8 @@ void UpgradeUnlitMasterNode(UnlitMasterNode1 unlitMasterNode, out Dictionary<Blo
6162

6263
void UpgradeHDUnlitMasterNode(HDUnlitMasterNode1 hdUnlitMasterNode, out Dictionary<BlockFieldDescriptor, int> blockMap)
6364
{
65+
m_MigrateFromOldSG = true;
66+
6467
// Set data
6568
systemData.surfaceType = (SurfaceType)hdUnlitMasterNode.m_SurfaceType;
6669
systemData.blendMode = HDSubShaderUtilities.UpgradeLegacyAlphaModeToBlendMode((int)hdUnlitMasterNode.m_AlphaMode);

0 commit comments

Comments
 (0)