@galacean/engine-rhi-webgl 2.0.0-alpha.6 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-rhi-webgl",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.0-alpha.60",
4
4
  "repository": {
5
5
  "url": "https://github.com/galacean/engine.git"
6
6
  },
@@ -18,11 +18,8 @@
18
18
  "types/**/*"
19
19
  ],
20
20
  "dependencies": {
21
- "@galacean/engine-math": "2.0.0-alpha.6",
22
- "@galacean/engine-core": "2.0.0-alpha.6"
23
- },
24
- "devDependencies": {
25
- "@galacean/engine-design": "2.0.0-alpha.6"
21
+ "@galacean/engine-core": "2.0.0-alpha.60",
22
+ "@galacean/engine-math": "2.0.0-alpha.60"
26
23
  },
27
24
  "scripts": {
28
25
  "b:types": "tsc"
@@ -1,15 +1,16 @@
1
1
  import { BufferBindFlag, BufferUsage, IPlatformBuffer, SetDataOptions } from "@galacean/engine-core";
2
- import { WebGLGraphicDevice } from "./WebGLGraphicDevice";
2
+ import type { WebGLGraphicDevice } from "./WebGLGraphicDevice";
3
3
  export declare class GLBuffer implements IPlatformBuffer {
4
+ /** @internal */
5
+ _glBuffer: WebGLBuffer | null;
4
6
  private _gl;
5
7
  private _glBindTarget;
6
8
  private _glBufferUsage;
7
- private _glBuffer;
8
- private _isWebGL2;
9
9
  constructor(rhi: WebGLGraphicDevice, type: BufferBindFlag, byteLength: number, bufferUsage?: BufferUsage, data?: ArrayBuffer | ArrayBufferView);
10
10
  bind(): void;
11
11
  setData(byteLength: number, data: ArrayBuffer | ArrayBufferView, bufferByteOffset?: number, dataOffset?: number, dataLength?: number, options?: SetDataOptions): void;
12
12
  getData(data: ArrayBufferView, bufferByteOffset?: number, dataOffset?: number, dataLength?: number): void;
13
+ copyFromBuffer(srcBuffer: IPlatformBuffer, srcByteOffset: number, dstByteOffset: number, byteLength: number): void;
13
14
  destroy(): void;
14
15
  private _getGLBufferUsage;
15
16
  }
@@ -1,4 +1,4 @@
1
- import { GLCapabilityType } from "@galacean/engine-core";
1
+ import { GLCapabilityType, TextureFormat } from "@galacean/engine-core";
2
2
  import { WebGLGraphicDevice } from "./WebGLGraphicDevice";
3
3
  import { GLCompressedTextureInternalFormat } from "./type";
4
4
  /**
@@ -10,12 +10,8 @@ export declare class GLCapability {
10
10
  private _maxAntiAliasing;
11
11
  _rhi: WebGLGraphicDevice;
12
12
  capabilityList: Map<GLCapabilityType, boolean>;
13
- get maxTextureSize(): boolean;
14
- get canUseFloatTextureBlendShape(): boolean;
15
- /**
16
- * Whether can use more joints.
17
- */
18
- get canIUseMoreJoints(): boolean;
13
+ get maxTextureSize(): number;
14
+ get maxVertexUniformVectors(): number;
19
15
  get maxDrawBuffers(): number;
20
16
  /**
21
17
  * Max anisoLevel.
@@ -25,7 +21,6 @@ export declare class GLCapability {
25
21
  * Max MSAA count.
26
22
  */
27
23
  get maxAntiAliasing(): number;
28
- get isFragmentHighPrecision(): boolean;
29
24
  get rhi(): WebGLGraphicDevice;
30
25
  constructor(rhi: WebGLGraphicDevice);
31
26
  /**
@@ -37,17 +32,15 @@ export declare class GLCapability {
37
32
  */
38
33
  canIUseCompressedTextureInternalFormat(internalType: GLCompressedTextureInternalFormat): boolean;
39
34
  /**
40
- * Init capabilities.
35
+ * Check whether the given texture format is supported.
41
36
  */
42
- private _init;
37
+ supportsTextureFormat(format: TextureFormat): boolean;
43
38
  /**
44
- * If there are extensions that can supplement this ability, smooth out the difference.
45
- * @example
46
- * compatible(GLCapabilityType.depthTexture,{
47
- * UNSIGNED_INT_24_8: "UNSIGNED_INT_24_8_WEBGL"
48
- * })
49
- * gl.UNSIGNED_INT_24_8 = ext.UNSIGNED_INT_24_8_WEBGL
39
+ * Check whether the given texture format can be rendered to as a color attachment.
50
40
  */
51
- private _compatibleInterface;
52
- private _compatibleAllInterface;
41
+ supportsRenderTargetColorFormat(format: TextureFormat): boolean;
42
+ /**
43
+ * Init capabilities.
44
+ */
45
+ private _init;
53
46
  }
