From 88ee15d4e869aad11bf51e0ac37438b16eb49006 Mon Sep 17 00:00:00 2001 From: Elie Michel Date: Fri, 25 Oct 2024 18:59:21 +0200 Subject: [PATCH] Release surface texture --- main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.cpp b/main.cpp index c09464b..d29aa18 100644 --- a/main.cpp +++ b/main.cpp @@ -262,6 +262,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; }