compute-toys / wgpu-compute-toy

Cross-platform compute shader engine
https://compute.toys
MIT License
119 stars 16 forks source link

Handle updated framebuffer #2

Closed pudnax closed 1 year ago

pudnax commented 1 year ago

I wasn't able to run compute.toy on linux. Linux calls resizing immediately at the start of the program and invalidates current surface.

With this PR I'm adding support for surface resizing. Out of GPU memory case is not handled. In native I'll just stop the main loop, but I don't know what to do in web (perhaps nothing, because it wasn't handled before either).

[2023-05-07T17:54:16Z ERROR wgputoy] Unable to get framebuffer: The underlying surface has changed, and therefore the swap chain must be updated

I also changed a bit about how to choose the surface format. I give priority to Rgba8Unorm and Bgra8Unorm formats and store surface config instead of just surface format.

davidar commented 1 year ago

Thanks!