Skip to content

Commit 86d1009

Browse files
committed
Use batchSize and fixed shouldFlush so we take advantage of bufferData
1 parent 40123f1 commit 86d1009

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

src/renderer/webgl/WebGLPipeline.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,23 +391,20 @@ var WebGLPipeline = new Class({
391391
// Which shader has the largest vertex size?
392392
var shaders = this.shaders;
393393
var vertexSize = 0;
394-
var vertexComponentCount = 0;
395394

396395
for (i = 0; i < shaders.length; i++)
397396
{
398397
if (shaders[i].vertexSize > vertexSize)
399398
{
400399
vertexSize = shaders[i].vertexSize;
401400
}
402-
403-
if (shaders[i].vertexComponentCount > vertexComponentCount)
404-
{
405-
vertexComponentCount = shaders[i].vertexComponentCount;
406-
}
407401
}
408402

403+
var batchSize = GetFastValue(config, 'batchSize', renderer.config.batchSize);
404+
409405
// * 6 because there are 6 vertices in a quad and 'batchSize' represents the quantity of quads in the batch
410-
this.vertexCapacity = (GetFastValue(config, 'vertexCapacity', renderer.config.batchSize) * 6) * vertexComponentCount;
406+
407+
this.vertexCapacity = batchSize * 6;
411408

412409
var data = GetFastValue(config, 'vertices', new ArrayBuffer(this.vertexCapacity * vertexSize));
413410

@@ -670,7 +667,7 @@ var WebGLPipeline = new Class({
670667
{
671668
if (amount === undefined) { amount = 0; }
672669

673-
return (this.vertexCount + amount >= this.vertexCapacity);
670+
return (this.vertexCount + amount > this.vertexCapacity);
674671
},
675672

676673
/**

0 commit comments

Comments
 (0)