Skip to content

Commit

Permalink
Release surface texture
Browse files Browse the repository at this point in the history
  • Loading branch information
eliemichel committed Oct 25, 2024
1 parent 96833bc commit 40d0962
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@ TextureView Application::GetNextSurfaceTextureView() {
viewDescriptor.aspect = TextureAspect::All;
TextureView targetView = texture.createView(viewDescriptor);

#ifndef WEBGPU_BACKEND_WGPU
// We no longer need the texture, only its view
// (NB: with wgpu-native, surface textures must not be manually released)
Texture(surfaceTexture.texture).release();
#endif // WEBGPU_BACKEND_WGPU

return targetView;
}

Expand Down

0 comments on commit 40d0962

Please sign in to comment.