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

Document GradientTexture updates being deferred #80855

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Aug 21, 2023

I don't know if a new force_update() method could be added, but that's proposal territory.

@Calinou Calinou requested a review from a team as a code owner August 21, 2023 15:40
@Calinou Calinou added enhancement documentation cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release labels Aug 21, 2023
@Calinou Calinou added this to the 4.2 milestone Aug 21, 2023
@KoBeWi
Copy link
Member

KoBeWi commented Aug 29, 2023

#81137 ensured that get_image() gives correct results. However the update is still deferred, so unless you force it (which get_image() does), the actual update will happen at the end of the frame.

I'm not sure about the "after 2 frames" part. Deferred class still happen in the same frame, just after everything else (see #77688), so the texture might be correct immediately. If that is really the case, this PR can be closed.

EDIT:
By "correct" I mean display correctly.

@YuriSizov
Copy link
Contributor

YuriSizov commented Oct 30, 2023

Deferred class still happen in the same frame, just after everything else

This still means that you need to wait until the next frame to access the image (or use a deferred call in a script as well), does it not?

@KoBeWi
Copy link
Member

KoBeWi commented Oct 30, 2023

As I said, get_image() doesn't require waiting. The update itself is deferred, but not sure if it affects anything. Maybe the texture displays old data for a single frame.

@YuriSizov
Copy link
Contributor

Ah, I see what's going on. get_image() specifically forces an update. Then indeed, this shouldn't require you wait for the next frame. It should be available immediately, unless RenderingServer::texture_replace is somehow deferred. But it doesn't appear this way.

I'm going to close this PR then. Thanks!

@YuriSizov YuriSizov closed this Oct 30, 2023
@YuriSizov YuriSizov removed this from the 4.2 milestone Oct 30, 2023
@YuriSizov YuriSizov added archived and removed cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release labels Oct 30, 2023
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.

get_image() gives wrong result on GradientTexture2D
3 participants