Skip to content

Commit

Permalink
Strip Meta pass from shaders that have it.
Browse files Browse the repository at this point in the history
  • Loading branch information
d4rkc0d3r committed Jun 21, 2024
1 parent b6f54c2 commit 04fe913
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
17 changes: 17 additions & 0 deletions Editor/ShaderAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3077,6 +3077,23 @@ private List<string> 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")
{
Expand Down

0 comments on commit 04fe913

Please sign in to comment.