@galacean/engine-rhi-webgl 2.0.0-alpha.59 → 2.0.0-alpha.60
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/dist/main.js +135 -390
- package/dist/main.js.map +1 -1
- package/dist/module.js +137 -391
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/GLBuffer.d.ts +0 -1
- package/types/GLCapability.d.ts +0 -16
- package/types/GLPrimitive.d.ts +0 -6
- package/types/GLRenderStates.d.ts +2 -2
- package/types/GLRenderTarget.d.ts +0 -1
- package/types/GLTexture.d.ts +4 -11
- package/types/GLTexture2D.d.ts +0 -2
- package/types/GLTexture2DArray.d.ts +1 -1
- package/types/GLTextureCube.d.ts +0 -2
- package/types/WebGLEngine.d.ts +1 -1
- package/types/WebGLGraphicDevice.d.ts +4 -21
- package/types/index.d.ts +1 -1
- package/types/type.d.ts +0 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-rhi-webgl",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.60",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "https://github.com/galacean/engine.git"
|
|
6
6
|
},
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"types/**/*"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@galacean/engine-core": "2.0.0-alpha.
|
|
22
|
-
"@galacean/engine-math": "2.0.0-alpha.
|
|
21
|
+
"@galacean/engine-core": "2.0.0-alpha.60",
|
|
22
|
+
"@galacean/engine-math": "2.0.0-alpha.60"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"b:types": "tsc"
|
package/types/GLBuffer.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export declare class GLBuffer implements IPlatformBuffer {
|
|
|
6
6
|
private _gl;
|
|
7
7
|
private _glBindTarget;
|
|
8
8
|
private _glBufferUsage;
|
|
9
|
-
private _isWebGL2;
|
|
10
9
|
constructor(rhi: WebGLGraphicDevice, type: BufferBindFlag, byteLength: number, bufferUsage?: BufferUsage, data?: ArrayBuffer | ArrayBufferView);
|
|
11
10
|
bind(): void;
|
|
12
11
|
setData(byteLength: number, data: ArrayBuffer | ArrayBufferView, bufferByteOffset?: number, dataOffset?: number, dataLength?: number, options?: SetDataOptions): void;
|
package/types/GLCapability.d.ts
CHANGED
|
@@ -12,11 +12,6 @@ export declare class GLCapability {
|
|
|
12
12
|
capabilityList: Map<GLCapabilityType, boolean>;
|
|
13
13
|
get maxTextureSize(): number;
|
|
14
14
|
get maxVertexUniformVectors(): number;
|
|
15
|
-
get canUseFloatTextureBlendShape(): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Whether can use more joints.
|
|
18
|
-
*/
|
|
19
|
-
get canIUseMoreJoints(): boolean;
|
|
20
15
|
get maxDrawBuffers(): number;
|
|
21
16
|
/**
|
|
22
17
|
* Max anisoLevel.
|
|
@@ -26,7 +21,6 @@ export declare class GLCapability {
|
|
|
26
21
|
* Max MSAA count.
|
|
27
22
|
*/
|
|
28
23
|
get maxAntiAliasing(): number;
|
|
29
|
-
get isFragmentHighPrecision(): boolean;
|
|
30
24
|
get rhi(): WebGLGraphicDevice;
|
|
31
25
|
constructor(rhi: WebGLGraphicDevice);
|
|
32
26
|
/**
|
|
@@ -49,14 +43,4 @@ export declare class GLCapability {
|
|
|
49
43
|
* Init capabilities.
|
|
50
44
|
*/
|
|
51
45
|
private _init;
|
|
52
|
-
/**
|
|
53
|
-
* If there are extensions that can supplement this ability, smooth out the difference.
|
|
54
|
-
* @example
|
|
55
|
-
* compatible(GLCapabilityType.depthTexture,{
|
|
56
|
-
* UNSIGNED_INT_24_8: "UNSIGNED_INT_24_8_WEBGL"
|
|
57
|
-
* })
|
|
58
|
-
* gl.UNSIGNED_INT_24_8 = ext.UNSIGNED_INT_24_8_WEBGL
|
|
59
|
-
*/
|
|
60
|
-
private _compatibleInterface;
|
|
61
|
-
private _compatibleAllInterface;
|
|
62
46
|
}
|
package/types/GLPrimitive.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { IPlatformPrimitive, IPlatformShaderProgram, Primitive, SubPrimitive } from "@galacean/engine-core";
|
|
2
2
|
import { WebGLGraphicDevice } from "./WebGLGraphicDevice";
|
|
3
|
-
/**
|
|
4
|
-
* Improvement of VAO:
|
|
5
|
-
* 1) WebGL2.0 must support VAO, almost all devices support vao extensions in webgl1.0, we can use PollyFill,only keep VAO mode.
|
|
6
|
-
*/
|
|
7
3
|
/**
|
|
8
4
|
* @internal
|
|
9
5
|
* GL platform primitive.
|
|
@@ -11,10 +7,8 @@ import { WebGLGraphicDevice } from "./WebGLGraphicDevice";
|
|
|
11
7
|
export declare class GLPrimitive implements IPlatformPrimitive {
|
|
12
8
|
private _attribLocArray;
|
|
13
9
|
private readonly _primitive;
|
|
14
|
-
private readonly _canUseInstancedArrays;
|
|
15
10
|
private _gl;
|
|
16
11
|
private _vaoMap;
|
|
17
|
-
private readonly _isSupportVAO;
|
|
18
12
|
constructor(rhi: WebGLGraphicDevice, primitive: Primitive);
|
|
19
13
|
/**
|
|
20
14
|
* Draw the primitive.
|
|
@@ -5,9 +5,9 @@ export declare class GLRenderStates {
|
|
|
5
5
|
private _gl;
|
|
6
6
|
private _parameters;
|
|
7
7
|
/**
|
|
8
|
-
* @param {
|
|
8
|
+
* @param {WebGL2RenderingContext} gl
|
|
9
9
|
*/
|
|
10
|
-
constructor(gl:
|
|
10
|
+
constructor(gl: WebGL2RenderingContext);
|
|
11
11
|
/**
|
|
12
12
|
* Get a parameter.
|
|
13
13
|
*/
|
package/types/GLTexture.d.ts
CHANGED
|
@@ -9,16 +9,11 @@ export declare class GLTexture implements IPlatformTexture {
|
|
|
9
9
|
* Get more texture info from TextureFormat.
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
|
-
static _getFormatDetail(format: TextureFormat, isSRGBColorSpace: boolean, gl:
|
|
12
|
+
static _getFormatDetail(format: TextureFormat, isSRGBColorSpace: boolean, gl: WebGL2RenderingContext): TextureFormatDetail;
|
|
13
13
|
/**
|
|
14
|
-
* In WebGL 1, internalformat must be the same as baseFormat when call texImage2D.
|
|
15
14
|
* @internal
|
|
16
15
|
*/
|
|
17
|
-
static _getRenderBufferDepthFormatDetail(format: TextureFormat, gl:
|
|
18
|
-
/**
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
static _supportRenderBufferDepthFormat(format: TextureFormat, rhi: WebGLGraphicDevice): boolean;
|
|
16
|
+
static _getRenderBufferDepthFormatDetail(format: TextureFormat, gl: WebGL2RenderingContext): TextureFormatDetail;
|
|
22
17
|
/** @internal */
|
|
23
18
|
_texture: Texture;
|
|
24
19
|
/** @internal */
|
|
@@ -26,9 +21,7 @@ export declare class GLTexture implements IPlatformTexture {
|
|
|
26
21
|
/** @internal */
|
|
27
22
|
_rhi: WebGLGraphicDevice;
|
|
28
23
|
/** @internal */
|
|
29
|
-
_gl:
|
|
30
|
-
/** @internal */
|
|
31
|
-
_isWebGL2: boolean;
|
|
24
|
+
_gl: WebGL2RenderingContext;
|
|
32
25
|
/** @internal */
|
|
33
26
|
_target: GLenum;
|
|
34
27
|
/** @internal */
|
|
@@ -83,6 +76,6 @@ export declare class GLTexture implements IPlatformTexture {
|
|
|
83
76
|
*/
|
|
84
77
|
protected _getPixelBuffer(face: TextureCubeFace | null, x: number, y: number, width: number, height: number, mipLevel: number, out: ArrayBufferView): void;
|
|
85
78
|
protected _getReadFrameBuffer(): WebGLFramebuffer | null;
|
|
86
|
-
protected _validate(texture: Texture
|
|
79
|
+
protected _validate(texture: Texture): void;
|
|
87
80
|
private _setWrapMode;
|
|
88
81
|
}
|
package/types/GLTexture2D.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ import { WebGLGraphicDevice } from "./WebGLGraphicDevice";
|
|
|
5
5
|
* Texture 2d in WebGL platform.
|
|
6
6
|
*/
|
|
7
7
|
export declare class GLTexture2D extends GLTexture implements IPlatformTexture2D {
|
|
8
|
-
/** Backward compatible with WebGL1.0. */
|
|
9
|
-
private _compressedMipFilled;
|
|
10
8
|
constructor(rhi: WebGLGraphicDevice, texture2D: Texture2D);
|
|
11
9
|
/**
|
|
12
10
|
* {@inheritDoc IPlatformTexture2D.setPixelBuffer}
|
|
@@ -18,5 +18,5 @@ export declare class GLTexture2DArray extends GLTexture implements IPlatformText
|
|
|
18
18
|
* {@inheritDoc IPlatformTexture2DArray.getPixelBuffer}
|
|
19
19
|
*/
|
|
20
20
|
getPixelBuffer(elementIndex: number, x: number, y: number, width: number, height: number, mipLevel: number, out: ArrayBufferView): void;
|
|
21
|
-
protected _validate(texture: Texture2DArray
|
|
21
|
+
protected _validate(texture: Texture2DArray): void;
|
|
22
22
|
}
|
package/types/GLTextureCube.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ import { WebGLGraphicDevice } from "./WebGLGraphicDevice";
|
|
|
5
5
|
* Cube texture in WebGL platform.
|
|
6
6
|
*/
|
|
7
7
|
export declare class GLTextureCube extends GLTexture implements IPlatformTextureCube {
|
|
8
|
-
/** Backward compatible with WebGL1.0. */
|
|
9
|
-
private _compressedFaceFilled;
|
|
10
8
|
constructor(rhi: WebGLGraphicDevice, textureCube: TextureCube);
|
|
11
9
|
/**
|
|
12
10
|
* {@inheritDoc IPlatformTextureCube.setPixelBuffer}
|
package/types/WebGLEngine.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Engine, EngineConfiguration } from "@galacean/engine-core";
|
|
|
2
2
|
import { WebGLGraphicDeviceOptions } from "./";
|
|
3
3
|
import { WebCanvas } from "./WebCanvas";
|
|
4
4
|
/**
|
|
5
|
-
* WebGL platform engine, supports WebGL
|
|
5
|
+
* WebGL platform engine, supports WebGL 2.0.
|
|
6
6
|
*/
|
|
7
7
|
export declare class WebGLEngine extends Engine {
|
|
8
8
|
/**
|
|
@@ -3,24 +3,10 @@ import { Color, Vector4 } from "@galacean/engine-math";
|
|
|
3
3
|
import { GLCapability } from "./GLCapability";
|
|
4
4
|
import { GLRenderStates } from "./GLRenderStates";
|
|
5
5
|
import { GLTexture2DArray } from "./GLTexture2DArray";
|
|
6
|
-
import { WebGLExtension } from "./type";
|
|
7
|
-
/**
|
|
8
|
-
* WebGL mode.
|
|
9
|
-
*/
|
|
10
|
-
export declare enum WebGLMode {
|
|
11
|
-
/** Auto, use WebGL2.0 if support, or will fallback to WebGL1.0. */
|
|
12
|
-
Auto = 0,
|
|
13
|
-
/** WebGL2.0. */
|
|
14
|
-
WebGL2 = 1,
|
|
15
|
-
/** WebGL1.0, */
|
|
16
|
-
WebGL1 = 2
|
|
17
|
-
}
|
|
18
6
|
/**
|
|
19
7
|
* WebGL graphic device options.
|
|
20
8
|
*/
|
|
21
9
|
export interface WebGLGraphicDeviceOptions {
|
|
22
|
-
/** WebGL mode.*/
|
|
23
|
-
webGLMode?: WebGLMode;
|
|
24
10
|
/**
|
|
25
11
|
* @internal
|
|
26
12
|
* iOS 15 webgl implement has bug, maybe should force call flush command buffer, for example iPhone13(iOS 15.4.1).
|
|
@@ -44,7 +30,7 @@ export interface WebGLGraphicDeviceOptions {
|
|
|
44
30
|
xrCompatible?: boolean;
|
|
45
31
|
}
|
|
46
32
|
/**
|
|
47
|
-
* WebGL graphic device,
|
|
33
|
+
* WebGL graphic device, using WebGL2.0.
|
|
48
34
|
*/
|
|
49
35
|
export declare class WebGLGraphicDevice implements IHardwareRenderer {
|
|
50
36
|
readonly supportsRendering = true;
|
|
@@ -68,7 +54,6 @@ export declare class WebGLGraphicDevice implements IHardwareRenderer {
|
|
|
68
54
|
private _renderStates;
|
|
69
55
|
private _extensions;
|
|
70
56
|
private _capability;
|
|
71
|
-
private _isWebGL2;
|
|
72
57
|
private _renderer;
|
|
73
58
|
private _webCanvas;
|
|
74
59
|
private _activeTextureID;
|
|
@@ -79,16 +64,14 @@ export declare class WebGLGraphicDevice implements IHardwareRenderer {
|
|
|
79
64
|
private _scissorEnable;
|
|
80
65
|
private _onDeviceLost;
|
|
81
66
|
private _onDeviceRestored;
|
|
82
|
-
get isWebGL2(): boolean;
|
|
83
67
|
get renderer(): string;
|
|
84
68
|
/**
|
|
85
69
|
* GL Context
|
|
86
|
-
* @member {
|
|
70
|
+
* @member {WebGL2RenderingContext}
|
|
87
71
|
*/
|
|
88
|
-
get gl():
|
|
72
|
+
get gl(): WebGL2RenderingContext;
|
|
89
73
|
get renderStates(): GLRenderStates;
|
|
90
74
|
get capability(): GLCapability;
|
|
91
|
-
get canIUseMoreJoints(): boolean;
|
|
92
75
|
constructor(initializeOptions?: WebGLGraphicDeviceOptions);
|
|
93
76
|
init(canvas: Canvas, onDeviceLost: () => void, onDeviceRestored: () => void): void;
|
|
94
77
|
createPlatformPrimitive(primitive: Primitive): IPlatformPrimitive;
|
|
@@ -141,7 +124,7 @@ export declare class WebGLGraphicDevice implements IHardwareRenderer {
|
|
|
141
124
|
*/
|
|
142
125
|
isContextLost(): boolean;
|
|
143
126
|
resetState(): void;
|
|
144
|
-
protected _initGLState(gl:
|
|
127
|
+
protected _initGLState(gl: WebGL2RenderingContext): void;
|
|
145
128
|
destroy(): void;
|
|
146
129
|
private _onContextCreationError;
|
|
147
130
|
private _onWebGLContextLost;
|
package/types/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export { GLCompressedTextureInternalFormat } from "./type";
|
|
|
2
2
|
export { WebCanvas } from "./WebCanvas";
|
|
3
3
|
export { WebGLEngine } from "./WebGLEngine";
|
|
4
4
|
export type { WebGLEngineConfiguration } from "./WebGLEngine";
|
|
5
|
-
export {
|
|
5
|
+
export { WebGLGraphicDevice } from "./WebGLGraphicDevice";
|
|
6
6
|
export type { WebGLGraphicDeviceOptions } from "./WebGLGraphicDevice";
|
package/types/type.d.ts
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Smoothing plug-in.
|
|
3
|
-
* */
|
|
4
|
-
export interface WebGLExtension {
|
|
5
|
-
MAX_DRAW_BUFFERS: GLenum;
|
|
6
|
-
UNSIGNED_INT_24_8: GLenum;
|
|
7
|
-
MAX_SAMPLES: GLenum;
|
|
8
|
-
RGBA8: GLenum;
|
|
9
|
-
RGBA16F: GLenum;
|
|
10
|
-
RGBA32F: GLenum;
|
|
11
|
-
DEPTH_COMPONENT32F: GLenum;
|
|
12
|
-
READ_FRAMEBUFFER: GLenum;
|
|
13
|
-
DRAW_FRAMEBUFFER: GLenum;
|
|
14
|
-
createVertexArray(): WebGLVertexArrayObject | null;
|
|
15
|
-
deleteVertexArray(vertexArray: WebGLVertexArrayObject | null): void;
|
|
16
|
-
isVertexArray(vertexArray: WebGLVertexArrayObject | null): GLboolean;
|
|
17
|
-
bindVertexArray(array: WebGLVertexArrayObject | null): void;
|
|
18
|
-
renderbufferStorageMultisample(target: GLenum, samples: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei): void;
|
|
19
|
-
blitFramebuffer(srcX0: GLint, srcY0: GLint, srcX1: GLint, srcY1: GLint, dstX0: GLint, dstY0: GLint, dstX1: GLint, dstY1: GLint, mask: GLbitfield, filter: GLenum): void;
|
|
20
|
-
drawArraysInstanced(mode: GLenum, first: GLint, count: GLsizei, instanceCount: GLsizei): void;
|
|
21
|
-
drawElementsInstanced(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, instanceCount: GLsizei): void;
|
|
22
|
-
vertexAttribDivisor(index: GLuint, divisor: GLuint): void;
|
|
23
|
-
drawBuffers(buffers: Iterable<GLenum>): void;
|
|
24
|
-
}
|
|
25
1
|
export interface TextureFormatDetail {
|
|
26
2
|
internalFormat: GLint;
|
|
27
3
|
baseFormat?: GLenum;
|