So far we would differ from Web by handling pixel density automatically. But something interesting happened while working on resize.
Since the client size is update on the UI thread and right now the WGPU run on JS thread, instead of locking (changing the size during the render will result in faulty descriptors) I implemented something that fits the web semantic:
UI thread writes clientWidth/clientHeight
JS thread "transaction" width/height from the clientWidth/clientHeight
Interestingly enough this remove the last part where we were different from the web. Now the user has to write:
canvas.width = canvas.clientWidth * pixelRatio
The resize example is now identical from its web version.
So we implemented resize by being even more symmetric with the Web :)
So far we would differ from Web by handling pixel density automatically. But something interesting happened while working on resize. Since the client size is update on the UI thread and right now the WGPU run on JS thread, instead of locking (changing the size during the render will result in faulty descriptors) I implemented something that fits the web semantic:
Interestingly enough this remove the last part where we were different from the web. Now the user has to write:
canvas.width = canvas.clientWidth * pixelRatio
The resize example is now identical from its web version. So we implemented resize by being even more symmetric with the Web :)