@galacean/engine-rhi-webgl 2.0.0-alpha.44 → 2.0.0-alpha.46

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-rhi-webgl",
3
- "version": "2.0.0-alpha.44",
3
+ "version": "2.0.0-alpha.46",
4
4
  "repository": {
5
5
  "url": "https://github.com/galacean/engine.git"
6
6
  },
@@ -18,11 +18,11 @@
18
18
  "types/**/*"
19
19
  ],
20
20
  "dependencies": {
21
- "@galacean/engine-core": "2.0.0-alpha.44",
22
- "@galacean/engine-math": "2.0.0-alpha.44"
21
+ "@galacean/engine-core": "2.0.0-alpha.46",
22
+ "@galacean/engine-math": "2.0.0-alpha.46"
23
23
  },
24
24
  "devDependencies": {
25
- "@galacean/engine-design": "2.0.0-alpha.44"
25
+ "@galacean/engine-design": "2.0.0-alpha.46"
26
26
  },
27
27
  "scripts": {
28
28
  "b:types": "tsc"
@@ -1,6 +1,8 @@
1
1
  import { BufferBindFlag, BufferUsage, IPlatformBuffer, SetDataOptions } from "@galacean/engine-core";
2
2
  import { WebGLGraphicDevice } from "./WebGLGraphicDevice";
3
3
  export declare class GLBuffer implements IPlatformBuffer {
4
+ /** @internal */
5
+ _glBuffer: WebGLBuffer;
4
6
  private _gl;
5
7
  private _glBindTarget;
6
8
  private _glBufferUsage;
@@ -1 +1,33 @@
1
- export {};
1
+ import { Primitive } from "@galacean/engine-core";
2
+ import { SubPrimitive } from "@galacean/engine-core/types/graphic/SubPrimitive";
3
+ import { IPlatformPrimitive, IPlatformShaderProgram } from "@galacean/engine-design";
4
+ import { WebGLGraphicDevice } from "./WebGLGraphicDevice";
5
+ /**
6
+ * Improvement of VAO:
7
+ * 1) WebGL2.0 must support VAO, almost all devices support vao extensions in webgl1.0, we can use PollyFill,only keep VAO mode.
8
+ */
9
+ /**
10
+ * @internal
11
+ * GL platform primitive.
12
+ */
13
+ export declare class GLPrimitive implements IPlatformPrimitive {
14
+ private _attribLocArray;
15
+ private readonly _primitive;
16
+ private readonly _canUseInstancedArrays;
17
+ private _gl;
18
+ private _vaoMap;
19
+ private readonly _isSupportVAO;
20
+ constructor(rhi: WebGLGraphicDevice, primitive: Primitive);
21
+ /**
22
+ * Draw the primitive.
23
+ */
24
+ draw(shaderProgram: IPlatformShaderProgram, subMesh: SubPrimitive): void;
25
+ destroy(): void;
26
+ /**
27
+ * Bind buffer and attribute.
28
+ */
29
+ private _bindBufferAndAttrib;
30
+ private _disableAttrib;
31
+ private _registerVAO;
32
+ private _clearVAO;
33
+ }
@@ -1,9 +1,42 @@
1
- import { IPlatformTexture, Texture, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureWrapMode } from "@galacean/engine-core";
1
+ import { IPlatformTexture, Texture, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureWrapMode } from "@galacean/engine-core";
2
2
  import { WebGLGraphicDevice } from "./WebGLGraphicDevice";
3
+ import { TextureFormatDetail } from "./type";
3
4
  /**
4
5
  * Texture in WebGL platform.
5
6
  */
6
7
  export declare class GLTexture implements IPlatformTexture {
8
+ /**
9
+ * Get more texture info from TextureFormat.
10
+ * @internal
11
+ */
12
+ static _getFormatDetail(format: TextureFormat, isSRGBColorSpace: boolean, gl: WebGLRenderingContext & WebGL2RenderingContext, isWebGL2: boolean): TextureFormatDetail;
13
+ /**
14
+ * In WebGL 1, internalformat must be the same as baseFormat when call texImage2D.
15
+ * @internal
16
+ */
17
+ static _getRenderBufferDepthFormatDetail(format: TextureFormat, gl: WebGLRenderingContext & WebGL2RenderingContext, isWebGL2: boolean): TextureFormatDetail;
18
+ /**
19
+ * @internal
20
+ */
21
+ static _supportRenderBufferColorFormat(format: TextureFormat, rhi: WebGLGraphicDevice): boolean;
22
+ /**
23
+ * @internal
24
+ */
25
+ static _supportRenderBufferDepthFormat(format: TextureFormat, rhi: WebGLGraphicDevice): boolean;
26
+ /** @internal */
27
+ _texture: Texture;
28
+ /** @internal */
29
+ _glTexture: WebGLTexture;
30
+ /** @internal */
31
+ _rhi: WebGLGraphicDevice;
32
+ /** @internal */
33
+ _gl: WebGLRenderingContext & WebGL2RenderingContext;
34
+ /** @internal */
35
+ _isWebGL2: boolean;
36
+ /** @internal */
37
+ _target: GLenum;
38
+ /** @internal */
39
+ _formatDetail: TextureFormatDetail;
7
40
  /**
8
41
  * Wrapping mode for texture coordinate S.
9
42
  */
@@ -29,6 +62,10 @@ export declare class GLTexture implements IPlatformTexture {
29
62
  * Destroy texture.
30
63
  */
31
64
  destroy(): void;
65
+ /**
66
+ * @internal
67
+ */
68
+ setUseDepthCompareMode(value: boolean): void;
32
69
  /**
33
70
  * Generate multi-level textures based on the 0th level data.
34
71
  */
@@ -1 +1,18 @@
1
- export {};
1
+ import { IPlatformTransformFeedback, IPlatformBuffer } from "@galacean/engine-core";
2
+ import { WebGLGraphicDevice } from "./WebGLGraphicDevice";
3
+ /**
4
+ * @internal
5
+ * WebGL2 implementation of Transform Feedback.
6
+ */
7
+ export declare class GLTransformFeedback implements IPlatformTransformFeedback {
8
+ private _gl;
9
+ private _glTransformFeedback;
10
+ constructor(rhi: WebGLGraphicDevice);
11
+ bindBufferRange(index: number, buffer: IPlatformBuffer, byteOffset: number, byteSize: number): void;
12
+ unbindBuffer(index: number): void;
13
+ begin(primitiveMode: number): void;
14
+ end(): void;
15
+ bind(): void;
16
+ unbind(): void;
17
+ destroy(): void;
18
+ }
@@ -1 +1,22 @@
1
- export {};
1
+ import { IPlatformTransformFeedbackPrimitive, VertexElement, VertexBufferBinding } from "@galacean/engine-core";
2
+ /**
3
+ * @internal
4
+ * WebGL2 implementation of Transform Feedback primitive.
5
+ * Maintains two VAOs (one per read direction), auto-rebuilds when program changes.
6
+ */
7
+ export declare class GLTransformFeedbackPrimitive implements IPlatformTransformFeedbackPrimitive {
8
+ private _gl;
9
+ private _vaoA;
10
+ private _vaoB;
11
+ private _lastProgramId;
12
+ constructor(gl: WebGL2RenderingContext);
13
+ updateVertexLayout(program: any, readBinding: VertexBufferBinding, writeBinding: VertexBufferBinding, feedbackElements: VertexElement[], inputBinding: VertexBufferBinding, inputElements: VertexElement[]): void;
14
+ bind(readIsA: boolean): void;
15
+ unbind(): void;
16
+ draw(mode: number, first: number, count: number): void;
17
+ invalidate(): void;
18
+ destroy(): void;
19
+ private _deleteVAOs;
20
+ private _createVAO;
21
+ private _bindElements;
22
+ }
@@ -24,7 +24,19 @@ export declare class WebCanvas extends Canvas {
24
24
  * @param webCanvas - Web native canvas
25
25
  */
26
26
  constructor(webCanvas: HTMLCanvasElement | OffscreenCanvas);
27
+ /**
28
+ * @internal
29
+ */
30
+ _isOffscreenCanvas(): boolean;
31
+ /**
32
+ * @internal
33
+ */
34
+ _pumpPendingResolution(): void;
27
35
  private _setResolutionByClientSizeFallback;
36
+ /**
37
+ * @internal
38
+ */
39
+ _destroy(): void;
28
40
  protected _exitAutoResolution(): void;
29
41
  protected _onResolutionChanged(width: number, height: number): void;
30
42
  }
@@ -1,4 +1,4 @@
1
- import { BufferBindFlag, BufferUsage, CameraClearFlags, Canvas, Engine, GLCapabilityType, IPlatformBuffer, IPlatformRenderTarget, IPlatformTexture2D, IPlatformTextureCube, IPlatformTransformFeedback, IPlatformTransformFeedbackPrimitive, Mesh, RenderTarget, SubMesh, Texture2D, Texture2DArray, TextureCube, TextureCubeFace } from "@galacean/engine-core";
1
+ import { BufferBindFlag, BufferUsage, CameraClearFlags, Canvas, Engine, GLCapabilityType, IPlatformBuffer, IPlatformRenderTarget, IPlatformTexture2D, IPlatformTextureCube, IPlatformTransformFeedback, IPlatformTransformFeedbackPrimitive, Primitive, RenderTarget, SubMesh, Texture2D, Texture2DArray, TextureCube, TextureCubeFace } from "@galacean/engine-core";
2
2
  import { IHardwareRenderer, IPlatformPrimitive, IPlatformShaderProgram } from "@galacean/engine-design";
3
3
  import { Color, Vector4 } from "@galacean/engine-math";
4
4
  import { GLCapability } from "./GLCapability";
@@ -24,6 +24,18 @@ export declare enum WebGLMode {
24
24
  export interface WebGLGraphicDeviceOptions {
25
25
  /** WebGL mode.*/
26
26
  webGLMode?: WebGLMode;
27
+ /**
28
+ * @internal
29
+ * iOS 15 webgl implement has bug, maybe should force call flush command buffer, for example iPhone13(iOS 15.4.1).
30
+ */
31
+ _forceFlush?: boolean;
32
+ /**
33
+ * @internal
34
+ * Max allow skin uniform vectors count, default is 256
35
+ *
36
+ * @remarks large count maybe cause performance issue.
37
+ */
38
+ _maxAllowSkinUniformVectorCount?: number;
27
39
  alpha?: boolean;
28
40
  depth?: boolean;
29
41
  desynchronized?: boolean;
@@ -39,6 +51,18 @@ export interface WebGLGraphicDeviceOptions {
39
51
  */
40
52
  export declare class WebGLGraphicDevice implements IHardwareRenderer {
41
53
  maxUniformBlockSize: number;
54
+ /** @internal */
55
+ _readFrameBuffer: WebGLFramebuffer;
56
+ /** @internal */
57
+ _mainFrameBuffer: WebGLFramebuffer;
58
+ /** @internal */
59
+ _mainFrameWidth: number;
60
+ /** @internal */
61
+ _mainFrameHeight: number;
62
+ /** @internal */
63
+ _enableGlobalDepthBias: boolean;
64
+ /** @internal */
65
+ _currentBindShaderProgram: any;
42
66
  private _options;
43
67
  private _webGLOptions;
44
68
  private _gl;
@@ -68,7 +92,7 @@ export declare class WebGLGraphicDevice implements IHardwareRenderer {
68
92
  get canIUseMoreJoints(): boolean;
69
93
  constructor(initializeOptions?: WebGLGraphicDeviceOptions);
70
94
  init(canvas: Canvas, onDeviceLost: () => void, onDeviceRestored: () => void): void;
71
- createPlatformPrimitive(primitive: Mesh): IPlatformPrimitive;
95
+ createPlatformPrimitive(primitive: Primitive): IPlatformPrimitive;
72
96
  createPlatformTexture2D(texture2D: Texture2D): IPlatformTexture2D;
73
97
  createPlatformTexture2DArray(texture2D: Texture2DArray): GLTexture2DArray;
74
98
  createPlatformTextureCube(textureCube: TextureCube): IPlatformTextureCube;