diff --git a/main.cpp b/main.cpp index 2b24923..b498b31 100644 --- a/main.cpp +++ b/main.cpp @@ -296,6 +296,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; }