-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue #18056: [v3.8.6] Add @mangle jsDoc tag for gfx-webgl/gfx-webgl2 internal modules. #18093
Conversation
👍 Package size ⤵ -30042 bytes, old: 5314630, new: 5284588Interface Check Report! WARNING this pull request has changed these public interfaces:
@@ -7976,9 +7976,11 @@
*/
export class Sampler extends GFXObject {
get info(): Readonly<SamplerInfo>;
get hash(): number;
+ /** @mangle */
protected _info: SamplerInfo;
+ /** @mangle */
protected _hash: number;
constructor(info: Readonly<SamplerInfo>, hash: number);
static computeHash(info: Readonly<SamplerInfo>): number;
static unpackFromHash(hash: number): SamplerInfo;
@@ -8006,12 +8008,17 @@
* @zh GFX 描述符集组。
*/
export abstract class DescriptorSet extends GFXObject {
get layout(): DescriptorSetLayout;
+ /** @mangle */
protected _layout: DescriptorSetLayout | null;
+ /** @mangle */
protected _buffers: Buffer[];
+ /** @mangle */
protected _textures: Texture[];
+ /** @mangle */
protected _samplers: Sampler[];
+ /** @mangle */
protected _isDirty: boolean;
constructor();
abstract initialize(info: Readonly<DescriptorSetInfo>): void;
abstract destroy(): void;
@@ -8086,14 +8093,21 @@
* @zh 缓冲条目数量。
*/
get count(): number;
get flags(): BufferFlags;
+ /** @mangle */
protected _usage: BufferUsage;
+ /** @mangle */
protected _memUsage: MemoryUsage;
+ /** @mangle */
protected _size: number;
+ /** @mangle */
protected _stride: number;
+ /** @mangle */
protected _count: number;
+ /** @mangle */
protected _flags: BufferFlags;
+ /** @mangle */
protected _isBufferView: boolean;
constructor();
abstract initialize(info: Readonly<BufferInfo> | Readonly<BufferViewInfo>): void;
abstract destroy(): void;
@@ -8140,12 +8154,17 @@
* @en Number of triangles currently recorded.
* @zh 绘制三角形数量。
*/
get numTris(): number;
+ /** @mangle */
protected _queue: Queue | null;
+ /** @mangle */
protected _type: CommandBufferType;
+ /** @mangle */
protected _numDrawCalls: number;
+ /** @mangle */
protected _numInstances: number;
+ /** @mangle */
protected _numTris: number;
constructor();
abstract initialize(info: Readonly<CommandBufferInfo>): void;
abstract destroy(): void;
@@ -9425,10 +9444,13 @@
export class GFXObject extends __private._cocos_core_data_gc_object__GCObject {
get objectType(): ObjectType;
get objectID(): number;
get typedID(): number;
+ /** @mangle */
protected _objectType: ObjectType;
+ /** @mangle */
protected _objectID: number;
+ /** @mangle */
protected _typedID: number;
constructor(objectType: ObjectType);
}
export interface ISwapchainTextureInfo {
@@ -9534,26 +9556,45 @@
* @en Current device binding mappings.
* @zh 当前设备的绑定槽位映射关系。
*/
get bindingMappingInfo(): BindingMappingInfo;
+ /** @mangle */
protected _gfxAPI: API;
+ /** @mangle */
protected _renderer: string;
+ /** @mangle */
protected _vendor: string;
+ /** @mangle */
protected _features: boolean[];
+ /** @mangle */
protected _formatFeatures: FormatFeatureBit[];
+ /** @mangle */
protected _queue: Queue | null;
+ /** @mangle */
protected _cmdBuff: CommandBuffer | null;
+ /** @mangle */
protected _numDrawCalls: number;
+ /** @mangle */
protected _numInstances: number;
+ /** @mangle */
protected _numTris: number;
+ /** @mangle */
protected _memoryStatus: MemoryStatus;
+ /** @mangle */
protected _caps: DeviceCaps;
+ /** @mangle */
protected _bindingMappingInfo: BindingMappingInfo;
+ /** @mangle */
protected _samplers: Map<number, Sampler>;
+ /** @mangle */
protected _generalBarrierss: Map<number, GeneralBarrier>;
+ /** @mangle */
protected _textureBarriers: Map<number, TextureBarrier>;
+ /** @mangle */
protected _bufferBarriers: Map<number, __private._cocos_gfx_base_states_buffer_barrier__BufferBarrier>;
+ /** @mangle */
protected _swapchainFormat: Format;
+ /** @mangle */
static canvas: HTMLCanvasElement;
abstract initialize(info: Readonly<DeviceInfo>): boolean | Promise<boolean>;
abstract destroy(): void;
/**
@@ -9728,8 +9769,9 @@
* @param flags The GFX texture create flags.
*/
getMaxSampleCount(format: Format, usage: TextureUsage, flags: TextureFlags): SampleCount;
}
+ /** @mangle */
export class DefaultResource {
constructor(device: Device);
getTexture(type: TextureType): Texture | null;
}
@@ -9754,10 +9796,13 @@
*/
get surfaceTransform(): SurfaceTransform;
get width(): number;
get height(): number;
+ /** @mangle */
protected _transform: SurfaceTransform;
+ /** @mangle */
protected _colorTexture: Texture;
+ /** @mangle */
protected _depthStencilTexture: Texture;
constructor();
abstract initialize(info: Readonly<SwapchainInfo>): void;
abstract resize(width: number, height: number, surfaceTransform: SurfaceTransform): void;
@@ -9785,12 +9830,17 @@
get depthStencilTexture(): Texture | null;
get width(): number;
get height(): number;
get needRebuild(): boolean;
+ /** @mangle */
protected _renderPass: RenderPass | null;
+ /** @mangle */
protected _colorTextures: (Texture | null)[];
+ /** @mangle */
protected _depthStencilTexture: Texture | null;
+ /** @mangle */
protected _width: number;
+ /** @mangle */
protected _height: number;
constructor();
abstract initialize(info: Readonly<FramebufferInfo>): void;
abstract destroy(): void;
@@ -9876,13 +9926,19 @@
* @en get the draw range
* @zh 获取渲染范围
*/
get drawInfo(): DrawInfo;
+ /** @mangle */
protected _attributes: Attribute[];
+ /** @mangle */
protected _attributesHash: number;
+ /** @mangle */
protected _vertexBuffers: Buffer[];
+ /** @mangle */
protected _indexBuffer: Buffer | null;
+ /** @mangle */
protected _indirectBuffer: Buffer | null;
+ /** @mangle */
protected _drawInfo: DrawInfo;
constructor();
/**
* @en Get the specified vertex buffer.
@@ -9901,10 +9957,13 @@
export abstract class DescriptorSetLayout extends GFXObject {
get bindings(): DescriptorSetLayoutBinding[];
get bindingIndices(): number[];
get descriptorIndices(): number[];
+ /** @mangle */
protected _bindings: DescriptorSetLayoutBinding[];
+ /** @mangle */
protected _bindingIndices: number[];
+ /** @mangle */
protected _descriptorIndices: number[];
constructor();
abstract initialize(info: Readonly<DescriptorSetLayoutInfo>): void;
abstract destroy(): void;
@@ -9914,8 +9973,9 @@
* @zh GFX 管线布局。
*/
export abstract class PipelineLayout extends GFXObject {
get setLayouts(): DescriptorSetLayout[];
+ /** @mangle */
protected _setLayouts: DescriptorSetLayout[];
constructor();
abstract initialize(info: Readonly<PipelineLayoutInfo>): void;
abstract destroy(): void;
@@ -10076,16 +10136,25 @@
* @en Get current render pass.
* @zh GFX 渲染过程。
*/
get renderPass(): RenderPass;
+ /** @mangle */
protected _shader: Shader | null;
+ /** @mangle */
protected _pipelineLayout: PipelineLayout | null;
+ /** @mangle */
protected _primitive: PrimitiveMode;
+ /** @mangle */
protected _is: InputState | null;
+ /** @mangle */
protected _rs: RasterizerState;
+ /** @mangle */
protected _dss: DepthStencilState;
+ /** @mangle */
protected _bs: BlendState;
+ /** @mangle */
protected _dynamicStates: DynamicStateFlags;
+ /** @mangle */
protected _renderPass: RenderPass | null;
constructor();
abstract initialize(info: Readonly<PipelineStateInfo>): void;
abstract destroy(): void;
@@ -10099,8 +10168,9 @@
* @en Get current type.
* @zh 队列类型。
*/
get type(): number;
+ /** @mangle */
protected _type: QueueType;
constructor();
abstract initialize(info: Readonly<QueueInfo>): void;
abstract destroy(): void;
@@ -10116,11 +10186,15 @@
* @en GFX render pass.
* @zh GFX 渲染过程。
*/
export abstract class RenderPass extends GFXObject {
+ /** @mangle */
protected _colorInfos: ColorAttachment[];
+ /** @mangle */
protected _depthStencilInfo: DepthStencilAttachment | null;
+ /** @mangle */
protected _subpasses: SubpassInfo[];
+ /** @mangle */
protected _hash: number;
get colorAttachments(): Readonly<ColorAttachment[]>;
get depthStencilAttachment(): Readonly<DepthStencilAttachment> | null;
get subPasses(): Readonly<SubpassInfo[]>;
@@ -10139,12 +10213,17 @@
get attributes(): Attribute[];
get blocks(): UniformBlock[];
get samplers(): UniformSampler[];
get stages(): ShaderStage[];
+ /** @mangle */
protected _name: string;
+ /** @mangle */
protected _stages: ShaderStage[];
+ /** @mangle */
protected _attributes: Attribute[];
+ /** @mangle */
protected _blocks: UniformBlock[];
+ /** @mangle */
protected _samplers: UniformSampler[];
constructor();
abstract initialize(info: Readonly<ShaderInfo>): void;
abstract destroy(): void;
@@ -10223,12 +10302,17 @@
* @en Get texture type.
* @zh 是否为纹理视图。
*/
get isTextureView(): boolean;
+ /** @mangle */
protected _info: TextureInfo;
+ /** @mangle */
protected _viewInfo: TextureViewInfo;
+ /** @mangle */
protected _isPowerOf2: boolean;
+ /** @mangle */
protected _isTextureView: boolean;
+ /** @mangle */
protected _size: number;
constructor();
abstract initialize(info: Readonly<TextureInfo> | Readonly<TextureViewInfo>): void;
abstract destroy(): void;
@@ -10248,9 +10332,11 @@
*/
export class GeneralBarrier extends GFXObject {
get info(): Readonly<GeneralBarrierInfo>;
get hash(): number;
+ /** @mangle */
protected _info: GeneralBarrierInfo;
+ /** @mangle */
protected _hash: number;
constructor(info: Readonly<GeneralBarrierInfo>, hash: number);
static computeHash(info: Readonly<GeneralBarrierInfo>): number;
}
@@ -10260,9 +10346,11 @@
*/
export class TextureBarrier extends GFXObject {
get info(): Readonly<TextureBarrierInfo>;
get hash(): number;
+ /** @mangle */
protected _info: TextureBarrierInfo;
+ /** @mangle */
protected _hash: number;
constructor(info: Readonly<TextureBarrierInfo>, hash: number);
static computeHash(info: Readonly<TextureBarrierInfo>): number;
}
@@ -44759,8 +44847,9 @@
copyBuffersToTexture(buffers: Readonly<ArrayBufferView[]>, texture: gfx.Texture, regions: Readonly<gfx.BufferTextureCopy[]>): void;
copyTextureToBuffers(texture: Readonly<gfx.Texture>, buffers: ArrayBufferView[], regions: Readonly<gfx.BufferTextureCopy[]>): void;
copyTexImagesToTexture(texImages: Readonly<TexImageSource[]>, texture: gfx.Texture, regions: Readonly<gfx.BufferTextureCopy[]>): void;
}
+ /** @mangle */
export class WebGLDevice extends gfx.Device {
constructor();
get gl(): WebGLRenderingContext;
get extensions(): __private._cocos_gfx_webgl_webgl_define__IWebGLExtensions;
@@ -44769,14 +44858,16 @@
get nullTexCube(): __private._cocos_gfx_webgl_webgl_texture__WebGLTexture;
get textureExclusive(): boolean[];
get bindingMappings(): __private._cocos_gfx_webgl_webgl_gpu_objects__IWebGLBindingMapping;
get blitManager(): __private._cocos_gfx_webgl_webgl_gpu_objects__IWebGLBlitManager;
+ /** @mangle */
protected _textureExclusive: boolean[];
initialize(info: Readonly<gfx.DeviceInfo>): boolean;
destroy(): void;
flushCommands(cmdBuffs: gfx.CommandBuffer[]): void;
acquire(swapchains: gfx.Swapchain[]): void;
present(): void;
+ /** @mangle */
protected initFormatFeatures(exts: __private._cocos_gfx_webgl_webgl_define__IWebGLExtensions): void;
createCommandBuffer(info: Readonly<gfx.CommandBufferInfo>): gfx.CommandBuffer;
createSwapchain(info: Readonly<gfx.SwapchainInfo>): gfx.Swapchain;
createBuffer(info: Readonly<gfx.BufferInfo> | Readonly<gfx.BufferViewInfo>): gfx.Buffer;
@@ -44798,8 +44889,9 @@
copyBuffersToTexture(buffers: Readonly<ArrayBufferView[]>, texture: gfx.Texture, regions: Readonly<gfx.BufferTextureCopy[]>): void;
copyTextureToBuffers(texture: Readonly<gfx.Texture>, buffers: ArrayBufferView[], regions: Readonly<gfx.BufferTextureCopy[]>): void;
copyTexImagesToTexture(texImages: Readonly<TexImageSource[]>, texture: gfx.Texture, regions: Readonly<gfx.BufferTextureCopy[]>): void;
}
+ /** @mangle */
export class WebGL2Device extends gfx.Device {
constructor();
get gl(): WebGL2RenderingContext;
get extensions(): __private._cocos_gfx_webgl2_webgl2_define__IWebGL2Extensions;
@@ -62802,9 +62894,11 @@
*/
export class _cocos_gfx_base_states_buffer_barrier__BufferBarrier extends gfx.GFXObject {
get info(): Readonly<gfx.BufferBarrierInfo>;
get hash(): number;
+ /** @mangle */
protected _info: gfx.BufferBarrierInfo;
+ /** @mangle */
protected _hash: number;
constructor(info: Readonly<gfx.BufferBarrierInfo>, hash: number);
static computeHash(info: Readonly<gfx.BufferBarrierInfo>): number;
}
@@ -66360,8 +66454,9 @@
readonly COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: GLenum;
readonly COMPRESSED_RGB_PVRTC_2BPPV1_IMG: GLenum;
readonly COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: GLenum;
}
+ /** @mangle */
export interface _cocos_gfx_webgl_webgl_define__IWebGLExtensions {
EXT_texture_filter_anisotropic: EXT_texture_filter_anisotropic | null;
EXT_blend_minmax: EXT_blend_minmax | null;
EXT_frag_depth: EXT_frag_depth | null;
@@ -66393,8 +66488,9 @@
noCompressedTexSubImage2D: boolean;
isLocationActive: (glLoc: unknown) => glLoc is WebGLUniformLocation;
useVAO: boolean;
}
+ /** @mangle */
export interface _cocos_gfx_webgl_webgl_state_cache__IWebGLTexUnit {
glTexture: WebGLTexture | null;
}
/** @mangle */
@@ -66416,8 +66512,9 @@
glCurrentAttribLocs: boolean[];
texUnitCacheMap: Record<string, number>;
initialize(texUnit: number, vertexAttributes: number): void;
}
+ /** @mangle */
export interface _cocos_gfx_webgl_webgl_gpu_objects__IWebGLGPUTexture {
type: gfx.TextureType;
format: gfx.Format;
usage: gfx.TextureUsage;
@@ -66442,8 +66539,9 @@
glMinFilter: GLenum;
glMagFilter: GLenum;
isSwapchainTexture: boolean;
}
+ /** @mangle */
export class _cocos_gfx_webgl_webgl_texture__WebGLTexture extends gfx.Texture {
get gpuTexture(): _cocos_gfx_webgl_webgl_gpu_objects__IWebGLGPUTexture;
get lodLevel(): number;
constructor();
@@ -66451,13 +66549,15 @@
destroy(): void;
getTextureHandle(): number;
resize(width: number, height: number): void;
}
+ /** @mangle */
export interface _cocos_gfx_webgl_webgl_gpu_objects__IWebGLBindingMapping {
blockOffsets: number[];
samplerTextureOffsets: number[];
flexibleSet: number;
}
+ /** @mangle */
export class _cocos_gfx_webgl_webgl_gpu_objects__IWebGLBlitManager {
constructor();
destroy(): void;
draw(gpuTextureSrc: _cocos_gfx_webgl_webgl_gpu_objects__IWebGLGPUTexture, gpuTextureDst: _cocos_gfx_webgl_webgl_gpu_objects__IWebGLGPUTexture, regions: gfx.TextureBlit[], filter: gfx.Filter): void;
@@ -66465,8 +66565,9 @@
export interface __node_modules_typescript_lib_libdom__EXT_color_buffer_float {
}
export interface __node_modules_typescript_lib_libdom__EXT_color_buffer_float {
}
+ /** @mangle */
export interface _cocos_gfx_webgl2_webgl2_define__IWebGL2Extensions {
EXT_texture_filter_anisotropic: EXT_texture_filter_anisotropic | null;
EXT_color_buffer_half_float: __node_modules_typescript_lib_libdom__EXT_color_buffer_half_float | null;
EXT_color_buffer_float: __node_modules_typescript_lib_libdom__EXT_color_buffer_float | null;
@@ -66483,11 +66584,13 @@
OES_texture_half_float_linear: OES_texture_half_float_linear | null;
OES_texture_float_linear: OES_texture_float_linear | null;
useVAO: boolean;
}
+ /** @mangle */
export interface _cocos_gfx_webgl2_webgl2_state_cache__IWebGL2TexUnit {
glTexture: WebGLTexture | null;
}
+ /** @mangle */
export class _cocos_gfx_webgl2_webgl2_state_cache__WebGL2StateCache {
glArrayBuffer: WebGLBuffer | null;
glElementArrayBuffer: WebGLBuffer | null;
glUniformBuffer: WebGLBuffer | null;
@@ -66511,8 +66614,9 @@
texUnitCacheMap: Record<string, number>;
constructor();
initialize(texUnit: number, bufferBindings: number, vertexAttributes: number): void;
}
+ /** @mangle */
export interface _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2GPUTexture {
type: gfx.TextureType;
format: gfx.Format;
usage: gfx.TextureUsage;
@@ -66537,15 +66641,17 @@
glMinFilter: GLenum;
glMagFilter: GLenum;
isSwapchainTexture: boolean;
}
+ /** @mangle */
export interface _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2GPUTextureView {
gpuTexture: _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2GPUTexture;
type: gfx.TextureType;
format: gfx.Format;
baseLevel: number;
levelCount: number;
}
+ /** @mangle */
export class _cocos_gfx_webgl2_webgl2_texture__WebGL2Texture extends gfx.Texture {
constructor();
get gpuTexture(): _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2GPUTexture;
get gpuTextureView(): _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2GPUTextureView;
@@ -66553,13 +66659,15 @@
destroy(): void;
getTextureHandle(): number;
resize(width: number, height: number): void;
}
+ /** @mangle */
export interface _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2BindingMapping {
blockOffsets: number[];
samplerTextureOffsets: number[];
flexibleSet: number;
}
+ /** @mangle */
export class _cocos_gfx_webgl2_webgl2_gpu_objects__IWebGL2BlitManager {
get srcFramebuffer(): WebGLFramebuffer | null;
get dstFramebuffer(): WebGLFramebuffer | null;
constructor();
|
public bindInputAssembler (inputAssembler: InputAssembler): void { | ||
const gpuInputAssembler = (inputAssembler as WebGLInputAssembler).gpuInputAssembler; | ||
public override bindInputAssembler (inputAssembler: InputAssembler): void { | ||
const gpuInputAssembler = (inputAssembler as WebGLInputAssembler).getGpuInputAssembler(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getter/setter could not be mangled since babel will convert it to _createClass({})
with normal string which could not be mangled by terser.
Some reference: terser/terser#322
And normal funciton could be mangled correctly.
for (let i = 0; i < texUnit; ++i) this.glTexUnits.push({ glTexture: null }); | ||
for (let i = 0; i < texUnit; ++i) { | ||
const glTexUnit: IWebGL2TexUnit = { glTexture: null }; | ||
this.glTexUnits.push(glTexUnit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do it like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's difficult to infer the interface type by
this.glTexUnits.push({ glTexture: null });
{glTexture: null}
is a plain object with typeinfo.
By declaring its type const glTexUnit: IWebGL2TexUnit = { glTexture: null };
explicitly, we could easily get its type and mangle glTexture
property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. But it also define a new variable glTexUnit
. How much package size will it save?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glTexUnit is just an object reference, and it costs really little, no new objects will be created.
Re: #18056
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: