Skip to content

Commit

Permalink
issue #18056: [v3.8.6] Add @mangle jsDoc tag for gfx-webgl/gfx-webgl2…
Browse files Browse the repository at this point in the history
… internal modules. (#18093)
  • Loading branch information
dumganhar authored Dec 30, 2024
1 parent 3dfbc53 commit 26623a1
Show file tree
Hide file tree
Showing 58 changed files with 255 additions and 63 deletions.
7 changes: 7 additions & 0 deletions cocos/gfx/base/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,19 @@ export abstract class Buffer extends GFXObject {
return this._flags;
}

/** @mangle */
protected _usage: BufferUsage = BufferUsageBit.NONE;
/** @mangle */
protected _memUsage: MemoryUsage = MemoryUsageBit.NONE;
/** @mangle */
protected _size = 0;
/** @mangle */
protected _stride = 1;
/** @mangle */
protected _count = 0;
/** @mangle */
protected _flags: BufferFlags = BufferFlagBit.NONE;
/** @mangle */
protected _isBufferView = false;

constructor () {
Expand Down
5 changes: 5 additions & 0 deletions cocos/gfx/base/command-buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,15 @@ export abstract class CommandBuffer extends GFXObject {
return this._numTris;
}

/** @mangle */
protected _queue: Queue | null = null;
/** @mangle */
protected _type: CommandBufferType = CommandBufferType.PRIMARY;
/** @mangle */
protected _numDrawCalls = 0;
/** @mangle */
protected _numInstances = 0;
/** @mangle */
protected _numTris = 0;

constructor () {
Expand Down
3 changes: 3 additions & 0 deletions cocos/gfx/base/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2017,8 +2017,11 @@ export class GFXObject extends GCObject {
return this._typedID;
}

/** @mangle */
protected _objectType = ObjectType.UNKNOWN;
/** @mangle */
protected _objectID = 0;
/** @mangle */
protected _typedID = 0;

private static _idTable = Array(ObjectType.COUNT).fill(1 << 16);
Expand Down
3 changes: 3 additions & 0 deletions cocos/gfx/base/descriptor-set-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ export abstract class DescriptorSetLayout extends GFXObject {
return this._descriptorIndices;
}

/** @mangle */
protected _bindings: DescriptorSetLayoutBinding[] = [];
/** @mangle */
protected _bindingIndices: number[] = [];
/** @mangle */
protected _descriptorIndices: number[] = [];

constructor () {
Expand Down
6 changes: 5 additions & 1 deletion cocos/gfx/base/descriptor-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ export abstract class DescriptorSet extends GFXObject {
return this._layout!;
}

/** @mangle */
protected _layout: DescriptorSetLayout | null = null;
/** @mangle */
protected _buffers: Buffer[] = [];
/** @mangle */
protected _textures: Texture[] = [];
/** @mangle */
protected _samplers: Sampler[] = [];

/** @mangle */
protected _isDirty = false;

constructor () {
Expand Down
20 changes: 20 additions & 0 deletions cocos/gfx/base/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,25 +149,44 @@ export abstract class Device {
return this._bindingMappingInfo;
}

/** @mangle */
protected _gfxAPI = API.UNKNOWN;
/** @mangle */
protected _renderer = '';
/** @mangle */
protected _vendor = '';
/** @mangle */
protected _features = new Array<boolean>(Feature.COUNT);
/** @mangle */
protected _formatFeatures = new Array<FormatFeature>(Format.COUNT);
/** @mangle */
protected _queue: Queue | null = null;
/** @mangle */
protected _cmdBuff: CommandBuffer | null = null;
/** @mangle */
protected _numDrawCalls = 0;
/** @mangle */
protected _numInstances = 0;
/** @mangle */
protected _numTris = 0;
/** @mangle */
protected _memoryStatus = new MemoryStatus();
/** @mangle */
protected _caps = new DeviceCaps();
/** @mangle */
protected _bindingMappingInfo: BindingMappingInfo = new BindingMappingInfo();
/** @mangle */
protected _samplers = new Map<number, Sampler>();
/** @mangle */
protected _generalBarrierss = new Map<number, GeneralBarrier>();
/** @mangle */
protected _textureBarriers = new Map<number, TextureBarrier>();
/** @mangle */
protected _bufferBarriers = new Map<number, BufferBarrier>();
/** @mangle */
protected _swapchainFormat = Format.RGBA8;

/** @mangle */
public static canvas: HTMLCanvasElement; // Hack for WebGL device initialization process

public abstract initialize (info: Readonly<DeviceInfo>): boolean | Promise<boolean>;
Expand Down Expand Up @@ -383,6 +402,7 @@ export abstract class Device {
}
}

/** @mangle */
export class DefaultResource {
private _texture2D: Texture | null = null;
private _texture3D: Texture | null = null;
Expand Down
5 changes: 5 additions & 0 deletions cocos/gfx/base/framebuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,15 @@ export abstract class Framebuffer extends GFXObject {
return false;
}

/** @mangle */
protected _renderPass: RenderPass | null = null;
/** @mangle */
protected _colorTextures: (Texture | null)[] = [];
/** @mangle */
protected _depthStencilTexture: Texture | null = null;
/** @mangle */
protected _width: number = 0;
/** @mangle */
protected _height: number = 0;

constructor () {
Expand Down
8 changes: 6 additions & 2 deletions cocos/gfx/base/input-assembler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,17 @@ export abstract class InputAssembler extends GFXObject {
return this._drawInfo;
}

/** @mangle */
protected _attributes: Attribute[] = [];
/** @mangle */
protected _attributesHash = 0;

/** @mangle */
protected _vertexBuffers: Buffer[] = [];
/** @mangle */
protected _indexBuffer: Buffer | null = null;
/** @mangle */
protected _indirectBuffer: Buffer | null = null;

/** @mangle */
protected _drawInfo = new DrawInfo();

constructor () {
Expand Down
1 change: 1 addition & 0 deletions cocos/gfx/base/pipeline-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export abstract class PipelineLayout extends GFXObject {
return this._setLayouts;
}

/** @mangle */
protected _setLayouts: DescriptorSetLayout[] = [];

constructor () {
Expand Down
9 changes: 9 additions & 0 deletions cocos/gfx/base/pipeline-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,23 @@ export abstract class PipelineState extends GFXObject {
return this._renderPass as RenderPass;
}

/** @mangle */
protected _shader: Shader | null = null;
/** @mangle */
protected _pipelineLayout: PipelineLayout | null = null;
/** @mangle */
protected _primitive: PrimitiveMode = PrimitiveMode.TRIANGLE_LIST;
/** @mangle */
protected _is: InputState | null = null;
/** @mangle */
protected _rs: RasterizerState = new RasterizerState();
/** @mangle */
protected _dss: DepthStencilState = new DepthStencilState();
/** @mangle */
protected _bs: BlendState = new BlendState();
/** @mangle */
protected _dynamicStates: DynamicStateFlags = DynamicStateFlagBit.NONE;
/** @mangle */
protected _renderPass: RenderPass | null = null;

constructor () {
Expand Down
1 change: 1 addition & 0 deletions cocos/gfx/base/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export abstract class Queue extends GFXObject {
return this._type;
}

/** @mangle */
protected _type: QueueType = QueueType.GRAPHICS;

constructor () {
Expand Down
4 changes: 4 additions & 0 deletions cocos/gfx/base/render-pass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ import {
* @zh GFX 渲染过程。
*/
export abstract class RenderPass extends GFXObject {
/** @mangle */
protected _colorInfos: ColorAttachment[] = [];
/** @mangle */
protected _depthStencilInfo: DepthStencilAttachment | null = null;
/** @mangle */
protected _subpasses: SubpassInfo[] = [];
/** @mangle */
protected _hash = 0;

get colorAttachments (): Readonly<ColorAttachment[]> { return this._colorInfos; }
Expand Down
5 changes: 5 additions & 0 deletions cocos/gfx/base/shader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@ export abstract class Shader extends GFXObject {
return this._stages;
}

/** @mangle */
protected _name = '';
/** @mangle */
protected _stages: ShaderStage[] = [];
/** @mangle */
protected _attributes: Attribute[] = [];
/** @mangle */
protected _blocks: UniformBlock[] = [];
/** @mangle */
protected _samplers: UniformSampler[] = [];

constructor () {
Expand Down
2 changes: 2 additions & 0 deletions cocos/gfx/base/states/buffer-barrier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export class BufferBarrier extends GFXObject {
get info (): Readonly<BufferBarrierInfo> { return this._info; }
get hash (): number { return this._hash; }

/** @mangle */
protected _info: BufferBarrierInfo = new BufferBarrierInfo();
/** @mangle */
protected _hash = 0;

constructor (info: Readonly<BufferBarrierInfo>, hash: number) {
Expand Down
2 changes: 2 additions & 0 deletions cocos/gfx/base/states/general-barrier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export class GeneralBarrier extends GFXObject {
get info (): Readonly<GeneralBarrierInfo> { return this._info; }
get hash (): number { return this._hash; }

/** @mangle */
protected _info: GeneralBarrierInfo = new GeneralBarrierInfo();
/** @mangle */
protected _hash = 0;

constructor (info: Readonly<GeneralBarrierInfo>, hash: number) {
Expand Down
2 changes: 2 additions & 0 deletions cocos/gfx/base/states/sampler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export class Sampler extends GFXObject {
get info (): Readonly<SamplerInfo> { return this._info; }
get hash (): number { return this._hash; }

/** @mangle */
protected _info: SamplerInfo = new SamplerInfo();
/** @mangle */
protected _hash = 0;

constructor (info: Readonly<SamplerInfo>, hash: number) {
Expand Down
2 changes: 2 additions & 0 deletions cocos/gfx/base/states/texture-barrier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export class TextureBarrier extends GFXObject {
get info (): Readonly<TextureBarrierInfo> { return this._info; }
get hash (): number { return this._hash; }

/** @mangle */
protected _info: TextureBarrierInfo = new TextureBarrierInfo();
/** @mangle */
protected _hash = 0;

constructor (info: Readonly<TextureBarrierInfo>, hash: number) {
Expand Down
3 changes: 3 additions & 0 deletions cocos/gfx/base/swapchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ export abstract class Swapchain extends GFXObject {
return this._colorTexture.height;
}

/** @mangle */
protected _transform = SurfaceTransform.IDENTITY;
/** @mangle */
protected _colorTexture: Texture = null!;
/** @mangle */
protected _depthStencilTexture: Texture = null!;

constructor () {
Expand Down
6 changes: 5 additions & 1 deletion cocos/gfx/base/texture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,15 @@ export abstract class Texture extends GFXObject {
return this._isTextureView;
}

/** @mangle */
protected _info: TextureInfo = new TextureInfo();
/** @mangle */
protected _viewInfo: TextureViewInfo = new TextureViewInfo();

/** @mangle */
protected _isPowerOf2 = false;
/** @mangle */
protected _isTextureView = false;
/** @mangle */
protected _size = 0;

constructor () {
Expand Down
1 change: 1 addition & 0 deletions cocos/gfx/webgl/states/webgl-sampler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const WebGLWraps: GLenum[] = [
0x812F, // WebGLRenderingContext.CLAMP_TO_EDGE,
];

/** @mangle */
export class WebGLSampler extends Sampler {
public get gpuSampler (): IWebGLGPUSampler {
return this._gpuSampler!;
Expand Down
1 change: 1 addition & 0 deletions cocos/gfx/webgl/webgl-buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { IWebGLGPUBuffer, IWebGLGPUBufferView, WebGLIndirectDrawInfos } from './
import { WebGLDeviceManager } from './webgl-define';
import { warnID } from '../../core/platform/debug';

/** @mangle */
export class WebGLBuffer extends Buffer {
get gpuBuffer (): IWebGLGPUBuffer {
return this._gpuBuffer!;
Expand Down
Loading

0 comments on commit 26623a1

Please sign in to comment.