-
Notifications
You must be signed in to change notification settings - Fork 856
Fixed performance problem of ShaderPreprocessor #470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed performance problem of ShaderPreprocessor #470
Conversation
List.RemoveAt method would copy the elements around, doing so in a huge iteration breaks the performance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this and submitting the PR. I've made a suggestion to check performance of another solution.
} | ||
compilerDataList.Clear(); | ||
foreach(var i in final) | ||
compilerDataList.Add(i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried about this solution, the list here might still be huge. I've looked at HDRP solution.
They do it in place with a single list. Instead of removing, they swap i
with last item
. Then they decrement last item index
. At the end, they remove all elements at once from last item index
to list size. Would you be interested in looking at this solution and comparing performance?
// here's the HDRP code, ignore the inner loop about asset
https://github.com/Unity-Technologies/Graphics/blob/master/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPPreprocessShaders.cs#L256-L295
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the size of the list is the final result, I think it can't be reduced further more? it only adds the variants which are not striped, but sure I'd like to take a look at the implementation of HDRP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation of HDRP is indeed better, so I modified the PR to adopt HDRP's way for doing it
Changed base to a local branch so we run test automation. Thanks for adding changelog! |
750e587
into
Unity-Technologies:universal/improve-shader-stripping
* Fixed performance problem of ShaderPreprocessor List.RemoveAt method would copy the elements around, doing so in a huge iteration breaks the performance * Added changlog for shader preprocessor fix * Improved the variant striping * Fixed typo Co-authored-by: liiir1985 <liiir1985@users.noreply.github.com>
* Fixed performance problem of ShaderPreprocessor List.RemoveAt method would copy the elements around, doing so in a huge iteration breaks the performance * Added changlog for shader preprocessor fix * Improved the variant striping * Fixed typo Co-authored-by: liiir1985 <liiir1985@users.noreply.github.com>
* Fixed performance problem of ShaderPreprocessor List.RemoveAt method would copy the elements around, doing so in a huge iteration breaks the performance * Added changlog for shader preprocessor fix * Improved the variant striping * Fixed typo Co-authored-by: liiir1985 <liiir1985@users.noreply.github.com> # Conflicts: # com.unity.render-pipelines.universal/CHANGELOG.md
* Fixed performance problem of ShaderPreprocessor List.RemoveAt method would copy the elements around, doing so in a huge iteration breaks the performance * Added changlog for shader preprocessor fix * Improved the variant striping * Fixed typo Co-authored-by: liiir1985 <liiir1985@users.noreply.github.com> Co-authored-by: liiir1985 <liiir1985@users.noreply.github.com>
* Fixed performance problem of ShaderPreprocessor List.RemoveAt method would copy the elements around, doing so in a huge iteration breaks the performance * Added changlog for shader preprocessor fix * Improved the variant striping * Fixed typo Co-authored-by: liiir1985 <liiir1985@users.noreply.github.com> # Conflicts: # com.unity.render-pipelines.universal/CHANGELOG.md # Conflicts: # com.unity.render-pipelines.universal/CHANGELOG.md
…) (Unity-Technologies#500) * Fixed performance problem of ShaderPreprocessor List.RemoveAt method would copy the elements around, doing so in a huge iteration breaks the performance * Added changlog for shader preprocessor fix * Improved the variant striping * Fixed typo Co-authored-by: liiir1985 <liiir1985@users.noreply.github.com> # Conflicts: # com.unity.render-pipelines.universal/CHANGELOG.md # com.unity.render-pipelines.universal/Editor/ShaderPreprocessor.cs
…) (Unity-Technologies#500) * Fixed performance problem of ShaderPreprocessor List.RemoveAt method would copy the elements around, doing so in a huge iteration breaks the performance * Added changlog for shader preprocessor fix * Improved the variant striping * Fixed typo Co-authored-by: liiir1985 <liiir1985@users.noreply.github.com> # Conflicts: # com.unity.render-pipelines.universal/CHANGELOG.md # com.unity.render-pipelines.universal/Editor/ShaderPreprocessor.cs
List.RemoveAt method would copy the elements around, doing so in a huge enumeration breaks the performance,
Purpose of this PR
Testing status
Manual Tests