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:
Explicitly destroy what gets created
Create multiple distributions
core
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);
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;
};

View File

@@ -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;
};