Skip to content

Commit d8992cc

Browse files
committed
WebGLRenderer.instancedArraysExtension is a new property that holds the WebGL Extension for instanced array drawing, if supported by the browser.
1 parent 23d6c68 commit d8992cc

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

src/renderer/webgl/WebGLRenderer.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,17 +382,29 @@ var WebGLRenderer = new Class({
382382
this.gl = null;
383383

384384
/**
385-
* Array of strings that indicate which WebGL extensions are supported by the browser
385+
* Array of strings that indicate which WebGL extensions are supported by the browser.
386+
* This is populated in the `boot` method.
386387
*
387388
* @name Phaser.Renderer.WebGL.WebGLRenderer#supportedExtensions
388-
* @type {object}
389+
* @type {string[]}
389390
* @default null
390391
* @since 3.0.0
391392
*/
392393
this.supportedExtensions = null;
393394

394395
/**
395-
* Extensions loaded into the current context
396+
* If the browser supports the `ANGLE_instanced_arrays` extension, this property will hold
397+
* a reference to the glExtension for it.
398+
*
399+
* @name Phaser.Renderer.WebGL.WebGLRenderer#instancedArraysExtension
400+
* @type {ANGLE_instanced_arrays}
401+
* @default null
402+
* @since 3.50.0
403+
*/
404+
this.instancedArraysExtension = null;
405+
406+
/**
407+
* The WebGL Extensions loaded into the current context.
396408
*
397409
* @name Phaser.Renderer.WebGL.WebGLRenderer#extensions
398410
* @type {object}
@@ -402,7 +414,7 @@ var WebGLRenderer = new Class({
402414
this.extensions = {};
403415

404416
/**
405-
* Stores the current WebGL component formats for further use
417+
* Stores the current WebGL component formats for further use.
406418
*
407419
* @name Phaser.Renderer.WebGL.WebGLRenderer#glFormats
408420
* @type {array}
@@ -415,7 +427,7 @@ var WebGLRenderer = new Class({
415427
* Stores the supported WebGL texture compression formats.
416428
*
417429
* @name Phaser.Renderer.WebGL.WebGLRenderer#compression
418-
* @type {array}
430+
* @type {object}
419431
* @since 3.8.0
420432
*/
421433
this.compression = {
@@ -769,6 +781,10 @@ var WebGLRenderer = new Class({
769781

770782
this.supportedExtensions = exts;
771783

784+
var angleString = 'ANGLE_instanced_arrays';
785+
786+
this.instancedArraysExtension = (exts.indexOf(angleString) > -1) ? gl.getExtension(angleString) : null;
787+
772788
// Setup initial WebGL state
773789
gl.disable(gl.DEPTH_TEST);
774790
gl.disable(gl.CULL_FACE);

0 commit comments

Comments
 (0)