lukexor / tetanes

A cross-platform NES emulator written in Rust using wgpu
https://lukeworks.tech/tetanes-part-1
Apache License 2.0
161 stars 18 forks source link

Enable `webgpu` support #297

Closed lukexor closed 3 months ago

lukexor commented 3 months ago

WebGPU is a new standard coming to browsers, and the primary reason for switching to using wgpu as it's more performant than WebGL and aligns with modern graphics APIs. Firefox is behind in supporting it and stability is still a bit shaky across platforms.

Enabling it is super simply:

An attempt was made to have this enabled previously, but some issues were encountered when trying to load in Chrome on Linux. Worth another go and seeing how it performs across different platforms.

One possible solution if there are still issues is to try and catch any errors creating the Painter when using the BROWSER_WEBGPU backend, and trying to fallback to GL, similar to how it's currently falling back if the default adapter limits aren't supported on the platform.

See: https://developer.mozilla.org/en-US/docs/Web/API/WebGPU_API#browser_compatibility