diff --git a/com.unity.shadergraph/CHANGELOG.md b/com.unity.shadergraph/CHANGELOG.md index b89c94eebf7..87586735410 100644 --- a/com.unity.shadergraph/CHANGELOG.md +++ b/com.unity.shadergraph/CHANGELOG.md @@ -131,6 +131,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed incorrect warning while using VFXTarget - Fixed a bug with Sprite Targets in ShaderGraph not rendering correctly in game view [1352225] - Fixed compilation problems on preview shader when using hybrid renderer v2 and property desc override Hybrid Per Instance +- Fixed a serialization bug wrt PVT property flags when using subgraphs. This fixes SRP batcher compatibility. ## [11.0.0] - 2020-10-21 diff --git a/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs b/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs index 96ab069bbcb..5f234b2d30e 100644 --- a/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs +++ b/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs @@ -75,9 +75,8 @@ internal override void ForeachHLSLProperty(Action action) int numLayers = value.layers.Count; if (numLayers > 0) { - HLSLDeclaration decl = HLSLDeclaration.UnityPerMaterial; - if (value.procedural) - decl = GetDefaultHLSLDeclaration(); + // PVT should always be Global to be compatible with SRP batcher + HLSLDeclaration decl = (value.procedural) ? HLSLDeclaration.Global : HLSLDeclaration.UnityPerMaterial; action(new HLSLProperty(HLSLType._CUSTOM, referenceName + "_CBDecl", decl, concretePrecision) { @@ -206,8 +205,11 @@ internal void AddTextureInfo(List infos) public override void OnAfterDeserialize(string json) { - // VT shader properties must always be exposed - generatePropertyBlock = true; + if (!value.procedural) + { + // non procedural VT shader properties must always be exposed + generatePropertyBlock = true; + } } } }