diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c0051e..bf88faa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ ## v3.7.2 +### Features +* Strip Meta pass from shaders that have it. + ### Changes * Moved the code to ensure texture samplers exist at the end of the fragment instead of the beginning. * This improves performance with poi fur. diff --git a/Editor/ShaderAnalyzer.cs b/Editor/ShaderAnalyzer.cs index 54e1cf1..ae64f5e 100644 --- a/Editor/ShaderAnalyzer.cs +++ b/Editor/ShaderAnalyzer.cs @@ -3077,6 +3077,23 @@ private List Run() { knownDefines.Peek()[lightModeDefine.Value] = (lightMode == lightModeDefine.Key, null); } + if (lightMode == "Meta") + { + while (output[output.Count - 1] != "Pass") + { + output.RemoveAt(output.Count - 1); + } + output.RemoveAt(output.Count - 1); + int curlyBraceDepthUntilEndOfPass = 2; + while (curlyBraceDepthUntilEndOfPass > 0) + { + line = lines[++lineIndex]; + curlyBraceDepthUntilEndOfPass += line == "{" ? 1 : 0; + curlyBraceDepthUntilEndOfPass -= line == "}" ? 1 : 0; + passID += line == "CGPROGRAM" || line == "HLSLPROGRAM" ? 1 : 0; + } + output.Add("// Meta pass removed"); + } } else if (line == "CGPROGRAM" || line == "HLSLPROGRAM") {