From 5b028f93b5001e7c7063ea7e31671350cc7627b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tarkan=20Sar=C4=B1ta=C5=9F?= <43671468+Nefistofeles@users.noreply.github.com> Date: Thu, 8 Aug 2024 03:06:58 +0300 Subject: [PATCH] Update first-color.md // At the end of the frame wgpuTextureRelease(surfaceTexture.texture); Destroy texture to prevent memory leak after rendering. --- getting-started/first-color.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/getting-started/first-color.md b/getting-started/first-color.md index c0a804f..2e0ec01 100644 --- a/getting-started/first-color.md +++ b/getting-started/first-color.md @@ -241,6 +241,7 @@ Of course we must release this view once we no longer need it, just before prese ```{lit} C++, Present the surface onto the window // At the end of the frame wgpuTextureViewRelease(targetView); +wgpuTextureRelease(surfaceTexture.texture); ``` ### Presenting @@ -259,6 +260,7 @@ As a consequence, we **must not** call `wgpuSurfacePresent()` when building with ```{lit} C++, Present the surface onto the window (replace) // At the end of the frame wgpuTextureViewRelease(targetView); +wgpuTextureRelease(surfaceTexture.texture); #ifndef __EMSCRIPTEN__ wgpuSurfacePresent(surface); #endif