RESOLVED CONFIGURATION CHANGED 229986
WebGL Canvas will not update when using putImageData with small area update.
https://bugs.webkit.org/show_bug.cgi?id=229986
Summary WebGL Canvas will not update when using putImageData with small area update.
lktc420
Reported 2021-09-07 02:26:43 PDT
Created attachment 437468 [details] The issue html that can reproduce the bug. Overview: When using Three.js WebGLRender and use canvas texture, if the canvas call putImageData with small area, the associate WebGL canvas will not update image. Steps to Reproduce: You can 100% easily reproduce the bug using the attachment index.html. Just click the page to see if the canvas update and showing a small rect with random color updating. And see this comment in file: // Without below 2 lines, the webgl canvas will not update. // textureCanvasCtx.fillStyle = '#00000000'; // textureCanvasCtx.fillRect(0, 0, 0, 1); this is the workaround to fix it. Also, when enable canvas recording in inspector, the webgl canvas will update correctly, wierd problem. Actual Results: When click page, webgl canvas not updating to show the small rect. Expected Results: When click page, webgl canvas should updating to show the small rect. Build Date & Hardware: MacOS 11.5.2 Safari 14.1.2
Attachments
The issue html that can reproduce the bug. (4.14 KB, text/html)
2021-09-07 02:26 PDT, lktc420
no flags
lktc420
Comment 1 2021-09-07 02:27:58 PDT
I tested chrome and firefox, both are ok.
lktc420
Comment 2 2021-09-07 02:31:04 PDT
Also u can change the image size up to 400*400, then its ok.
Kenneth Russell
Comment 3 2021-09-07 11:42:59 PDT
Is there a size threshold for enabling something like GPU-accelerated 2D canvas? Does the associated 2D canvas->WebGL texture uploading code need to take non-accelerated canvases into account?
Kenneth Russell
Comment 4 2021-09-07 12:48:52 PDT
I haven't debugged into this but this is failing on Safari Technology Preview as well as Safari 14. Was thinking maybe the ImageData constructor leaving off the optional height argument was buggy, but specifying the height didn't fix this bug.
lktc420
Comment 5 2021-09-07 19:09:22 PDT
Plz also notice that when enable canvas recording in inspector, the problem disappear during the recording. The canvas can update during the recording.
Kimmo Kinnunen
Comment 6 2021-09-10 06:56:51 PDT
Thanks for the report! I did a layout test for this, but not a fix yet. After the first update, the putImageData is buggy due to some shortcutting that is visible to getImageData but is not visible when reading with WebGL. Probably related to flushes and the fact that putImageData puts the data into the memory area past CG context bookkeeping.
Radar WebKit Bug Importer
Comment 7 2021-09-14 02:27:21 PDT
Brent Fulgham
Comment 8 2022-06-23 14:15:35 PDT
We believe this is working properly in STP 145 (and newer), and in the upcoming Safari release (available in Beta now).
Note You need to log in before you can comment on or make changes to this bug.