Skip to content

Commit

Permalink
refactor: optimize multiple destroy framebuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
06wj committed Jan 20, 2021
1 parent 6667e5c commit c68599e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/renderer/Framebuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,24 @@ const Framebuffer = Class.create(/** @lends Framebuffer.prototype */ {

return pixels;
},
/**
* 销毁资源
* @return {Framebuffer} this
*/
destroy() {
if (this._isDestroyed) {
return this;
}
this.destroyResource();
this.gl = null;
cache.removeObject(this);

this._isDestroyed = true;
return this;
},
/**
* 销毁资源
* 只销毁 gl 资源
* @return {Framebuffer} this
*/
destroyResource() {
const gl = this.gl;
Expand Down

0 comments on commit c68599e

Please sign in to comment.