Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed GLES shaders compilation failing on Windows platform (not a mobile platform) due to uniform count limit.
- Fixed an issue where preset button could still be used, when it is not supposed to. [case 1246261](https://issuetracker.unity3d.com/issues/urp-reset-functionality-does-not-work-for-renderobject-preset-asset)
- Fixed an issue with URP switching such that every avaiable URP makes a total set of supported features such that all URPs are taken into consideration. [case 1157420](https://issuetracker.unity3d.com/issues/lwrp-srp-switching-doesnt-work-even-with-manually-adding-shadervariants-per-scene)
- Fixed a performance problem with ShaderPreprocessor with large amount of active shader variants in the project.

## [7.3.0] - 2020-03-11

Expand Down
21 changes: 15 additions & 6 deletions com.unity.render-pipelines.universal/Editor/ShaderPreprocessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,23 @@ public void OnProcessShader(Shader shader, ShaderSnippetData snippetData, IList<


int prevVariantCount = compilerDataList.Count;

for (int i = 0; i < compilerDataList.Count; ++i)

var inputShaderVariantCount = compilerDataList.Count;
for (int i = 0; i < inputShaderVariantCount;)
{
if (StripUnused(ShaderBuildPreprocessor.supportedFeatures, shader, snippetData, compilerDataList[i]))
{
bool removeInput = StripUnused(ShaderBuildPreprocessor.supportedFeatures, shader, snippetData, compilerDataList[i]);
if (removeInput)
compilerDataList[i] = compilerDataList[--inputShaderVariantCount];
else
++i;
}

if(compilerDataList is List<ShaderCompilerData> inputDataList)
inputDataList.RemoveRange(inputShaderVariantCount, inputDataList.Count - inputShaderVariantCount);
else
{
for(int i = compilerDataList.Count -1; i >= inputShaderVariantCount; --i)
compilerDataList.RemoveAt(i);
--i;
}
}

if (urpAsset.shaderVariantLogLevel != ShaderVariantLogLevel.Disabled)
Expand Down