Skip to content

fix: immediately upload sprites when they become visible again #3087

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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

contariaa
Copy link
Contributor

When a sprite becomes active again after skipping uploads, it won't immediately update to its correct state, instead it will only do so the next time the frame index changes.
I initially fixed this by just ensuring it will always upload the first tick after becoming active again, however that still leaves the time between being marked as active and being ticked where the texture would be wrong.
The fix for that is to ensure the upload right when the sprite is marked as active, which means we have to look up and bind the atlas texture everytime that happens. I'm unsure about the performance cost of that, if it's a problem I can revert the second commit, the first one alone is still significantly better than the current behaviour.

Closes #2514

this still has a small delay between the sprite being marked as active again and the sprite being ticked
to fix that the SpriteContents.Ticker could be stored in SpriteContents and ensureUpload() called when the sprite is marked as active (after being inactive)
return;
}

Minecraft.getInstance().getTextureManager().getTexture(atlas).bind();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisiting this, its probably problematic to change the bound texture here since we can't know at what point in the code a sprite is being marked active and it might mess up render state.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue is not present with just the first commit, but as stated in the initial pr message the behaviour from just the first commit is not 100% correct since it leaves a delay between the texture becoming visible and when its reticked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Animated GUI textures with repeated frames can desync/freeze when Only Animate Visible Textures is enabled
1 participant