diff --git a/main.cpp b/main.cpp index 3ae549f..a5f4315 100644 --- a/main.cpp +++ b/main.cpp @@ -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; }