diff --git a/README.md b/README.md index 90aab68..b89e9fc 100644 --- a/README.md +++ b/README.md @@ -72,10 +72,10 @@ #### CDN Install (via cdnjs) ```html - + ``` -_Note: `4.1.1` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ +_Note: `4.2.2` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ ### Demos ### diff --git a/README.md b/README.md index 90aab68..b89e9fc 100644 --- a/README.md +++ b/README.md @@ -72,10 +72,10 @@ #### CDN Install (via cdnjs) ```html - + ``` -_Note: `4.1.1` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ +_Note: `4.2.2` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ ### Demos ### diff --git a/package.json b/package.json index c8c5220..16d63b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.2.1", + "version": "4.2.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -34,7 +34,7 @@ "lintfix": "npm run lint --fix", "prebuild": "npm run lint", "build": "npm run dist", - "dist": "pixify -d dist -n PIXI -o pixi", + "dist": "pixify -d dist -n PIXI -o pixi -t babelify", "lib": "babel src --out-dir lib -s", "docs": "jsdoc -c scripts/jsdoc.conf.json -R README.md", "publish:patch": "npm version patch --no-git-tag-version && npm publish", @@ -77,13 +77,8 @@ "minimist": "^1.2.0", "mkdirp": "^0.5.1", "parallelshell": "^2.0.0", - "pixify": "^1.5.0", + "pixify": "^1.7.0", "rimraf": "^2.5.3", "watch": "^0.19.1" - }, - "browserify": { - "transform": [ - "babelify" - ] } } diff --git a/README.md b/README.md index 90aab68..b89e9fc 100644 --- a/README.md +++ b/README.md @@ -72,10 +72,10 @@ #### CDN Install (via cdnjs) ```html - + ``` -_Note: `4.1.1` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ +_Note: `4.2.2` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ ### Demos ### diff --git a/package.json b/package.json index c8c5220..16d63b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.2.1", + "version": "4.2.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -34,7 +34,7 @@ "lintfix": "npm run lint --fix", "prebuild": "npm run lint", "build": "npm run dist", - "dist": "pixify -d dist -n PIXI -o pixi", + "dist": "pixify -d dist -n PIXI -o pixi -t babelify", "lib": "babel src --out-dir lib -s", "docs": "jsdoc -c scripts/jsdoc.conf.json -R README.md", "publish:patch": "npm version patch --no-git-tag-version && npm publish", @@ -77,13 +77,8 @@ "minimist": "^1.2.0", "mkdirp": "^0.5.1", "parallelshell": "^2.0.0", - "pixify": "^1.5.0", + "pixify": "^1.7.0", "rimraf": "^2.5.3", "watch": "^0.19.1" - }, - "browserify": { - "transform": [ - "babelify" - ] } } diff --git a/src/core/const.js b/src/core/const.js index efccde4..6d09378 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -1,5 +1,3 @@ -import canUploadSameBuffer from './utils/canUploadSameBuffer'; - /** * String of the current PIXI version. * @@ -298,16 +296,3 @@ LINEAR_VERTICAL: 0, LINEAR_HORIZONTAL: 1, }; - -// TODO: maybe change to SPRITE.BATCH_SIZE: 2000 -// TODO: maybe add PARTICLE.BATCH_SIZE: 15000 - -/** - * Can we upload the same buffer in a single frame? - * - * @static - * @constant - * @memberof PIXI - * @type {boolean} - */ -export const CAN_UPLOAD_SAME_BUFFER = canUploadSameBuffer(); diff --git a/README.md b/README.md index 90aab68..b89e9fc 100644 --- a/README.md +++ b/README.md @@ -72,10 +72,10 @@ #### CDN Install (via cdnjs) ```html - + ``` -_Note: `4.1.1` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ +_Note: `4.2.2` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ ### Demos ### diff --git a/package.json b/package.json index c8c5220..16d63b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.2.1", + "version": "4.2.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -34,7 +34,7 @@ "lintfix": "npm run lint --fix", "prebuild": "npm run lint", "build": "npm run dist", - "dist": "pixify -d dist -n PIXI -o pixi", + "dist": "pixify -d dist -n PIXI -o pixi -t babelify", "lib": "babel src --out-dir lib -s", "docs": "jsdoc -c scripts/jsdoc.conf.json -R README.md", "publish:patch": "npm version patch --no-git-tag-version && npm publish", @@ -77,13 +77,8 @@ "minimist": "^1.2.0", "mkdirp": "^0.5.1", "parallelshell": "^2.0.0", - "pixify": "^1.5.0", + "pixify": "^1.7.0", "rimraf": "^2.5.3", "watch": "^0.19.1" - }, - "browserify": { - "transform": [ - "babelify" - ] } } diff --git a/src/core/const.js b/src/core/const.js index efccde4..6d09378 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -1,5 +1,3 @@ -import canUploadSameBuffer from './utils/canUploadSameBuffer'; - /** * String of the current PIXI version. * @@ -298,16 +296,3 @@ LINEAR_VERTICAL: 0, LINEAR_HORIZONTAL: 1, }; - -// TODO: maybe change to SPRITE.BATCH_SIZE: 2000 -// TODO: maybe add PARTICLE.BATCH_SIZE: 15000 - -/** - * Can we upload the same buffer in a single frame? - * - * @static - * @constant - * @memberof PIXI - * @type {boolean} - */ -export const CAN_UPLOAD_SAME_BUFFER = canUploadSameBuffer(); diff --git a/src/core/renderers/webgl/TextureGarbageCollector.js b/src/core/renderers/webgl/TextureGarbageCollector.js index ce67a2b..7047f2c 100644 --- a/src/core/renderers/webgl/TextureGarbageCollector.js +++ b/src/core/renderers/webgl/TextureGarbageCollector.js @@ -1,6 +1,8 @@ import { GC_MODES } from '../../const'; import settings from '../../settings'; +const { GC_MODE, GC_MAX_IDLE, GC_MAX_CHECK_COUNT } = settings; + /** * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged * up with textures that are no longer being used. @@ -19,10 +21,9 @@ this.count = 0; this.checkCount = 0; - this.maxIdle = 60 * 60; - this.checkCountMax = 60 * 10; - - this.mode = settings.GC_MODE; + this.maxIdle = GC_MAX_IDLE; + this.checkCountMax = GC_MAX_CHECK_COUNT; + this.mode = GC_MODE; } /** diff --git a/README.md b/README.md index 90aab68..b89e9fc 100644 --- a/README.md +++ b/README.md @@ -72,10 +72,10 @@ #### CDN Install (via cdnjs) ```html - + ``` -_Note: `4.1.1` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ +_Note: `4.2.2` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ ### Demos ### diff --git a/package.json b/package.json index c8c5220..16d63b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.2.1", + "version": "4.2.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -34,7 +34,7 @@ "lintfix": "npm run lint --fix", "prebuild": "npm run lint", "build": "npm run dist", - "dist": "pixify -d dist -n PIXI -o pixi", + "dist": "pixify -d dist -n PIXI -o pixi -t babelify", "lib": "babel src --out-dir lib -s", "docs": "jsdoc -c scripts/jsdoc.conf.json -R README.md", "publish:patch": "npm version patch --no-git-tag-version && npm publish", @@ -77,13 +77,8 @@ "minimist": "^1.2.0", "mkdirp": "^0.5.1", "parallelshell": "^2.0.0", - "pixify": "^1.5.0", + "pixify": "^1.7.0", "rimraf": "^2.5.3", "watch": "^0.19.1" - }, - "browserify": { - "transform": [ - "babelify" - ] } } diff --git a/src/core/const.js b/src/core/const.js index efccde4..6d09378 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -1,5 +1,3 @@ -import canUploadSameBuffer from './utils/canUploadSameBuffer'; - /** * String of the current PIXI version. * @@ -298,16 +296,3 @@ LINEAR_VERTICAL: 0, LINEAR_HORIZONTAL: 1, }; - -// TODO: maybe change to SPRITE.BATCH_SIZE: 2000 -// TODO: maybe add PARTICLE.BATCH_SIZE: 15000 - -/** - * Can we upload the same buffer in a single frame? - * - * @static - * @constant - * @memberof PIXI - * @type {boolean} - */ -export const CAN_UPLOAD_SAME_BUFFER = canUploadSameBuffer(); diff --git a/src/core/renderers/webgl/TextureGarbageCollector.js b/src/core/renderers/webgl/TextureGarbageCollector.js index ce67a2b..7047f2c 100644 --- a/src/core/renderers/webgl/TextureGarbageCollector.js +++ b/src/core/renderers/webgl/TextureGarbageCollector.js @@ -1,6 +1,8 @@ import { GC_MODES } from '../../const'; import settings from '../../settings'; +const { GC_MODE, GC_MAX_IDLE, GC_MAX_CHECK_COUNT } = settings; + /** * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged * up with textures that are no longer being used. @@ -19,10 +21,9 @@ this.count = 0; this.checkCount = 0; - this.maxIdle = 60 * 60; - this.checkCountMax = 60 * 10; - - this.mode = settings.GC_MODE; + this.maxIdle = GC_MAX_IDLE; + this.checkCountMax = GC_MAX_CHECK_COUNT; + this.mode = GC_MODE; } /** diff --git a/src/core/settings.js b/src/core/settings.js index 4d4c3a0..ac5df51 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -1,4 +1,5 @@ import maxRecommendedTextures from './utils/maxRecommendedTextures'; +import canUploadSameBuffer from './utils/canUploadSameBuffer'; /** * @namespace PIXI.settings @@ -56,6 +57,9 @@ */ SPRITE_MAX_TEXTURES: maxRecommendedTextures(32), + // TODO: maybe change to SPRITE.BATCH_SIZE: 2000 + // TODO: maybe add PARTICLE.BATCH_SIZE: 15000 + /** * The default sprite batch size. * @@ -131,6 +135,26 @@ GC_MODE: 0, /** + * Default Garbage Collection max idle. + * + * @static + * @memberof PIXI.settings + * @type {number} + * @default 3600 + */ + GC_MAX_IDLE: 60 * 60, + + /** + * Default Garbage Collection maximum check count. + * + * @static + * @memberof PIXI.settings + * @type {number} + * @default 600 + */ + GC_MAX_CHECK_COUNT: 60 * 10, + + /** * Default wrap modes that are supported by pixi. * * @static @@ -160,4 +184,14 @@ */ PRECISION: 'mediump', + /** + * Can we upload the same buffer in a single frame? + * + * @static + * @constant + * @memberof PIXI + * @type {boolean} + */ + CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(), + }; diff --git a/README.md b/README.md index 90aab68..b89e9fc 100644 --- a/README.md +++ b/README.md @@ -72,10 +72,10 @@ #### CDN Install (via cdnjs) ```html - + ``` -_Note: `4.1.1` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ +_Note: `4.2.2` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ ### Demos ### diff --git a/package.json b/package.json index c8c5220..16d63b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.2.1", + "version": "4.2.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -34,7 +34,7 @@ "lintfix": "npm run lint --fix", "prebuild": "npm run lint", "build": "npm run dist", - "dist": "pixify -d dist -n PIXI -o pixi", + "dist": "pixify -d dist -n PIXI -o pixi -t babelify", "lib": "babel src --out-dir lib -s", "docs": "jsdoc -c scripts/jsdoc.conf.json -R README.md", "publish:patch": "npm version patch --no-git-tag-version && npm publish", @@ -77,13 +77,8 @@ "minimist": "^1.2.0", "mkdirp": "^0.5.1", "parallelshell": "^2.0.0", - "pixify": "^1.5.0", + "pixify": "^1.7.0", "rimraf": "^2.5.3", "watch": "^0.19.1" - }, - "browserify": { - "transform": [ - "babelify" - ] } } diff --git a/src/core/const.js b/src/core/const.js index efccde4..6d09378 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -1,5 +1,3 @@ -import canUploadSameBuffer from './utils/canUploadSameBuffer'; - /** * String of the current PIXI version. * @@ -298,16 +296,3 @@ LINEAR_VERTICAL: 0, LINEAR_HORIZONTAL: 1, }; - -// TODO: maybe change to SPRITE.BATCH_SIZE: 2000 -// TODO: maybe add PARTICLE.BATCH_SIZE: 15000 - -/** - * Can we upload the same buffer in a single frame? - * - * @static - * @constant - * @memberof PIXI - * @type {boolean} - */ -export const CAN_UPLOAD_SAME_BUFFER = canUploadSameBuffer(); diff --git a/src/core/renderers/webgl/TextureGarbageCollector.js b/src/core/renderers/webgl/TextureGarbageCollector.js index ce67a2b..7047f2c 100644 --- a/src/core/renderers/webgl/TextureGarbageCollector.js +++ b/src/core/renderers/webgl/TextureGarbageCollector.js @@ -1,6 +1,8 @@ import { GC_MODES } from '../../const'; import settings from '../../settings'; +const { GC_MODE, GC_MAX_IDLE, GC_MAX_CHECK_COUNT } = settings; + /** * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged * up with textures that are no longer being used. @@ -19,10 +21,9 @@ this.count = 0; this.checkCount = 0; - this.maxIdle = 60 * 60; - this.checkCountMax = 60 * 10; - - this.mode = settings.GC_MODE; + this.maxIdle = GC_MAX_IDLE; + this.checkCountMax = GC_MAX_CHECK_COUNT; + this.mode = GC_MODE; } /** diff --git a/src/core/settings.js b/src/core/settings.js index 4d4c3a0..ac5df51 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -1,4 +1,5 @@ import maxRecommendedTextures from './utils/maxRecommendedTextures'; +import canUploadSameBuffer from './utils/canUploadSameBuffer'; /** * @namespace PIXI.settings @@ -56,6 +57,9 @@ */ SPRITE_MAX_TEXTURES: maxRecommendedTextures(32), + // TODO: maybe change to SPRITE.BATCH_SIZE: 2000 + // TODO: maybe add PARTICLE.BATCH_SIZE: 15000 + /** * The default sprite batch size. * @@ -131,6 +135,26 @@ GC_MODE: 0, /** + * Default Garbage Collection max idle. + * + * @static + * @memberof PIXI.settings + * @type {number} + * @default 3600 + */ + GC_MAX_IDLE: 60 * 60, + + /** + * Default Garbage Collection maximum check count. + * + * @static + * @memberof PIXI.settings + * @type {number} + * @default 600 + */ + GC_MAX_CHECK_COUNT: 60 * 10, + + /** * Default wrap modes that are supported by pixi. * * @static @@ -160,4 +184,14 @@ */ PRECISION: 'mediump', + /** + * Can we upload the same buffer in a single frame? + * + * @static + * @constant + * @memberof PIXI + * @type {boolean} + */ + CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(), + }; diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index bcb273a..f39cab9 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -4,12 +4,11 @@ import generateMultiTextureShader from './generateMultiTextureShader'; import checkMaxIfStatmentsInShader from '../../renderers/webgl/utils/checkMaxIfStatmentsInShader'; import Buffer from './BatchBuffer'; -import { CAN_UPLOAD_SAME_BUFFER } from '../../const'; import settings from '../../settings'; import glCore from 'pixi-gl-core'; import bitTwiddle from 'bit-twiddle'; -const { SPRITE_BATCH_SIZE, SPRITE_MAX_TEXTURES } = settings; +const { SPRITE_BATCH_SIZE, SPRITE_MAX_TEXTURES, CAN_UPLOAD_SAME_BUFFER } = settings; let TICK = 0; let TEXTURE_TICK = 0; @@ -366,7 +365,7 @@ if (!CAN_UPLOAD_SAME_BUFFER) { // this is still needed for IOS performance.. - // it realy doe not like uploading to the same bufffer in a single frame! + // it really does not like uploading to the same buffer in a single frame! if (this.vaoMax <= this.vertexCount) { this.vaoMax++; @@ -389,7 +388,7 @@ } else { - // lets use the faster option.. + // lets use the faster option, always use buffer number 0 this.vertexBuffers[this.vertexCount].upload(buffer.vertices, 0, true); } @@ -436,9 +435,13 @@ { this.renderer._bindGLShader(this.shader); - this.renderer.bindVao(this.vaos[this.vertexCount]); + if (CAN_UPLOAD_SAME_BUFFER) + { + // bind buffer #0, we don't need others + this.renderer.bindVao(this.vaos[this.vertexCount]); - this.vertexBuffers[this.vertexCount].bind(); + this.vertexBuffers[this.vertexCount].bind(); + } } /** diff --git a/README.md b/README.md index 90aab68..b89e9fc 100644 --- a/README.md +++ b/README.md @@ -72,10 +72,10 @@ #### CDN Install (via cdnjs) ```html - + ``` -_Note: `4.1.1` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ +_Note: `4.2.2` can be replaced by any [released](https://github.com/pixijs/pixi.js/releases) version._ ### Demos ### diff --git a/package.json b/package.json index c8c5220..16d63b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi.js", - "version": "4.2.1", + "version": "4.2.2", "description": "Pixi.js is a fast lightweight 2D library that works across all devices.", "author": "Mat Groves", "contributors": [ @@ -34,7 +34,7 @@ "lintfix": "npm run lint --fix", "prebuild": "npm run lint", "build": "npm run dist", - "dist": "pixify -d dist -n PIXI -o pixi", + "dist": "pixify -d dist -n PIXI -o pixi -t babelify", "lib": "babel src --out-dir lib -s", "docs": "jsdoc -c scripts/jsdoc.conf.json -R README.md", "publish:patch": "npm version patch --no-git-tag-version && npm publish", @@ -77,13 +77,8 @@ "minimist": "^1.2.0", "mkdirp": "^0.5.1", "parallelshell": "^2.0.0", - "pixify": "^1.5.0", + "pixify": "^1.7.0", "rimraf": "^2.5.3", "watch": "^0.19.1" - }, - "browserify": { - "transform": [ - "babelify" - ] } } diff --git a/src/core/const.js b/src/core/const.js index efccde4..6d09378 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -1,5 +1,3 @@ -import canUploadSameBuffer from './utils/canUploadSameBuffer'; - /** * String of the current PIXI version. * @@ -298,16 +296,3 @@ LINEAR_VERTICAL: 0, LINEAR_HORIZONTAL: 1, }; - -// TODO: maybe change to SPRITE.BATCH_SIZE: 2000 -// TODO: maybe add PARTICLE.BATCH_SIZE: 15000 - -/** - * Can we upload the same buffer in a single frame? - * - * @static - * @constant - * @memberof PIXI - * @type {boolean} - */ -export const CAN_UPLOAD_SAME_BUFFER = canUploadSameBuffer(); diff --git a/src/core/renderers/webgl/TextureGarbageCollector.js b/src/core/renderers/webgl/TextureGarbageCollector.js index ce67a2b..7047f2c 100644 --- a/src/core/renderers/webgl/TextureGarbageCollector.js +++ b/src/core/renderers/webgl/TextureGarbageCollector.js @@ -1,6 +1,8 @@ import { GC_MODES } from '../../const'; import settings from '../../settings'; +const { GC_MODE, GC_MAX_IDLE, GC_MAX_CHECK_COUNT } = settings; + /** * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged * up with textures that are no longer being used. @@ -19,10 +21,9 @@ this.count = 0; this.checkCount = 0; - this.maxIdle = 60 * 60; - this.checkCountMax = 60 * 10; - - this.mode = settings.GC_MODE; + this.maxIdle = GC_MAX_IDLE; + this.checkCountMax = GC_MAX_CHECK_COUNT; + this.mode = GC_MODE; } /** diff --git a/src/core/settings.js b/src/core/settings.js index 4d4c3a0..ac5df51 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -1,4 +1,5 @@ import maxRecommendedTextures from './utils/maxRecommendedTextures'; +import canUploadSameBuffer from './utils/canUploadSameBuffer'; /** * @namespace PIXI.settings @@ -56,6 +57,9 @@ */ SPRITE_MAX_TEXTURES: maxRecommendedTextures(32), + // TODO: maybe change to SPRITE.BATCH_SIZE: 2000 + // TODO: maybe add PARTICLE.BATCH_SIZE: 15000 + /** * The default sprite batch size. * @@ -131,6 +135,26 @@ GC_MODE: 0, /** + * Default Garbage Collection max idle. + * + * @static + * @memberof PIXI.settings + * @type {number} + * @default 3600 + */ + GC_MAX_IDLE: 60 * 60, + + /** + * Default Garbage Collection maximum check count. + * + * @static + * @memberof PIXI.settings + * @type {number} + * @default 600 + */ + GC_MAX_CHECK_COUNT: 60 * 10, + + /** * Default wrap modes that are supported by pixi. * * @static @@ -160,4 +184,14 @@ */ PRECISION: 'mediump', + /** + * Can we upload the same buffer in a single frame? + * + * @static + * @constant + * @memberof PIXI + * @type {boolean} + */ + CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(), + }; diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index bcb273a..f39cab9 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -4,12 +4,11 @@ import generateMultiTextureShader from './generateMultiTextureShader'; import checkMaxIfStatmentsInShader from '../../renderers/webgl/utils/checkMaxIfStatmentsInShader'; import Buffer from './BatchBuffer'; -import { CAN_UPLOAD_SAME_BUFFER } from '../../const'; import settings from '../../settings'; import glCore from 'pixi-gl-core'; import bitTwiddle from 'bit-twiddle'; -const { SPRITE_BATCH_SIZE, SPRITE_MAX_TEXTURES } = settings; +const { SPRITE_BATCH_SIZE, SPRITE_MAX_TEXTURES, CAN_UPLOAD_SAME_BUFFER } = settings; let TICK = 0; let TEXTURE_TICK = 0; @@ -366,7 +365,7 @@ if (!CAN_UPLOAD_SAME_BUFFER) { // this is still needed for IOS performance.. - // it realy doe not like uploading to the same bufffer in a single frame! + // it really does not like uploading to the same buffer in a single frame! if (this.vaoMax <= this.vertexCount) { this.vaoMax++; @@ -389,7 +388,7 @@ } else { - // lets use the faster option.. + // lets use the faster option, always use buffer number 0 this.vertexBuffers[this.vertexCount].upload(buffer.vertices, 0, true); } @@ -436,9 +435,13 @@ { this.renderer._bindGLShader(this.shader); - this.renderer.bindVao(this.vaos[this.vertexCount]); + if (CAN_UPLOAD_SAME_BUFFER) + { + // bind buffer #0, we don't need others + this.renderer.bindVao(this.vaos[this.vertexCount]); - this.vertexBuffers[this.vertexCount].bind(); + this.vertexBuffers[this.vertexCount].bind(); + } } /** diff --git a/src/prepare/BasePrepare.js b/src/prepare/BasePrepare.js index 66cf6af..a2005f5 100644 --- a/src/prepare/BasePrepare.js +++ b/src/prepare/BasePrepare.js @@ -2,7 +2,16 @@ import CountLimiter from './limiters/CountLimiter'; const SharedTicker = core.ticker.shared; -const DEFAULT_UPLOADS_PER_FRAME = 4; +/** + * Default number of uploads per frame using prepare plugin. + * + * @static + * @memberof PIXI.settings + * @name UPLOADS_PER_FRAME + * @type {number} + * @default 4 + */ +core.settings.UPLOADS_PER_FRAME = 4; /** * The prepare manager provides functionality to upload content to the GPU. BasePrepare handles @@ -24,7 +33,7 @@ * The limiter to be used to control how quickly items are prepared. * @type {PIXI.prepare.CountLimiter|PIXI.prepare.TimeLimiter} */ - this.limiter = new CountLimiter(DEFAULT_UPLOADS_PER_FRAME); + this.limiter = new CountLimiter(core.settings.UPLOADS_PER_FRAME); /** * Reference to the renderer.