regl's destroy function destroys all resources created with it; so does GPUDevice::destroy.

This commit is contained in:
Rezmason
2025-05-08 18:11:06 -07:00
parent 319b53919b
commit 22241924c9
3 changed files with 2 additions and 4 deletions

View File

@@ -1,5 +1,4 @@
TODO: TODO:
Explicitly destroy what gets created
Create multiple distributions Create multiple distributions
core core
One embedded MSDF, combined from the two main glyph sets and their configs One embedded MSDF, combined from the two main glyph sets and their configs

View File

@@ -162,7 +162,7 @@ export const destroy = (rain) => {
window.removeEventListener("dblclick", doubleClick); window.removeEventListener("dblclick", doubleClick);
cache.clear(); cache.clear();
tick.cancel(); // stop RAF tick.cancel(); // stop RAF
regl.destroy(); // release all GPU resources & event listeners regl.destroy(); // releases all GPU resources & event listeners
rain.destroyed = true; rain.destroyed = true;
}; };

View File

@@ -209,8 +209,7 @@ export const destroy = (rain) => {
window.removeEventListener("dblclick", doubleClick); window.removeEventListener("dblclick", doubleClick);
cache.clear(); cache.clear();
cancelAnimationFrame(renderLoop); // stop RAF cancelAnimationFrame(renderLoop); // stop RAF
// TODO: destroy WebGPU resources device.destroy(); // This also destroys any objects created with the device
device.destroy();
rain.destroyed = true; rain.destroyed = true;
}; };