Skip to content

Commit

Permalink
forgot to commit code
Browse files Browse the repository at this point in the history
  • Loading branch information
gre committed May 20, 2017
1 parent bf366d2 commit 5617f2b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/gl-react/src/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,10 @@ export default class Node extends Component {
// We should only dispose() if gl is still here.
// otherwise, GL should already have free resources.
// (also workaround for https://github.com/stackgl/headless-gl/issues/90)
const { framebuffer, backbuffer } = this;
const { framebuffer, backbuffer, _shader } = this;
if (_shader) {
_shader.dispose();
}
if (framebuffer) {
framebuffer.dispose();
}
Expand Down Expand Up @@ -707,7 +710,7 @@ export default class Node extends Component {
}

_latestShaderInfo: ?ShaderInfo;
_shader: ?Shader;
_shader: ?Shader; // in case of inline shader, a Node currently hold a Node

_getShader(shaderProp: mixed): Shader {
const { glSurface } = this.context;
Expand All @@ -728,6 +731,10 @@ export default class Node extends Component {
!latestShaderInfo ||
!shaderInfoEquals(latestShaderInfo, shaderInfo)
) {
if (shader) {
shader.dispose();
delete this._shader;
}
shader = glSurface._makeShader(shaderInfo);
this._latestShaderInfo = shaderInfo;
this._shader = shader;
Expand Down

0 comments on commit 5617f2b

Please sign in to comment.