eliemichel / LearnWebGPU-Code

The accompanying code of the Learn WebGPU C++ programming guide
https://eliemichel.github.io/LearnWebGPU
MIT License
90 stars 23 forks source link

Handling window resize with new WebGPU API #43

Open IgorAlexey opened 6 days ago

IgorAlexey commented 6 days ago

This feels like an extremely fundamental problem, but since the swapchain was gunned down, I've been continually getting segmentation errors when attempting to reimplement resize

The related resources I've found, haven't proven applicable to C++

Redditsotrh.github.io

It seems like they can simply unconfigure the surface, replace dimensions in surface config and reconfigure.

However, GLFW appears to be destroying the surface in a resize? Getting another surface with 'glfwGetWGPUSurface' worked previously but not in this version.

eliemichel commented 6 days ago

Which backend do you use (dawn or wgpu-native)? I never had to re-query the surface when resizing, I believe you shouldn't need to call glfwGetWGPUSurface again.

IgorAlexey commented 5 days ago

Hi @eliemichel! I'm using wgpu-native

eliemichel commented 3 hours ago

SOrry for the late reply: here is a variant of step30 that supports resizing: step030-resize. Tested with wgpu-native on Windows, let me know if it works for you, and if it does not please share a detailed log!