Prevent image flash when switching between texture formats#513
Conversation
There was a problem hiding this comment.
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.