webgpu / webgpureport.org

A website to show WebGPU info
https://webgpureport.org
49 stars 8 forks source link

Add Shared Worker support #12

Closed beaufortfrancois closed 8 months ago

beaufortfrancois commented 8 months ago

Following https://github.com/gpuweb/gpuweb/pull/4465, this PR adds Shared Worker support to webgpureport.org.

The following screenshot shows on the left when it's not supported (Safari Tech Preview), and on the right when it's supported (Chrome Canary with Experimental Web Platform features flag enabled).

image

greggman commented 8 months ago

I think adding this is fine but there's a few issues

  1. merge conflicts (no longer manually appending to body. Instead call addElemToDocument
  2. fails in safari
  3. probably shouldn't check requestAnimationFrame in a SharedWorker since, IIUC, that would make no sense?
greggman commented 8 months ago

Also, checking for es6 modules broke but I think you can just remove that check if you want. It was only there because Firefox didn't support it but they've fixed that so probably no longer important to display. Or, make it check that only for dedicated workers.

beaufortfrancois commented 8 months ago
  1. merge conflicts (no longer manually appending to body. Instead call addElemToDocument

Done.

  1. fails in safari

I've added port.onmessageerror in worker.js as it was failing in Safari. Thanks for catching!

  1. probably shouldn't check requestAnimationFrame in a SharedWorker since, IIUC, that would make no sense?

I've removed it.

Also, checking for es6 modules broke but I think you can just remove that check if you want. It was only there because Firefox didn't support it but they've fixed that so probably no longer important to display. Or, make it check that only for dedicated workers.

I've removed checking for es6 modules.