From 22241924c9669ceab2beb564beb51117d79a2e0c Mon Sep 17 00:00:00 2001 From: Rezmason Date: Thu, 8 May 2025 18:11:06 -0700 Subject: [PATCH] regl's destroy function destroys all resources created with it; so does GPUDevice::destroy. --- TODO.txt | 1 - js/regl/main.js | 2 +- js/webgpu/main.js | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/TODO.txt b/TODO.txt index f229c72..d4b9f6d 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,5 +1,4 @@ TODO: - Explicitly destroy what gets created Create multiple distributions core One embedded MSDF, combined from the two main glyph sets and their configs diff --git a/js/regl/main.js b/js/regl/main.js index 1c90664..692ebc5 100644 --- a/js/regl/main.js +++ b/js/regl/main.js @@ -162,7 +162,7 @@ export const destroy = (rain) => { window.removeEventListener("dblclick", doubleClick); cache.clear(); tick.cancel(); // stop RAF - regl.destroy(); // release all GPU resources & event listeners + regl.destroy(); // releases all GPU resources & event listeners rain.destroyed = true; }; diff --git a/js/webgpu/main.js b/js/webgpu/main.js index ca69d8b..6030d2e 100644 --- a/js/webgpu/main.js +++ b/js/webgpu/main.js @@ -209,8 +209,7 @@ export const destroy = (rain) => { window.removeEventListener("dblclick", doubleClick); cache.clear(); cancelAnimationFrame(renderLoop); // stop RAF - // TODO: destroy WebGPU resources - device.destroy(); + device.destroy(); // This also destroys any objects created with the device rain.destroyed = true; };