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 1adb1c3 commit 64fab5e
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 @@ -268,6 +268,12 @@ WGPUTextureView Application::GetNextSurfaceTextureView() {
viewDescriptor.aspect = WGPUTextureAspect_All;
WGPUTextureView targetView = wgpuTextureCreateView(surfaceTexture.texture, &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)
wgpuTextureRelease(surfaceTexture.texture);
#endif // WEBGPU_BACKEND_WGPU

return targetView;
}

Expand Down

0 comments on commit 64fab5e

Please sign in to comment.