Fix wgpu image bindgroups and updates to latest webgpu-native #8426
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On WebGPU backend, in order to display an image, an ImageBindGroup needs to be created for every new textureView. The backend creates and caches these imagebindgroups but it doesn't consider the fact that textureviews can be created/destroyed on the user side.
The webgpu backend can reuse the pointer for the textureview side, so when the user destroys and creates a new textureview, the cached imagebindgroup will try to use a destroyed resource and probably crash.
In order to fix it, we remove the imagebindgroups created during render on every frame.
This PR also updates the code to the latest webgpu-native, where some changes there were breaking the compilation
This issue is been also referenced in #8046, #7765, and #8027
Use case
I had to deal with this because I'm making an example where I render several off-screen shaders, and then I compose the final result with Imgui. Whenever I resize one of the windows, internally it will create a new texture/texture-view that needs to be displayed. When I tried with the current wgpu backend code, it was failing, and end up crashing because It was reusing invalid bindgroups cached internally, and eventually it will also crash due to the 100 limit size.