Skip to content

Commit

Permalink
Merge 0012599 into 5e4fd05
Browse files Browse the repository at this point in the history
  • Loading branch information
1chandu committed Jan 23, 2020
2 parents 5e4fd05 + 0012599 commit e8dbf06
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 8 additions & 4 deletions modules/webgl/src/classes/program.js
Expand Up @@ -147,10 +147,14 @@ export default class Program extends Resource {

this.gl.useProgram(this.handle);

// Note: async textures set as uniforms might still be loading.
// Now that all uniforms have been updated, check if any texture
// in the uniforms is not yet initialized, then we don't draw
if (!this._areTexturesRenderable()) {
if (
// Note: async textures set as uniforms might still be loading.
// 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
) {
return false;
}

Expand Down
6 changes: 5 additions & 1 deletion modules/webgl/test/classes/program.spec.js
Expand Up @@ -61,8 +61,12 @@ test('WebGL#Program draw', t => {
program.draw({vertexArray, vertexCount: 3});
t.ok(program instanceof Program, 'Program draw successful');

program.draw({vertexArray, vertexCount: 3, parameters: {blend: true}});
let didDraw = program.draw({vertexArray, vertexCount: 3, parameters: {blend: true}});
t.ok(program instanceof Program, 'Program draw with parameters is successful');
t.ok(didDraw, 'Program draw successful');

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

t.end();
});
Expand Down

0 comments on commit e8dbf06

Please sign in to comment.