Boost performance of groups with blend_mode != PassThrough #1269
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTE: This is a performance PR so this would need a little testing, also it should be merged after Pixelorama 1.1.2 gets released (just a preference, not a requirement)
Attempt at solving #1250. Boosts the performance of GroupLayers to roughly twice (47% to be precise) it's current state by introducing cache.
In consecutive generations, when the shader is same, calling
RenderingServer.material_set_shader
again and again (ingenerate_image()
) takes up unnecessary computation time (Which makes up most of the 47% time i talked about -- per generation). There is now a way to reuse the material in last generation for the next one.when a GroupLayer gets blended, if it has another GroupLayer as child, even if the contents of child GroupLayer didn't change, it ends up being re-blended regardless. To fix this there is now a cache which save time if the contents of a GroupLayer didn't change.
As it uses cache this takes up a little more memory but it's not noticeable.