-
Notifications
You must be signed in to change notification settings - Fork 349
Prevent image flash when switching between texture formats #513
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
Conversation
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.
To fix the flash,
In createVolumeTexture, move the call to createTexture to after the stream has been decompressed.
The reason it flashes is because
- it creates a blank texture
- it asynchronously waits for data to decompress - may take multiple frames during which the texture is transparent black
- it then finally writes the data into the texture
You should never need to call onScheduledWorkDone. It's sole purpose is ATM is throttling.
I think it's better to fail early with non-supported texture formats rather than downloading the resource and then fail.
I'm happy to remove |
The code already exits at line 147 if the format is not supported. |
Even though |
|
@mwyrzykowski FYI As you can see below, the canvas still behaves weirdly in Safari Tech Preview Release 218 (Safari 18.4, WebKit 20622.1.10.19.1) safari-flash.mov |
You could change the code to If you wanted some other error related to texture creation to show up first. |
An image flash occurs when switching between texture formats. I believe it happens because writeTexture may not be complete causing the canvas to use incomplete texture data.