diff --git a/com.unity.shadergraph/CHANGELOG.md b/com.unity.shadergraph/CHANGELOG.md index 464c34adf10..5ceccf916f8 100644 --- a/com.unity.shadergraph/CHANGELOG.md +++ b/com.unity.shadergraph/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue where SamplerState properties could not be renamed after creation [1336126] - Fixed the incorrect value written to the VT feedback buffer when VT is not used. - 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. ## [10.6.0] - 2021-04-29 diff --git a/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs b/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs index 2787f047a48..f827117f96b 100644 --- a/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs +++ b/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs @@ -74,9 +74,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; + } } } }