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 fc64276 commit cfb4d1d
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 @@ -336,6 +336,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 cfb4d1d

Please sign in to comment.