Skip to content

Commit

Permalink
Don't rebind texture if no update
Browse files Browse the repository at this point in the history
  • Loading branch information
tsherif committed Oct 16, 2019
1 parent ebd9071 commit bc261e4
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions modules/webgl/src/classes/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,23 +206,25 @@ export default class Program extends Resource {
value = value.texture;
}
if (value instanceof Texture) {
// eslint-disable-next-line max-depth
if (uniformSetter.textureIndex === undefined) {
uniformSetter.textureIndex = this._textureIndexCounter++;
}
textureUpdate = this.uniforms[uniformName] !== uniform;

// Bind texture to index
const texture = value;
const {textureIndex} = uniformSetter;
if (textureUpdate) {
// eslint-disable-next-line max-depth
if (uniformSetter.textureIndex === undefined) {
uniformSetter.textureIndex = this._textureIndexCounter++;
}

texture.bind(textureIndex);
value = textureIndex;
// Bind texture to index
const texture = value;
const {textureIndex} = uniformSetter;

if (!texture.loaded) {
this._texturesRenderable = false;
}
texture.bind(textureIndex);
value = textureIndex;

textureUpdate = this.uniforms[uniformName] !== uniform;
if (!texture.loaded) {
this._texturesRenderable = false;
}
}
}

// NOTE(Tarek): uniformSetter returns whether
Expand Down

0 comments on commit bc261e4

Please sign in to comment.