@@ -1 +1,25 @@
1
- export {};
1
+ import { IPlatformPrimitive, IPlatformShaderProgram, Primitive, SubPrimitive } from "@galacean/engine-core";
2
+ import { WebGLGraphicDevice } from "./WebGLGraphicDevice";
3
+ /**
4
+ * @internal
5
+ * GL platform primitive.
6
+ */
7
+ export declare class GLPrimitive implements IPlatformPrimitive {
8
+ private _attribLocArray;
9
+ private readonly _primitive;
10
+ private _gl;
11
+ private _vaoMap;
12
+ constructor(rhi: WebGLGraphicDevice, primitive: Primitive);
13
+ /**
14
+ * Draw the primitive.
15
+ */
16
+ draw(shaderProgram: IPlatformShaderProgram, subMesh: SubPrimitive): void;
17
+ destroy(): void;
18
+ /**
19
+ * Bind buffer and attribute.
20
+ */
21
+ private _bindBufferAndAttrib;
22
+ private _disableAttrib;
23
+ private _registerVAO;
24
+ private _clearVAO;
25
+ }
@@ -5,9 +5,9 @@ export declare class GLRenderStates {
5
5
  private _gl;
6
6
  private _parameters;
7
7
  /**
8
- * @param {WebGLRenderingContext} gl
8
+ * @param {WebGL2RenderingContext} gl
9
9
  */
10
- constructor(gl: WebGLRenderingContext);
10
+ constructor(gl: WebGL2RenderingContext);
11
11
  /**
12
12
  * Get a parameter.
13
13
  */
@@ -5,7 +5,6 @@ import { WebGLGraphicDevice } from "./WebGLGraphicDevice";
5
5
  */
6
6
  export declare class GLRenderTarget implements IPlatformRenderTarget {
7
7
  private _gl;
8
- private _isWebGL2;
9
8
  private _target;
10
9
  private _frameBuffer;
11
10
  private _MSAAFrameBuffer;
@@ -16,6 +15,7 @@ export declare class GLRenderTarget implements IPlatformRenderTarget {
16
15
  private _blitDrawBuffers;
17
16
  private _curMipLevel;
18
17
  private _curFaceIndex;
18
+ private _antiAliasing;
19
19
  /**
20
20
  * Create render target in WebGL platform.
21
21
  */
@@ -36,5 +36,6 @@ export declare class GLRenderTarget implements IPlatformRenderTarget {
36
36
  destroy(): void;
37
37
  private _bindMainFBO;
38
38
  private _bindMSAAFBO;
39
+ private _createRenderBuffer;
39
40
  private _checkFrameBuffer;
40
41
  }
@@ -1,9 +1,31 @@
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: WebGL2RenderingContext): TextureFormatDetail;
13
+ /**
14
+ * @internal
15
+ */
16
+ static _getRenderBufferDepthFormatDetail(format: TextureFormat, gl: WebGL2RenderingContext): TextureFormatDetail;
17
+ /** @internal */
18
+ _texture: Texture;
19
+ /** @internal */
20
+ _glTexture: WebGLTexture | null;
21
+ /** @internal */
22
+ _rhi: WebGLGraphicDevice;
23
+ /** @internal */
24
+ _gl: WebGL2RenderingContext;
25
+ /** @internal */
26
+ _target: GLenum;
27
+ /** @internal */
28
+ _formatDetail: TextureFormatDetail;
7
29
  /**
8
30
  * Wrapping mode for texture coordinate S.
9
31
  */
@@ -29,6 +51,10 @@ export declare class GLTexture implements IPlatformTexture {
29
51
  * Destroy texture.
30
52
  */
31
53
  destroy(): void;
54
+ /**
55
+ * @internal
56
+ */
57
+ setUseDepthCompareMode(value: boolean): void;
32
58
  /**
33
59
  * Generate multi-level textures based on the 0th level data.
34
60
  */
@@ -49,7 +75,7 @@ export declare class GLTexture implements IPlatformTexture {
49
75
  * @param mipLevel - Set mip level the data want to get from
50
76
  */
51
77
  protected _getPixelBuffer(face: TextureCubeFace | null, x: number, y: number, width: number, height: number, mipLevel: number, out: ArrayBufferView): void;
52
- protected _getReadFrameBuffer(): WebGLFramebuffer;
53
- protected _validate(texture: Texture, rhi: WebGLGraphicDevice): void;
78
+ protected _getReadFrameBuffer(): WebGLFramebuffer | null;
79
+ protected _validate(texture: Texture): void;
54
80
  private _setWrapMode;
55
81
  }
@@ -5,13 +5,11 @@ 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}
13
11
  */
14
- setPixelBuffer(colorBuffer: ArrayBufferView, mipLevel: number, x: number, y: number, width?: number, height?: number): void;
12
+ setPixelBuffer(colorBuffer: ArrayBufferView, mipLevel: number | undefined, x: number, y: number, width?: number, height?: number): void;
15
13
  /**
16
14
  * {@inheritDoc IPlatformTexture2D.setImageSource}
17
15
  */
@@ -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, rhi: WebGLGraphicDevice): void;
21
+ protected _validate(texture: Texture2DArray): void;
22
22
  }
