diff --git a/com.unity.shadergraph/Editor/Generation/Processors/GenerationUtils.cs b/com.unity.shadergraph/Editor/Generation/Processors/GenerationUtils.cs index 83c7bb39017..f88aff5aee8 100644 --- a/com.unity.shadergraph/Editor/Generation/Processors/GenerationUtils.cs +++ b/com.unity.shadergraph/Editor/Generation/Processors/GenerationUtils.cs @@ -149,10 +149,14 @@ internal static void GeneratePackedStruct(StructDescriptor shaderStruct, ActiveF if (fieldIsActive) { + // special case, "UNITY_STEREO_INSTANCING_ENABLED" fields must be packed at the end of the struct because they are system generated semantics + // + if (subscript.HasPreprocessor() && (subscript.preprocessor.Contains("INSTANCING"))) + postUnpackedSubscripts.Add(subscript); // special case, "SHADER_STAGE_FRAGMENT" fields must be packed at the end of the struct, // otherwise the vertex output struct will have different semantic ordering than the fragment input struct. // - if (subscript.HasPreprocessor() && (subscript.preprocessor.Contains("SHADER_STAGE_FRAGMENT"))) + else if (subscript.HasPreprocessor() && (subscript.preprocessor.Contains("SHADER_STAGE_FRAGMENT"))) postUnpackedSubscripts.Add(subscript); else if (subscript.HasSemantic() || subscript.vectorCount == 0) packedSubscripts.Add(subscript);