Skip to content

Commit

Permalink
fix: force context release when disposing renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Aug 12, 2024
1 parent 67b08df commit 11e0860
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thatopen/components",
"description": "Collection of core functionalities to author BIM apps.",
"version": "2.1.23",
"version": "2.1.24",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/core/Components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Components implements Disposable {
/**
* The version of the @thatopen/components library.
*/
static readonly release = "2.1.23";
static readonly release = "2.1.24";

/** {@link Disposable.onDisposed} */
readonly onDisposed = new Event<void>();
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/core/Cullers/src/culler-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export class CullerRenderer {
}
this.onViewUpdated.reset();
this.worker.terminate();
this.renderer.forceContextLoss();
this.renderer.dispose();
this.renderTarget.dispose();
(this._buffer as any) = null;
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/core/MiniMap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export class MiniMap implements Resizeable, Updateable, Disposable {
this.onAfterUpdate.reset();
this.onResize.reset();
this.overrideMaterial.dispose();
this.renderer.forceContextLoss();
this.renderer.dispose();
this.onDisposed.trigger();
this.onDisposed.reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ void main() {
this.enabled = false;
this.onDistanceComputed.reset();
this.worker.terminate();
this.renderer.forceContextLoss();
this.renderer.dispose();
this.tempRT.dispose();
this.resultRT.dispose();
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/core/Worlds/src/simple-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class SimpleRenderer extends BaseRenderer {
this.enabled = false;
this.setupEvents(false);
this.three.domElement.remove();
this.three.forceContextLoss();
this.three.dispose();
// this._renderer2D.domElement.remove();
this.onResize.reset();
Expand Down
2 changes: 1 addition & 1 deletion packages/front/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thatopen/components-front",
"description": "Collection of frontend tools to author BIM apps.",
"version": "2.1.25",
"version": "2.1.26",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export class Postproduction {
* It releases the memory occupied by the render target, depth texture, custom effects pass, gamma pass, and N8AO pass.
*/
dispose() {
this.composer.dispose();
this._renderTarget.dispose();
this._depthTexture?.dispose();
this._customEffects?.dispose();
Expand Down

0 comments on commit 11e0860

Please sign in to comment.