@@ -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}
@@ -0,0 +1,18 @@
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
+ }
@@ -0,0 +1,22 @@
1
+ import type { IPlatformShaderProgram, IPlatformTransformFeedbackPrimitive, VertexBufferBinding, VertexElement } from "@galacean/engine-core";
2
+ /**
3
+ * @internal
4
+ * WebGL2 implementation of Transform Feedback primitive.
5
+ * Maintains two VAOs (one per read direction), rebuilding when the program or input bindings change.
6
+ */
7
+ export declare class GLTransformFeedbackPrimitive implements IPlatformTransformFeedbackPrimitive {
8
+ private readonly _gl;
9
+ private _vaoA;
10
+ private _vaoB;
11
+ private _lastProgramId;
12
+ private readonly _lastInputBindings;
13
+ constructor(gl: WebGL2RenderingContext);
14
+ bind(program: IPlatformShaderProgram, bindingA: VertexBufferBinding, bindingB: VertexBufferBinding, feedbackElements: VertexElement[], inputBindings: VertexBufferBinding[], inputElements: VertexElement[], 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 _bindElement;
22
+ }
@@ -1,35 +1,44 @@
1
1
  import { Canvas } from "@galacean/engine-core";
2
- import { Vector2 } from "@galacean/engine-math";
3
2
  type OffscreenCanvas = any;
4
3
  /**
5
4
  * The canvas used on the web, which can support HTMLCanvasElement and OffscreenCanvas.
6
5
  */
7
6
  export declare class WebCanvas extends Canvas {
7
+ private static _devicePixelContentBoxSupported?;
8
+ private static _supportsDevicePixelContentBox;
9
+ /** @internal */
8
10
  _webCanvas: HTMLCanvasElement | OffscreenCanvas;
9
- private _scale;
11
+ private _resizeObserver?;
12
+ private _autoResolutionScale;
13
+ private _resolutionDirty;
14
+ private _pendingDevicePixelWidth;
15
+ private _pendingDevicePixelHeight;
10
16
  /**
11
- * The scale of canvas, the value is visible width/height divide the render width/height.
12
- * @remarks Need to re-assign after modification to ensure that the modification takes effect.
17
+ * @inheritdoc
18
+ *
19
+ * @remarks
20
+ * The canvas must have a CSS-constrained display size; otherwise auto-resolution disables itself.
13
21
  */
14
- get scale(): Vector2;
15
- set scale(value: Vector2);
16
- /**
17
- * Resize the rendering size according to the clientWidth and clientHeight of the canvas.
18
- * @param pixelRatio - Pixel ratio
19
- */
20
- resizeByClientSize(pixelRatio?: number): void;
22
+ setAutoResolution(scale?: number): void;
21
23
  /**
22
24
  * Create a web canvas.
23
25
  * @param webCanvas - Web native canvas
24
26
  */
25
27
  constructor(webCanvas: HTMLCanvasElement | OffscreenCanvas);
26
28
  /**
27
- * Set scale.
28
- * @param x - Scale along the X axis
29
- * @param y - Scale along the Y axis
29
+ * @internal
30
+ */
31
+ _isOffscreenCanvas(): boolean;
32
+ /**
33
+ * @internal
34
+ */
35
+ _pumpPendingResolution(): void;
36
+ private _setResolutionByClientSizeFallback;
37
+ /**
38
+ * @internal
30
39
  */
31
- setScale(x: number, y: number): void;
32
- protected _onWidthChanged(value: number): void;
33
- protected _onHeightChange(value: number): void;
40
+ _destroy(): void;
41
+ protected _exitAutoResolution(): void;
42
+ protected _onResolutionChanged(width: number, height: number): void;
34
43
  }
35
44
  export {};
@@ -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,support includes WebGL1.0 and WebGL2.0.
5
+ * WebGL platform engine, supports WebGL 2.0.
6
6
  */
7
7
  export declare class WebGLEngine extends Engine {
8
8
  /**
@@ -12,12 +12,12 @@ export declare class WebGLEngine extends Engine {
12
12
  */
13
13
  static create(configuration: WebGLEngineConfiguration): Promise<WebGLEngine>;
14
14
  /**
15
- * Web canvas.
15
+ * The web canvas the engine renders to.
16
16
  */
17
17
  get canvas(): WebCanvas;
18
18
  }
19
19
  /**
20
- * WebGL engine configuration.
20
+ * Options for `WebGLEngine.create()`.
21
21
  */
22
22
  export interface WebGLEngineConfiguration extends EngineConfiguration {
23
23
  /** Canvas element or canvas id. */
@@ -1,29 +1,24 @@
1
- import { BufferBindFlag, BufferUsage, CameraClearFlags, Canvas, Engine, GLCapabilityType, IPlatformBuffer, IPlatformRenderTarget, IPlatformTexture2D, IPlatformTextureCube, Mesh, RenderTarget, SubMesh, Texture2D, Texture2DArray, TextureCube, TextureCubeFace } from "@galacean/engine-core";
2
- import { IHardwareRenderer, IPlatformPrimitive, IPlatformShaderProgram } from "@galacean/engine-design";
1
+ import { BufferBindFlag, BufferUsage, CameraClearFlags, Canvas, Engine, GLCapabilityType, IHardwareRenderer, IPlatformBuffer, IPlatformPrimitive, IPlatformRenderTarget, IPlatformShaderProgram, IPlatformTexture, IPlatformTexture2D, IPlatformTextureCube, IPlatformTransformFeedback, IPlatformTransformFeedbackPrimitive, Primitive, RenderTarget, SubPrimitive, Texture2D, Texture2DArray, TextureCube, TextureCubeFace, TextureFormat } from "@galacean/engine-core";
3
2
  import { Color, Vector4 } from "@galacean/engine-math";
4
3
  import { GLCapability } from "./GLCapability";
5
- import { GLPrimitive } from "./GLPrimitive";
6
4
  import { GLRenderStates } from "./GLRenderStates";
7
- import { GLTexture } from "./GLTexture";
8
5
  import { GLTexture2DArray } from "./GLTexture2DArray";
9
- import { WebGLExtension } from "./type";
10
- /**
11
- * WebGL mode.
12
- */
13
- export declare enum WebGLMode {
14
- /** Auto, use WebGL2.0 if support, or will fallback to WebGL1.0. */
15
- Auto = 0,
16
- /** WebGL2.0. */
17
- WebGL2 = 1,
18
- /** WebGL1.0, */
19
- WebGL1 = 2
20
- }
21
6
  /**
22
7
  * WebGL graphic device options.
23
8
  */
24
9
  export interface WebGLGraphicDeviceOptions {
25
- /** WebGL mode.*/
26
- webGLMode?: WebGLMode;
10
+ /**
11
+ * @internal
12
+ * iOS 15 webgl implement has bug, maybe should force call flush command buffer, for example iPhone13(iOS 15.4.1).
13
+ */
14
+ _forceFlush?: boolean;
15
+ /**
16
+ * @internal
17
+ * Max allow skin uniform vectors count, default is 256
18
+ *
19
+ * @remarks large count maybe cause performance issue.
20
+ */
21
+ _maxAllowSkinUniformVectorCount?: number;
27
22
  alpha?: boolean;
28
23
  depth?: boolean;
29
24
  desynchronized?: boolean;
@@ -35,16 +30,30 @@ export interface WebGLGraphicDeviceOptions {
35
30
  xrCompatible?: boolean;
36
31
  }
37
32
  /**
38
- * WebGL graphic device, including WebGL1.0 and WebGL2.0.
33
+ * WebGL graphic device, using WebGL2.0.
39
34
  */
40
35
  export declare class WebGLGraphicDevice implements IHardwareRenderer {
41
- private _options;
36
+ readonly supportsRendering = true;
37
+ maxUniformBlockSize: number;
38
+ /** @internal */
39
+ _readFrameBuffer: WebGLFramebuffer | null;
40
+ /** @internal */
41
+ _mainFrameBuffer: WebGLFramebuffer | null;
42
+ /** @internal */
43
+ _mainFrameWidth: number;
44
+ /** @internal */
45
+ _mainFrameHeight: number;
46
+ /** @internal */
47
+ _enableGlobalDepthBias: boolean;
48
+ /** @internal */
49
+ _currentBindShaderProgram: IPlatformShaderProgram | null;
50
+ /** @internal */
51
+ readonly _options: WebGLGraphicDeviceOptions;
42
52
  private _webGLOptions;
43
53
  private _gl;
44
54
  private _renderStates;
45
55
  private _extensions;
46
56
  private _capability;
47
- private _isWebGL2;
48
57
  private _renderer;
49
58
  private _webCanvas;
50
59
  private _activeTextureID;
@@ -55,39 +64,56 @@ export declare class WebGLGraphicDevice implements IHardwareRenderer {
55
64
  private _scissorEnable;
56
65
  private _onDeviceLost;
57
66
  private _onDeviceRestored;
58
- get isWebGL2(): boolean;
59
67
  get renderer(): string;
60
68
  /**
61
69
  * GL Context
62
- * @member {WebGLRenderingContext}
70
+ * @member {WebGL2RenderingContext}
63
71
  */
64
- get gl(): (WebGLRenderingContext & WebGLExtension) | WebGL2RenderingContext;
72
+ get gl(): WebGL2RenderingContext;
65
73
  get renderStates(): GLRenderStates;
66
74
  get capability(): GLCapability;
67
- get canIUseMoreJoints(): boolean;
68
75
  constructor(initializeOptions?: WebGLGraphicDeviceOptions);
69
76
  init(canvas: Canvas, onDeviceLost: () => void, onDeviceRestored: () => void): void;
70
- createPlatformPrimitive(primitive: Mesh): IPlatformPrimitive;
77
+ createPlatformPrimitive(primitive: Primitive): IPlatformPrimitive;
71
78
  createPlatformTexture2D(texture2D: Texture2D): IPlatformTexture2D;
72
79
  createPlatformTexture2DArray(texture2D: Texture2DArray): GLTexture2DArray;
73
80
  createPlatformTextureCube(textureCube: TextureCube): IPlatformTextureCube;
74
81
  createPlatformRenderTarget(target: RenderTarget): IPlatformRenderTarget;
75
82
  createPlatformBuffer(type: BufferBindFlag, byteLength: number, bufferUsage?: BufferUsage, data?: ArrayBuffer | ArrayBufferView): IPlatformBuffer;
83
+ createPlatformTransformFeedback(): IPlatformTransformFeedback;
84
+ createPlatformTransformFeedbackPrimitive(): IPlatformTransformFeedbackPrimitive;
85
+ bindUniformBufferBase(bindingPoint: number, buffer: IPlatformBuffer): void;
86
+ bindUniformBlock(program: WebGLProgram, blockName: string, bindingPoint: number): number;
87
+ /**
88
+ * Enable GL_RASTERIZER_DISCARD (WebGL2 only).
89
+ */
90
+ enableRasterizerDiscard(): void;
91
+ /**
92
+ * Disable GL_RASTERIZER_DISCARD (WebGL2 only).
93
+ */
94
+ disableRasterizerDiscard(): void;
95
+ /**
96
+ * Invalidate the cached shader program state.
97
+ * Call this after using a custom program (e.g., Transform Feedback) outside the engine's pipeline.
98
+ */
99
+ invalidateShaderProgramState(): void;
76
100
  requireExtension(ext: any): any;
77
101
  canIUse(capabilityType: GLCapabilityType): boolean;
78
102
  canIUseCompressedTextureInternalFormat(type: number): boolean;
103
+ supportsTextureFormat(format: TextureFormat): boolean;
104
+ supportsRenderTargetColorFormat(format: TextureFormat): boolean;
79
105
  viewport(x: number, y: number, width: number, height: number): void;
80
106
  scissor(x: number, y: number, width: number, height: number): void;
81
107
  colorMask(r: boolean, g: boolean, b: boolean, a: boolean): void;
82
108
  clearRenderTarget(engine: Engine, clearFlags: CameraClearFlags, clearColor?: Color): void;
83
- drawPrimitive(primitive: GLPrimitive, subPrimitive: SubMesh, shaderProgram: IPlatformShaderProgram): void;
109
+ drawPrimitive(primitive: Primitive, subPrimitive: SubPrimitive | null, shaderProgram: IPlatformShaderProgram): void;
84
110
  getMainFrameBufferWidth(): number;
85
111
  getMainFrameBufferHeight(): number;
86
- activeRenderTarget(renderTarget: RenderTarget, viewport: Vector4, isFlipProjection: boolean, mipLevel?: number, faceIndex?: TextureCubeFace): void;
87
- blitInternalRTByBlitFrameBuffer(srcRT: RenderTarget, destRT: RenderTarget, clearFlags: CameraClearFlags, viewport: Vector4): void;
88
- copyRenderTargetToSubTexture(srcRT: RenderTarget, grabTexture: Texture2D, viewport: Vector4): void;
112
+ activeRenderTarget(renderTarget: RenderTarget | null, viewport: Vector4, isFlipProjection: boolean, mipLevel?: number, faceIndex?: TextureCubeFace): void;
113
+ blitInternalRTByBlitFrameBuffer(srcRT: RenderTarget | null, destRT: RenderTarget, clearFlags: CameraClearFlags, viewport: Vector4): void;
114
+ copyRenderTargetToSubTexture(srcRT: RenderTarget | null, grabTexture: Texture2D, viewport: Vector4): void;
89
115
  activeTexture(textureID: number): void;
90
- bindTexture(texture: GLTexture): void;
116
+ bindTexture(platformTexture: IPlatformTexture): void;
91
117
  setGlobalDepthBias(bias: number, slopeBias: number): void;
92
118
  flush(): void;
93
119
  forceLoseDevice(): void;
@@ -98,7 +124,7 @@ export declare class WebGLGraphicDevice implements IHardwareRenderer {
98
124
  */
99
125
  isContextLost(): boolean;
100
126
  resetState(): void;
101
- protected _initGLState(gl: (WebGLRenderingContext & WebGLExtension) | WebGL2RenderingContext): void;
127
+ protected _initGLState(gl: WebGL2RenderingContext): void;
102
128
  destroy(): void;
103
129
  private _onContextCreationError;
104
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 { WebGLMode, WebGLGraphicDevice } from "./WebGLGraphicDevice";
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;