Removed duplicate flush methods from the batch processors.

This commit is contained in:
Richard Davey 2016-10-31 21:46:31 +00:00
parent 19d9241dc7
commit c681abbea8
4 changed files with 0 additions and 138 deletions

View file

@ -149,7 +149,6 @@ EOL;
<script src="$path/src/renderer/webgl/shaders/ComplexPrimitiveGraphics.js"></script>
<script src="$path/src/renderer/webgl/shaders/PrimitiveGraphics.js"></script>
<script src="$path/src/renderer/webgl/shaders/Sprite.js"></script>
<script src="$path/src/renderer/webgl/shaders/SpriteBatch.js"></script>
<script src="$path/src/renderer/webgl/shaders/Strip.js"></script>

View file

@ -361,42 +361,6 @@ Phaser.Renderer.WebGL.Batch.MultiTexture.prototype.add = function (verts, uvs, t
this.size++;
};
Phaser.Renderer.WebGL.Batch.MultiTexture.prototype.flush = function ()
{
if (this.size === 0)
{
return;
}
var gl = this.gl;
// Upload the vertex data to the GPU - is this cheaper (overall) than creating a new TypedArray view?
// The tradeoff is sending 224KB of data to the GPU every frame, even if most of it is empty should the
// batch be only slightly populated, vs. the creation of a new TypedArray view and its corresponding gc every frame.
if (this.size > this.halfSize)
{
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices);
}
else
{
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);
this.view = this.positions.subarray(0, this.size * this.vertSize);
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.view);
}
gl.drawElements(gl.TRIANGLES, this.size * 6, gl.UNSIGNED_SHORT, 0);
this.renderer.drawCount++;
// Reset the batch
this.size = 0;
this._i = 0;
};
Phaser.Renderer.WebGL.Batch.MultiTexture.prototype.destroy = function ()
{
this.vertices = null;

View file

@ -87,31 +87,6 @@ Phaser.Renderer.WebGL.Batch.Pixel.prototype.init = function ()
// Our static index buffer, calculated once at the start of our game
// This contains the indices data for the quads.
//
// A quad is made up of 2 triangles (A and B in the image below)
//
// 0 = Top Left
// 1 = Top Right
// 2 = Bottom Right
// 3 = Bottom Left
//
// 0----1
// |\ A|
// | \ |
// | \ |
// | B \|
// | \
// 3----2
//
// Because triangles A and B share 2 points (0 and 2) the vertex buffer only stores
// 4 sets of data (top-left, top-right, bottom-left and bottom-right), which is why
// the indices offsets uses the j += 4 iteration. Indices array has to contain 3
// entries for every triangle (so 6 for every quad), but our vertex data compacts
// that down, as we don't want to fill it with loads of DUPLICATE data, so the
// indices array is a look-up table, telling WebGL where in the vertex buffer to look
// for that triangles indice data.
// batchSize * vertSize = 2000 * 6 (because we store 6 pieces of vertex data per triangle)
// and up to a maximum of 2000 entries in the batch
@ -229,44 +204,6 @@ Phaser.Renderer.WebGL.Batch.Pixel.prototype.add = function (x0, y0, x1, y1, x2,
this.size++;
};
/*
Phaser.Renderer.WebGL.Batch.Pixel.prototype.flush = function ()
{
if (this.size === 0)
{
return;
}
var gl = this.gl;
// Upload the vertex data to the GPU - is this cheaper (overall) than creating a new TypedArray view?
// The tradeoff is sending 224KB of data to the GPU every frame, even if most of it is empty should the
// batch be only slightly populated, vs. the creation of a new TypedArray view and its corresponding gc every frame.
if (this.size > this.halfSize)
{
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices);
}
else
{
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);
this.view = this.positions.subarray(0, this.size * this.vertSize);
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.view);
}
gl.drawElements(gl.TRIANGLES, this.size * 6, gl.UNSIGNED_SHORT, 0);
this.renderer.drawCount++;
// Reset the batch
this.size = 0;
this._i = 0;
};
*/
Phaser.Renderer.WebGL.Batch.Pixel.prototype.destroy = function ()
{
this.vertices = null;

View file

@ -305,44 +305,6 @@ Phaser.Renderer.WebGL.Batch.SingleTexture.prototype.add = function (verts, uvs,
this.size++;
};
/*
Phaser.Renderer.WebGL.Batch.SingleTexture.prototype.flush = function ()
{
if (this.size === 0)
{
return;
}
var gl = this.gl;
// Upload the vertex data to the GPU - is this cheaper (overall) than creating a new TypedArray view?
// The tradeoff is sending 224KB of data to the GPU every frame, even if most of it is empty should the
// batch be only slightly populated, vs. the creation of a new TypedArray view and its corresponding gc every frame.
if (this.size > this.halfSize)
{
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices);
}
else
{
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);
this.view = this.positions.subarray(0, this.size * this.vertSize);
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.view);
}
gl.drawElements(gl.TRIANGLES, this.size * 6, gl.UNSIGNED_SHORT, 0);
this.renderer.drawCount++;
// Reset the batch
this.size = 0;
this._i = 0;
};
*/
Phaser.Renderer.WebGL.Batch.SingleTexture.prototype.destroy = function ()
{
this.vertices = null;