@vpmedia/phaser 1.58.0 → 1.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/phaser/display/webgl/renderer.js +3 -2
- package/src/phaser/display/webgl/util.js +41 -1
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/types/phaser/display/webgl/util.d.ts +13 -0
- package/types/phaser/display/webgl/util.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @vpmedia/phaser
|
|
2
2
|
|
|
3
|
-
[](https://badge.fury.io/js/@vpmedia%2Fphaser)
|
|
4
4
|
[](https://github.com/vpmedia/phaser/actions/workflows/ci.yml)
|
|
5
5
|
|
|
6
6
|
@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vpmedia/phaser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.60.0",
|
|
4
4
|
"description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
|
|
5
5
|
"author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@ import * as WebGLMaskManager from './mask_manager.js';
|
|
|
28
28
|
import { WebGLShaderManager } from './shader_manager.js';
|
|
29
29
|
import { WebGLSpriteBatch } from './sprite_batch.js';
|
|
30
30
|
import { WebGLStencilManager } from './stencil_manager.js';
|
|
31
|
-
import { getWebGLContextErrorCode } from './util.js';
|
|
31
|
+
import { getWebGLContextErrorCode, getWebGLContextErrorName } from './util.js';
|
|
32
32
|
|
|
33
33
|
export class WebGLRenderer {
|
|
34
34
|
/**
|
|
@@ -135,7 +135,8 @@ export class WebGLRenderer {
|
|
|
135
135
|
}
|
|
136
136
|
const errorCode = getWebGLContextErrorCode(gl);
|
|
137
137
|
if (errorCode) {
|
|
138
|
-
|
|
138
|
+
const errorName = getWebGLContextErrorName(errorCode);
|
|
139
|
+
game.logger.warn('WebGL context error', { errorCode, errorName });
|
|
139
140
|
}
|
|
140
141
|
if (gl?.isContextLost()) {
|
|
141
142
|
throw new Error('WebGL context lost');
|
|
@@ -1,13 +1,53 @@
|
|
|
1
|
+
// No error has been recorded. The value of this constant is 0.
|
|
2
|
+
export const NO_ERROR = 0;
|
|
3
|
+
// An unacceptable value has been specified for an enumerated argument. The command is ignored and the error flag is set.
|
|
4
|
+
export const INVALID_ENUM = 0x0500;
|
|
5
|
+
// A numeric argument is out of range. The command is ignored and the error flag is set.
|
|
6
|
+
export const INVALID_VALUE = 0x0501;
|
|
7
|
+
// The specified command is not allowed for the current state. The command is ignored and the error flag is set.
|
|
8
|
+
export const INVALID_OPERATION = 0x0502;
|
|
9
|
+
// The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.
|
|
10
|
+
export const INVALID_FRAMEBUFFER_OPERATION = 0x0506;
|
|
11
|
+
// Not enough memory is left to execute the command.
|
|
12
|
+
export const OUT_OF_MEMORY = 0x0505;
|
|
13
|
+
// If the WebGL context is lost, this error is returned on the first call to getError. Afterwards and until the context has been restored, it returns gl.NO_ERROR.
|
|
14
|
+
export const CONTEXT_LOST_WEBGL = 0x9242;
|
|
15
|
+
|
|
1
16
|
/**
|
|
2
17
|
* TBD.
|
|
3
18
|
* @param {WebGLRenderingContext} gl - TBD.
|
|
4
19
|
* @returns {number} TBD.
|
|
5
20
|
*/
|
|
6
21
|
export function getWebGLContextErrorCode(gl) {
|
|
7
|
-
gl.NO_ERROR
|
|
8
22
|
return gl?.getError() ?? 0;
|
|
9
23
|
}
|
|
10
24
|
|
|
25
|
+
/**
|
|
26
|
+
* TBD.
|
|
27
|
+
* @param {number} errorCode - TBD.
|
|
28
|
+
* @returns {string} TBD.
|
|
29
|
+
*/
|
|
30
|
+
export function getWebGLContextErrorName(errorCode) {
|
|
31
|
+
switch (errorCode) {
|
|
32
|
+
case NO_ERROR:
|
|
33
|
+
return 'NO_ERROR';
|
|
34
|
+
case INVALID_ENUM:
|
|
35
|
+
return 'INVALID_ENUM';
|
|
36
|
+
case INVALID_VALUE:
|
|
37
|
+
return 'INVALID_VALUE';
|
|
38
|
+
case INVALID_OPERATION:
|
|
39
|
+
return 'INVALID_OPERATION';
|
|
40
|
+
case INVALID_FRAMEBUFFER_OPERATION:
|
|
41
|
+
return 'INVALID_FRAMEBUFFER_OPERATION';
|
|
42
|
+
case OUT_OF_MEMORY:
|
|
43
|
+
return 'OUT_OF_MEMORY';
|
|
44
|
+
case CONTEXT_LOST_WEBGL:
|
|
45
|
+
return 'CONTEXT_LOST_WEBGL';
|
|
46
|
+
default:
|
|
47
|
+
return `UNKNOWN_ERROR_${errorCode}`;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
11
51
|
/**
|
|
12
52
|
* TBD.
|
|
13
53
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../../src/phaser/display/webgl/renderer.js"],"names":[],"mappings":"AAgCA;IACE;;;OAGG;IACH,kBAFW,OAAO,oBAAoB,EAAE,IAAI,EAwC3C;IArCC,aAAwB;IACxB,gBAAwC;IACxC,oBAAuB;IACvB,qBAAwB;IACxB,uBAAsD;IACtD,cAAuB;IACvB,eAAyB;IACzB,wBAAuB;IACvB;;;;;;;;MAQC;IACD,kBAA6B;IAC7B,cAAyB;IACzB,kCAA6C;IAC7C,8BAAyC;IACzC,kCAA6C;IAC7C,oCAA+C;IAC/C,wCAAmD;IACnD,kBAAuB;IAezB;;OAEG;IACH,gBAuBC;IALC;YA8ByC,MAAM;MA9BjC;IAOhB;;OAEG;IACH,qBAUC;IAED;;;;OAIG;IACH,kBAHW,OAAO,oBAAoB,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../../src/phaser/display/webgl/renderer.js"],"names":[],"mappings":"AAgCA;IACE;;;OAGG;IACH,kBAFW,OAAO,oBAAoB,EAAE,IAAI,EAwC3C;IArCC,aAAwB;IACxB,gBAAwC;IACxC,oBAAuB;IACvB,qBAAwB;IACxB,uBAAsD;IACtD,cAAuB;IACvB,eAAyB;IACzB,wBAAuB;IACvB;;;;;;;;MAQC;IACD,kBAA6B;IAC7B,cAAyB;IACzB,kCAA6C;IAC7C,8BAAyC;IACzC,kCAA6C;IAC7C,oCAA+C;IAC/C,wCAAmD;IACnD,kBAAuB;IAezB;;OAEG;IACH,gBAuBC;IALC;YA8ByC,MAAM;MA9BjC;IAOhB;;OAEG;IACH,qBAUC;IAED;;;;OAIG;IACH,kBAHW,OAAO,oBAAoB,EAAE,IAAI,QAyC3C;IAlBC,iBAAsD;IAoBxD;;;OAGG;IACH,cAFW,OAAO,qBAAqB,EAAE,KAAK,QAkB7C;IAED;;;;;;OAMG;IACH,mCALW,OAAO,iCAAiC,EAAE,aAAa,cACvD,KAAK,UACL,MAAM,UACN,OAAO,sBAAsB,EAAE,MAAM,QAoB/C;IAED;;;;OAIG;IACH,cAHW,MAAM,UACN,MAAM,QAchB;IAED;;;;OAIG;IACH,uBAHW,OAAO,mBAAmB,EAAE,WAAW,GACrC,OAAO,CAsCnB;IAED;;OAEG;IACH,sBAwBC;CACF;sBA3RqB,qBAAqB;mCAMR,qBAAqB;iCACvB,mBAAmB;mCAHjB,qBAAqB;oCAIpB,sBAAsB;sCALpB,oBAAoB"}
|
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
* @returns {number} TBD.
|
|
5
5
|
*/
|
|
6
6
|
export function getWebGLContextErrorCode(gl: WebGLRenderingContext): number;
|
|
7
|
+
/**
|
|
8
|
+
* TBD.
|
|
9
|
+
* @param {number} errorCode - TBD.
|
|
10
|
+
* @returns {string} TBD.
|
|
11
|
+
*/
|
|
12
|
+
export function getWebGLContextErrorName(errorCode: number): string;
|
|
7
13
|
/**
|
|
8
14
|
* TBD.
|
|
9
15
|
*/
|
|
@@ -38,4 +44,11 @@ export function compileFragmentShader(gl: WebGLRenderingContext, shaderSrc: stri
|
|
|
38
44
|
* @returns {WebGLProgram} TBD.
|
|
39
45
|
*/
|
|
40
46
|
export function compileProgram(gl: WebGLRenderingContext, vertexSrc: string[] | string, fragmentSrc: string[] | string): WebGLProgram;
|
|
47
|
+
export const NO_ERROR: 0;
|
|
48
|
+
export const INVALID_ENUM: 1280;
|
|
49
|
+
export const INVALID_VALUE: 1281;
|
|
50
|
+
export const INVALID_OPERATION: 1282;
|
|
51
|
+
export const INVALID_FRAMEBUFFER_OPERATION: 1286;
|
|
52
|
+
export const OUT_OF_MEMORY: 1285;
|
|
53
|
+
export const CONTEXT_LOST_WEBGL: 37442;
|
|
41
54
|
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/phaser/display/webgl/util.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/phaser/display/webgl/util.js"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,6CAHW,qBAAqB,GACnB,MAAM,CAIlB;AAED;;;;GAIG;AACH,oDAHW,MAAM,GACJ,MAAM,CAqBlB;AAED;;GAEG;AACH,2CAAuC;AAEvC;;;;;;GAMG;AACH,kCALW,qBAAqB,aACrB,MAAM,EAAE,GAAC,MAAM,cACf,MAAM,GACJ,WAAW,CAkBvB;AAED;;;;;GAKG;AACH,wCAJW,qBAAqB,aACrB,MAAM,EAAE,GAAC,MAAM,GACb,WAAW,CAIvB;AAED;;;;;GAKG;AACH,0CAJW,qBAAqB,aACrB,MAAM,EAAE,GAAC,MAAM,GACb,WAAW,CAIvB;AAED;;;;;;GAMG;AACH,mCALW,qBAAqB,aACrB,MAAM,EAAE,GAAC,MAAM,eACf,MAAM,EAAE,GAAC,MAAM,GACb,YAAY,CAmBxB;AA3HD,yBAA0B;AAE1B,gCAAmC;AAEnC,iCAAoC;AAEpC,qCAAwC;AAExC,iDAAoD;AAEpD,iCAAoC;AAEpC,uCAAyC"}
|