LearnWebGPU-Code icon indicating copy to clipboard operation
LearnWebGPU-Code copied to clipboard

Handling window resize with new WebGPU API

Open IgorAlexey opened this issue 1 year ago • 3 comments
trafficstars

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.

IgorAlexey avatar Jun 27 '24 04:06 IgorAlexey

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.

eliemichel avatar Jun 27 '24 06:06 eliemichel

Hi @eliemichel! I'm using wgpu-native

IgorAlexey avatar Jun 27 '24 18:06 IgorAlexey

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!

eliemichel avatar Jul 03 '24 07:07 eliemichel