Skip to content
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

Ensure instance uniforms are freed by updating dirty items before freeing #102503

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

clayjohn
Copy link
Member

@clayjohn clayjohn commented Feb 6, 2025

Fixes: #101663

update_dirty_items() goes through the list of canvas items that have instance uniforms that have changed and updates/allocates them as needed. By default it always allocates space if the canvas item hasn't had instance uniforms allocated. Therefore, immediately after freeing the instance uniform we were re-allocating it and then freeing the canvas item and leaking that memory.

This PR fixes the issue by ensuring all the dirty items are updated before freeing.

Targeting 4.4 since this is a serious problem with the new 2D instance uniform system.

akien-mga added a commit to akien-mga/godot that referenced this pull request Feb 7, 2025
…free

Ensure instance uniforms are freed by updating dirty items before freeing
@akien-mga akien-mga merged commit d497631 into godotengine:master Feb 7, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@clayjohn clayjohn deleted the instance-uniform-free branch February 25, 2025 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

With instance uniform shader 2D, queue_free instances don't clear the buffer
3 participants