Skip to content

Commit dc92c92

Browse files
committed
Removed all instances of gl.id.
1 parent a12ba9f commit dc92c92

3 files changed

Lines changed: 23 additions & 25 deletions

File tree

src/renderer/webgl/SpriteBatch.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Phaser.Renderer.WebGL.SpriteBatch.prototype = {
151151
shader.uniforms = {};
152152
shader.init();
153153

154-
this.defaultShader.shaders[gl.id] = shader;
154+
this.defaultShader.shaders = shader;
155155
},
156156

157157
begin: function ()
@@ -184,7 +184,7 @@ Phaser.Renderer.WebGL.SpriteBatch.prototype = {
184184
{
185185
this.flush();
186186
gl.activeTexture(gl.TEXTURE0 + baseTexture.textureIndex);
187-
gl.bindTexture(gl.TEXTURE_2D, baseTexture._glTextures[gl.id]);
187+
gl.bindTexture(gl.TEXTURE_2D, baseTexture._glTextures);
188188
this.renderer.textureArray[baseTexture.textureIndex] = baseTexture;
189189
}
190190

@@ -334,7 +334,7 @@ Phaser.Renderer.WebGL.SpriteBatch.prototype = {
334334
{
335335
this.dirty = false;
336336

337-
shader = this.defaultShader.shaders[gl.id];
337+
shader = this.defaultShader.shaders;
338338

339339
// bind the main texture
340340
gl.activeTexture(gl.TEXTURE0);
@@ -423,7 +423,7 @@ Phaser.Renderer.WebGL.SpriteBatch.prototype = {
423423
{
424424
currentShader = nextShader;
425425

426-
shader = currentShader.shaders[gl.id];
426+
shader = currentShader.shaders;
427427

428428
if (!shader)
429429
{
@@ -433,7 +433,7 @@ Phaser.Renderer.WebGL.SpriteBatch.prototype = {
433433
shader.uniforms = currentShader.uniforms;
434434
shader.init();
435435

436-
currentShader.shaders[gl.id] = shader;
436+
currentShader.shaders = shader;
437437
}
438438

439439
this.renderer.shaderManager.setShader(shader);
@@ -474,7 +474,7 @@ Phaser.Renderer.WebGL.SpriteBatch.prototype = {
474474
var gl = this.gl;
475475

476476
// check if a texture is dirty..
477-
if (texture._dirty[gl.id])
477+
if (texture._dirty)
478478
{
479479
if (!this.renderer.updateTexture(texture))
480480
{

src/renderer/webgl/WebGLRenderer.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,6 @@ Phaser.Renderer.WebGL.prototype = {
182182
}
183183
}
184184

185-
this.gl.id = 0;
186-
187185
var gl = this.gl;
188186

189187
this.maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
@@ -406,14 +404,14 @@ Phaser.Renderer.WebGL.prototype = {
406404

407405
var gl = this.gl;
408406

409-
if (!texture._glTextures[gl.id])
407+
if (!texture._glTextures)
410408
{
411-
texture._glTextures[gl.id] = gl.createTexture();
409+
texture._glTextures = gl.createTexture();
412410
}
413411

414412
gl.activeTexture(gl.TEXTURE0 + texture.textureIndex);
415413

416-
gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]);
414+
gl.bindTexture(gl.TEXTURE_2D, texture._glTextures);
417415

418416
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultipliedAlpha);
419417

@@ -442,7 +440,7 @@ Phaser.Renderer.WebGL.prototype = {
442440
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);
443441
}
444442

445-
texture._dirty[gl.id] = false;
443+
texture._dirty = false;
446444

447445
return true;
448446
},
@@ -457,14 +455,14 @@ Phaser.Renderer.WebGL.prototype = {
457455
var gl = this.gl;
458456
var textureMetaData = texture.source;
459457

460-
if (!texture._glTextures[gl.id])
458+
if (!texture._glTextures)
461459
{
462-
texture._glTextures[gl.id] = gl.createTexture();
460+
texture._glTextures = gl.createTexture();
463461
}
464462

465463
gl.activeTexture(gl.TEXTURE0 + texture.textureIndex);
466464

467-
gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]);
465+
gl.bindTexture(gl.TEXTURE_2D, texture._glTextures);
468466

469467
gl.compressedTexImage2D(
470468
gl.TEXTURE_2D,
@@ -499,7 +497,7 @@ Phaser.Renderer.WebGL.prototype = {
499497
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);
500498
}
501499

502-
texture._dirty[gl.id] = false;
500+
texture._dirty = false;
503501

504502
return true;
505503
},
@@ -536,22 +534,22 @@ Phaser.Renderer.WebGL.prototype = {
536534
// PIXI.WebGLGraphics.updateGraphics(maskData, gl);
537535
}
538536

539-
if (maskData._webGL[gl.id] === undefined || maskData._webGL[gl.id].data === undefined || maskData._webGL[gl.id].data.length === 0)
537+
if (maskData._webGL === undefined || maskData._webGL.data === undefined || maskData._webGL.data.length === 0)
540538
{
541539
return;
542540
}
543541

544-
this.stencilManager.pushStencil(maskData, maskData._webGL[gl.id].data[0]);
542+
this.stencilManager.pushStencil(maskData, maskData._webGL.data[0]);
545543
},
546544

547545
popMask: function (maskData)
548546
{
549-
if (maskData._webGL[gl.id] === undefined || maskData._webGL[gl.id].data === undefined || maskData._webGL[gl.id].data.length === 0)
547+
if (maskData._webGL === undefined || maskData._webGL.data === undefined || maskData._webGL.data.length === 0)
550548
{
551549
return;
552550
}
553551

554-
this.stencilManager.popStencil(maskData, maskData._webGL[gl.id].data[0]);
552+
this.stencilManager.popStencil(maskData, maskData._webGL.data[0]);
555553
},
556554

557555
// Shader Utils

src/renderer/webgl/shaders/Sprite.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Phaser.Renderer.WebGL.Shaders.Sprite.prototype = {
264264

265265
// No need to do string manipulation for this.
266266
gl.activeTexture(gl.TEXTURE0 + this.textureCount);
267-
gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures[gl.id]);
267+
gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures);
268268

269269
// Extended texture data
270270
if (uniform.textureData)
@@ -368,17 +368,17 @@ Phaser.Renderer.WebGL.Shaders.Sprite.prototype = {
368368
{
369369
gl.activeTexture(gl['TEXTURE' + this.textureCount]);
370370

371-
if(uniform.value.baseTexture._dirty[gl.id])
371+
if(uniform.value.baseTexture._dirty)
372372
{
373-
PIXI.instances[gl.id].updateTexture(uniform.value.baseTexture);
373+
PIXI.instances.updateTexture(uniform.value.baseTexture);
374374
}
375375
else
376376
{
377377
// bind the current texture
378-
gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures[gl.id]);
378+
gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures);
379379
}
380380

381-
// gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures[gl.id] || PIXI.createWebGLTexture( uniform.value.baseTexture, gl));
381+
// gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures || PIXI.createWebGLTexture( uniform.value.baseTexture, gl));
382382
gl.uniform1i(uniform.uniformLocation, this.textureCount);
383383
this.textureCount++;
384384
}

0 commit comments

Comments
 (0)