Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
1chandu committed Jan 24, 2020
1 parent 0012599 commit 8c1536d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/webgl/src/classes/program.js
Expand Up @@ -152,8 +152,9 @@ export default class Program extends Resource {
// Now that all uniforms have been updated, check if any texture
// in the uniforms is not yet initialized, then we don't draw
!this._areTexturesRenderable() ||
// Avoid WebGL warning when vertexCount is 0
vertexCount <= 0
// Avoid WebGL draw call when not rendering any data
vertexCount === 0 ||
(isInstanced && instanceCount === 0)
) {
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions modules/webgl/test/classes/program.spec.js
Expand Up @@ -68,6 +68,9 @@ test('WebGL#Program draw', t => {
didDraw = program.draw({vertexArray, vertexCount: 0});
t.notOk(didDraw, 'Program draw succesfully skipped');

didDraw = program.draw({vertexArray, vertexCount: 3, instanceCount: 0, isInstanced: true});
t.notOk(didDraw, 'Instanced Program draw succesfully skipped');

t.end();
});

Expand Down

0 comments on commit 8c1536d

Please sign in to comment.