mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-17 05:49:30 -07:00
WebGPU Renderer now awaits the submitted work in the old device's queue before destroying it
This commit is contained in:
@@ -184,6 +184,7 @@ export default class REGLRenderer extends Renderer {
|
||||
await this.#rebuildingPipeline;
|
||||
this.#renderFunc(performance.now());
|
||||
if (oldDevice != null) {
|
||||
await oldDevice.queue.onSubmittedWorkDone();
|
||||
oldDevice.destroy();
|
||||
}
|
||||
}
|
||||
@@ -202,10 +203,14 @@ export default class REGLRenderer extends Renderer {
|
||||
|
||||
destroy() {
|
||||
if (this.destroyed) return;
|
||||
if (this.#device != null) {
|
||||
this.#device.destroy(); // This also destroys any objects created with the device
|
||||
this.#device = null;
|
||||
const oldDevice = this.#device;
|
||||
if (oldDevice != null) {
|
||||
(async () => {
|
||||
await oldDevice.queue.onSubmittedWorkDone();
|
||||
oldDevice.destroy();
|
||||
});
|
||||
}
|
||||
this.#device = null;
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user