Image Save/Copy Issue - Grabs Previous Image Instead of Current One
When trying to copy or save an image on the demo webpage, it always takes the previous image instead of the currently displayed one. Additionally, if you attempt to copy or save the first generated image, it results in a transparent 512x512 image instead.
Steps to reproduce:
- Generate an image.
- Attempt to copy or save the first generated image.
- Generate another image.
- Attempt to copy or save the second image.
Expected results:
- The first image should be copied/saved as a proper image.
- The second image should be copied/saved.
Actual results:
- The first image results in a transparent 512x512 image when copied/saved.
- The first image is copied/saved instead of the second image.
Environment:
- Operating System: Windows 11
- Browser: Chrome Canary Version 114.0.5715.0 (Official Build) canary (64-bit), launched with --enable-dawn-features=disable_robustness
- GPU: Radeon RX 7900 XTX
Please investigate this issue, as it prevents users from properly saving or copying the most recent image.
This is indeed an odd issue. The same thing happens if you try and get the image programmatically from the canvas. I am wondering if it's a WebGPU issue or if the code as is needs some kind of finalization step.
Interestingly, after moving to using a Web Worker with an OffscreenCanvas this issue went away.
I am experiencing this issue as well. Thank you @DustinBrett for the suggestion, modifying the code to use an offscreen canvas worked.