Skip to content

Commit 958486d

Browse files
Revert "Move shadergraph properties (#1214)"
This reverts commit 9a8d3b1.
1 parent 614541f commit 958486d

File tree

12 files changed

+54
-98
lines changed

12 files changed

+54
-98
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ public bool TryUpgradeFromMasterNode(IMasterNode1 masterNode, out Dictionary<Blo
2727
// Previous master node wasn't having any renderingPass. Assign it correctly now.
2828
systemData.renderingPass = systemData.surfaceType == SurfaceType.Opaque ? HDRenderQueue.RenderQueueType.Opaque : HDRenderQueue.RenderQueueType.Transparent;
2929
systemData.alphaTest = eyeMasterNode.m_AlphaTest;
30+
systemData.transparentDepthPrepass = eyeMasterNode.m_AlphaTestDepthPrepass;
31+
systemData.transparentDepthPostpass = eyeMasterNode.m_AlphaTestDepthPostpass;
3032
systemData.sortPriority = eyeMasterNode.m_SortPriority;
3133
systemData.doubleSidedMode = eyeMasterNode.m_DoubleSidedMode;
3234
systemData.transparentZWrite = eyeMasterNode.m_ZWrite;
3335
systemData.transparentCullMode = eyeMasterNode.m_transparentCullMode;
3436
systemData.zTest = eyeMasterNode.m_ZTest;
37+
systemData.supportLodCrossFade = eyeMasterNode.m_SupportLodCrossFade;
3538
systemData.dotsInstancing = eyeMasterNode.m_DOTSInstancing;
3639
systemData.materialNeedsUpdateHash = eyeMasterNode.m_MaterialNeedsUpdateHash;
3740

38-
builtinData.transparentDepthPrepass = eyeMasterNode.m_AlphaTestDepthPrepass;
39-
builtinData.transparentDepthPostpass = eyeMasterNode.m_AlphaTestDepthPostpass;
40-
builtinData.supportLodCrossFade = eyeMasterNode.m_SupportLodCrossFade;
4141
builtinData.transparencyFog = eyeMasterNode.m_TransparencyFog;
4242
builtinData.addPrecomputedVelocity = eyeMasterNode.m_AddPrecomputedVelocity;
4343
builtinData.depthOffset = eyeMasterNode.m_depthOffset;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ public bool TryUpgradeFromMasterNode(IMasterNode1 masterNode, out Dictionary<Blo
3232
systemData.transparentZWrite = fabricMasterNode.m_ZWrite;
3333
systemData.transparentCullMode = fabricMasterNode.m_transparentCullMode;
3434
systemData.zTest = fabricMasterNode.m_ZTest;
35+
systemData.supportLodCrossFade = fabricMasterNode.m_SupportLodCrossFade;
3536
systemData.dotsInstancing = fabricMasterNode.m_DOTSInstancing;
3637
systemData.materialNeedsUpdateHash = fabricMasterNode.m_MaterialNeedsUpdateHash;
3738

38-
builtinData.supportLodCrossFade = fabricMasterNode.m_SupportLodCrossFade;
3939
builtinData.transparencyFog = fabricMasterNode.m_TransparencyFog;
4040
builtinData.addPrecomputedVelocity = fabricMasterNode.m_AddPrecomputedVelocity;
4141
builtinData.depthOffset = fabricMasterNode.m_depthOffset;

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ public bool TryUpgradeFromMasterNode(IMasterNode1 masterNode, out Dictionary<Blo
2727
// Previous master node wasn't having any renderingPass. Assign it correctly now.
2828
systemData.renderingPass = systemData.surfaceType == SurfaceType.Opaque ? HDRenderQueue.RenderQueueType.Opaque : HDRenderQueue.RenderQueueType.Transparent;
2929
systemData.alphaTest = hairMasterNode.m_AlphaTest;
30+
systemData.transparentDepthPrepass = hairMasterNode.m_AlphaTestDepthPrepass;
31+
systemData.transparentDepthPostpass = hairMasterNode.m_AlphaTestDepthPostpass;
3032
systemData.sortPriority = hairMasterNode.m_SortPriority;
3133
systemData.doubleSidedMode = hairMasterNode.m_DoubleSidedMode;
3234
systemData.transparentZWrite = hairMasterNode.m_ZWrite;
3335
systemData.transparentCullMode = hairMasterNode.m_transparentCullMode;
3436
systemData.zTest = hairMasterNode.m_ZTest;
37+
systemData.supportLodCrossFade = hairMasterNode.m_SupportLodCrossFade;
3538
systemData.dotsInstancing = hairMasterNode.m_DOTSInstancing;
3639
systemData.materialNeedsUpdateHash = hairMasterNode.m_MaterialNeedsUpdateHash;
3740

38-
builtinData.supportLodCrossFade = hairMasterNode.m_SupportLodCrossFade;
39-
builtinData.transparentDepthPrepass = hairMasterNode.m_AlphaTestDepthPrepass;
40-
builtinData.transparentDepthPostpass = hairMasterNode.m_AlphaTestDepthPostpass;
4141
builtinData.transparencyFog = hairMasterNode.m_TransparencyFog;
4242
builtinData.transparentWritesMotionVec = hairMasterNode.m_TransparentWritesMotionVec;
4343
builtinData.addPrecomputedVelocity = hairMasterNode.m_AddPrecomputedVelocity;
@@ -96,9 +96,9 @@ bool AdditionalSlotMaskTests(HairMasterNode1.SlotMask slotMask)
9696
case HairMasterNode1.SlotMask.AlphaClipThreshold:
9797
return systemData.alphaTest;
9898
case HairMasterNode1.SlotMask.AlphaClipThresholdDepthPrepass:
99-
return systemData.surfaceType == SurfaceType.Transparent && systemData.alphaTest && builtinData.transparentDepthPrepass;
99+
return systemData.surfaceType == SurfaceType.Transparent && systemData.alphaTest && systemData.transparentDepthPrepass;
100100
case HairMasterNode1.SlotMask.AlphaClipThresholdDepthPostpass:
101-
return systemData.surfaceType == SurfaceType.Transparent && systemData.alphaTest && builtinData.transparentDepthPostpass;
101+
return systemData.surfaceType == SurfaceType.Transparent && systemData.alphaTest && systemData.transparentDepthPostpass;
102102
case HairMasterNode1.SlotMask.AlphaClipThresholdShadow:
103103
return systemData.alphaTest && builtinData.alphaTestShadow;
104104
default:

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ void UpgradePBRMasterNode(PBRMasterNode1 pbrMasterNode, out Dictionary<BlockFiel
4141
systemData.doubleSidedMode = pbrMasterNode.m_TwoSided ? DoubleSidedMode.Enabled : DoubleSidedMode.Disabled;
4242
// Previous master node wasn't having any renderingPass. Assign it correctly now.
4343
systemData.renderingPass = systemData.surfaceType == SurfaceType.Opaque ? HDRenderQueue.RenderQueueType.Opaque : HDRenderQueue.RenderQueueType.Transparent;
44-
systemData.dotsInstancing = false;
4544
systemData.alphaTest = HDSubShaderUtilities.UpgradeLegacyAlphaClip(pbrMasterNode);
45+
systemData.dotsInstancing = false;
4646
builtinData.addPrecomputedVelocity = false;
4747
lightingData.blendPreserveSpecular = false;
4848
lightingData.normalDropOffSpace = pbrMasterNode.m_NormalDropOffSpace;
@@ -109,17 +109,17 @@ void UpgradeHDLitMasterNode(HDLitMasterNode1 hdLitMasterNode, out Dictionary<Blo
109109
if (systemData.renderingPass == HDRenderQueue.RenderQueueType.Background)
110110
systemData.renderingPass = HDRenderQueue.RenderQueueType.Opaque;
111111
systemData.alphaTest = hdLitMasterNode.m_AlphaTest;
112+
systemData.transparentDepthPrepass = hdLitMasterNode.m_AlphaTestDepthPrepass;
113+
systemData.transparentDepthPostpass = hdLitMasterNode.m_AlphaTestDepthPostpass;
112114
systemData.sortPriority = hdLitMasterNode.m_SortPriority;
113115
systemData.doubleSidedMode = hdLitMasterNode.m_DoubleSidedMode;
114116
systemData.transparentZWrite = hdLitMasterNode.m_ZWrite;
115117
systemData.transparentCullMode = hdLitMasterNode.m_transparentCullMode;
116118
systemData.zTest = hdLitMasterNode.m_ZTest;
119+
systemData.supportLodCrossFade = hdLitMasterNode.m_SupportLodCrossFade;
117120
systemData.dotsInstancing = hdLitMasterNode.m_DOTSInstancing;
118121
systemData.materialNeedsUpdateHash = hdLitMasterNode.m_MaterialNeedsUpdateHash;
119122

120-
builtinData.transparentDepthPrepass = hdLitMasterNode.m_AlphaTestDepthPrepass;
121-
builtinData.transparentDepthPostpass = hdLitMasterNode.m_AlphaTestDepthPostpass;
122-
builtinData.supportLodCrossFade = hdLitMasterNode.m_SupportLodCrossFade;
123123
builtinData.transparencyFog = hdLitMasterNode.m_TransparencyFog;
124124
builtinData.distortion = hdLitMasterNode.m_Distortion;
125125
builtinData.distortionMode = hdLitMasterNode.m_DistortionMode;
@@ -204,9 +204,9 @@ bool AdditionalSlotMaskTests(HDLitMasterNode1.SlotMask slotMask)
204204
case HDLitMasterNode1.SlotMask.AlphaThreshold:
205205
return systemData.alphaTest;
206206
case HDLitMasterNode1.SlotMask.AlphaThresholdDepthPrepass:
207-
return systemData.surfaceType == SurfaceType.Transparent && systemData.alphaTest && builtinData.transparentDepthPrepass;
207+
return systemData.surfaceType == SurfaceType.Transparent && systemData.alphaTest && systemData.transparentDepthPrepass;
208208
case HDLitMasterNode1.SlotMask.AlphaThresholdDepthPostpass:
209-
return systemData.surfaceType == SurfaceType.Transparent && systemData.alphaTest && builtinData.transparentDepthPostpass;
209+
return systemData.surfaceType == SurfaceType.Transparent && systemData.alphaTest && systemData.transparentDepthPostpass;
210210
case HDLitMasterNode1.SlotMask.AlphaThresholdShadow:
211211
return systemData.alphaTest && builtinData.alphaTestShadow;
212212
default:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected override void CreatePropertyGUI()
3131
AddProperty(specularOcclusionModeText, () => lightingData.specularOcclusionMode, (newValue) => lightingData.specularOcclusionMode = newValue);
3232
AddProperty(Styles.overrideBakedGI, () => lightingData.overrideBakedGI, (newValue) => lightingData.overrideBakedGI = newValue);
3333
}
34-
AddProperty(Styles.supportLodCrossFade, () => builtinData.supportLodCrossFade, (newValue) => builtinData.supportLodCrossFade = newValue);
34+
AddProperty(Styles.supportLodCrossFade, () => systemData.supportLodCrossFade, (newValue) => systemData.supportLodCrossFade = newValue);
3535
AddProperty(addPrecomputedVelocityText, () => builtinData.addPrecomputedVelocity, (newValue) => builtinData.addPrecomputedVelocity = newValue);
3636
}
3737
}

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ public SystemData systemData
3333
set => m_SystemData = value;
3434
}
3535

36-
protected virtual int ComputeMaterialNeedsUpdateHash() => 0;
36+
protected virtual int ComputeMaterialNeedsUpdateHash()
37+
{
38+
// Alpha test is currently the only property in system data to trigger the material upgrade script.
39+
int hash = systemData.alphaTest.GetHashCode();
40+
return hash;
41+
}
3742

3843
public override bool IsActive() => true;
3944

@@ -92,15 +97,6 @@ public override void Setup(ref TargetSetupContext context)
9297
if (migrationSteps.Migrate(this))
9398
OnBeforeSerialize();
9499

95-
// Migration hack to have the case where SG doesn't have version yet but is already upgraded to the stack system
96-
if (!systemData.firstTimeMigrationExecuted)
97-
{
98-
// Force the initial migration step
99-
MigrateTo(ShaderGraphVersion.FirstTimeMigration);
100-
systemData.firstTimeMigrationExecuted = true;
101-
OnBeforeSerialize();
102-
}
103-
104100
foreach (var subShader in EnumerateSubShaders())
105101
{
106102
// patch render type and render queue from pass declaration:

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ namespace UnityEditor.Rendering.HighDefinition.ShaderGraph
99
public enum ShaderGraphVersion
1010
{
1111
Initial = 0,
12-
FirstTimeMigration = Initial,
1312
}
1413
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ protected override void CreatePropertyGUI()
6565
AddProperty(transparentCullModeText, () => systemData.transparentCullMode, (newValue) => systemData.transparentCullMode = newValue);
6666
AddProperty(transparentSortPriorityText, () => systemData.sortPriority, (newValue) => systemData.sortPriority = HDRenderQueue.ClampsTransparentRangePriority(newValue));
6767
AddProperty(transparentBackfaceEnableText, () => builtinData.backThenFrontRendering, (newValue) => builtinData.backThenFrontRendering = newValue);
68-
AddProperty(transparentDepthPrepassEnableText, () => builtinData.transparentDepthPrepass, (newValue) => builtinData.transparentDepthPrepass = newValue);
69-
AddProperty(transparentDepthPostpassEnableText, () => builtinData.transparentDepthPostpass, (newValue) => builtinData.transparentDepthPostpass = newValue);
68+
AddProperty(transparentDepthPrepassEnableText, () => systemData.transparentDepthPrepass, (newValue) => systemData.transparentDepthPrepass = newValue);
69+
AddProperty(transparentDepthPostpassEnableText, () => systemData.transparentDepthPostpass, (newValue) => systemData.transparentDepthPostpass = newValue);
7070
AddProperty(transparentWritingMotionVecText, () => builtinData.transparentWritesMotionVec, (newValue) => builtinData.transparentWritesMotionVec = newValue);
7171

7272
if (lightingData != null)

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

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ protected override string renderQueue
4242
protected virtual bool supportDistortion => false;
4343
protected override bool supportRaytracing => true;
4444

45-
protected override int ComputeMaterialNeedsUpdateHash()
46-
{
47-
// Alpha test is currently the only property in buitin data to trigger the material upgrade script.
48-
int hash = systemData.alphaTest.GetHashCode();
49-
return hash;
50-
}
51-
5245
public override void Setup(ref TargetSetupContext context)
5346
{
5447
context.AddAssetDependencyPath(AssetDatabase.GUIDToAssetPath("f4df7e8f9b8c23648ae50cbca0221e47")); // SurfaceSubTarget.cs
@@ -201,15 +194,15 @@ public override void GetFields(ref TargetFieldContext context)
201194
context.AddField(HDFields.DoAlphaTestShadow, systemData.alphaTest && builtinData.alphaTestShadow && isShadowPass &&
202195
context.pass.validPixelBlocks.Contains(HDBlockFields.SurfaceDescription.AlphaClipThresholdShadow));
203196
// Pre/post pass always use the specific alpha test provided for those pass
204-
context.AddField(HDFields.DoAlphaTestPrepass, systemData.alphaTest && builtinData.transparentDepthPrepass && isTransparentDepthPrepass &&
197+
context.AddField(HDFields.DoAlphaTestPrepass, systemData.alphaTest && systemData.transparentDepthPrepass && isTransparentDepthPrepass &&
205198
context.pass.validPixelBlocks.Contains(HDBlockFields.SurfaceDescription.AlphaClipThresholdDepthPrepass));
206199

207200
// Features & Misc
208-
context.AddField(Fields.LodCrossFade, builtinData.supportLodCrossFade);
201+
context.AddField(Fields.LodCrossFade, systemData.supportLodCrossFade);
209202
context.AddField(Fields.AlphaToMask, systemData.alphaTest);
210203
context.AddField(HDFields.TransparentBackFace, builtinData.backThenFrontRendering);
211-
context.AddField(HDFields.TransparentDepthPrePass, builtinData.transparentDepthPrepass);
212-
context.AddField(HDFields.TransparentDepthPostPass, builtinData.transparentDepthPostpass);
204+
context.AddField(HDFields.TransparentDepthPrePass, systemData.transparentDepthPrepass);
205+
context.AddField(HDFields.TransparentDepthPostPass, systemData.transparentDepthPostpass);
213206

214207
context.AddField(HDFields.DepthOffset, builtinData.depthOffset && context.pass.validPixelBlocks.Contains(HDBlockFields.SurfaceDescription.DepthOffset));
215208

@@ -246,8 +239,8 @@ public override void GetActiveBlocks(ref TargetActiveBlockContext context)
246239
context.AddBlock(BlockFields.SurfaceDescription.AlphaClipThreshold, systemData.alphaTest);
247240

248241
// Alpha Test
249-
context.AddBlock(HDBlockFields.SurfaceDescription.AlphaClipThresholdDepthPrepass, systemData.alphaTest && builtinData.transparentDepthPrepass);
250-
context.AddBlock(HDBlockFields.SurfaceDescription.AlphaClipThresholdDepthPostpass, systemData.alphaTest && builtinData.transparentDepthPostpass);
242+
context.AddBlock(HDBlockFields.SurfaceDescription.AlphaClipThresholdDepthPrepass, systemData.alphaTest && systemData.transparentDepthPrepass);
243+
context.AddBlock(HDBlockFields.SurfaceDescription.AlphaClipThresholdDepthPostpass, systemData.alphaTest && systemData.transparentDepthPostpass);
251244
context.AddBlock(HDBlockFields.SurfaceDescription.AlphaClipThresholdShadow, systemData.alphaTest && builtinData.alphaTestShadow);
252245

253246
// Misc
@@ -313,7 +306,7 @@ public override void CollectShaderProperties(PropertyCollector collector, Genera
313306
// Common properties for all "surface" master nodes
314307
HDSubShaderUtilities.AddAlphaCutoffShaderProperties(collector, systemData.alphaTest, builtinData.alphaTestShadow);
315308
HDSubShaderUtilities.AddDoubleSidedProperty(collector, systemData.doubleSidedMode);
316-
HDSubShaderUtilities.AddPrePostPassProperties(collector, builtinData.transparentDepthPrepass, builtinData.transparentDepthPostpass);
309+
HDSubShaderUtilities.AddPrePostPassProperties(collector, systemData.transparentDepthPrepass, systemData.transparentDepthPostpass);
317310

318311
// Add all shader properties required by the inspector
319312
HDSubShaderUtilities.AddBlendingStatesShaderProperties(
@@ -350,19 +343,5 @@ public override void ProcessPreviewMaterial(Material material)
350343

351344
LightingShaderGraphGUI.SetupMaterialKeywordsAndPass(material);
352345
}
353-
354-
internal override void MigrateTo(ShaderGraphVersion version)
355-
{
356-
base.MigrateTo(version);
357-
358-
if (version == ShaderGraphVersion.FirstTimeMigration)
359-
{
360-
#pragma warning disable 618
361-
builtinData.transparentDepthPrepass = systemData.m_TransparentDepthPrepass;
362-
builtinData.transparentDepthPostpass = systemData.m_TransparentDepthPostpass;
363-
builtinData.supportLodCrossFade = systemData.m_SupportLodCrossFade;
364-
#pragma warning restore 618
365-
}
366-
}
367346
}
368347
}

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

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -85,29 +85,5 @@ public bool backThenFrontRendering
8585
get => m_BackThenFrontRendering;
8686
set => m_BackThenFrontRendering = value;
8787
}
88-
89-
[SerializeField]
90-
bool m_TransparentDepthPrepass;
91-
public bool transparentDepthPrepass
92-
{
93-
get => m_TransparentDepthPrepass;
94-
set => m_TransparentDepthPrepass = value;
95-
}
96-
97-
[SerializeField]
98-
bool m_TransparentDepthPostpass;
99-
public bool transparentDepthPostpass
100-
{
101-
get => m_TransparentDepthPostpass;
102-
set => m_TransparentDepthPostpass = value;
103-
}
104-
105-
[SerializeField]
106-
bool m_SupportLodCrossFade;
107-
public bool supportLodCrossFade
108-
{
109-
get => m_SupportLodCrossFade;
110-
set => m_SupportLodCrossFade = value;
111-
}
11288
}
11389
}

0 commit comments

Comments
 (0)