-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Optimize code size for draw-batch.ts and batcher-2d.ts, remove needless setter/getter. #18238
base: v3.8.6
Are you sure you want to change the base?
Conversation
…ss setter/getter.
👍 Package size ⤵ -1220 bytes, old: 5226328, new: 5225108Interface Check Report! WARNING this pull request has changed these public interfaces:
@@ -61331,15 +61331,10 @@
allocateChunk(vertexCount: number, indexCount: number): _cocos_2d_renderer_static_vb_accessor__StaticVBChunk | null;
recycleChunk(chunk: _cocos_2d_renderer_static_vb_accessor__StaticVBChunk): void;
static generateID(): number;
}
+ /** @mangle */
export class _cocos_2d_renderer_draw_batch__DrawBatch2D {
- get inputAssembler(): gfx.InputAssembler | null;
- set inputAssembler(ia: gfx.InputAssembler | null);
- get descriptorSet(): gfx.DescriptorSet | null;
- set descriptorSet(ds: gfx.DescriptorSet | null);
- get visFlags(): number;
- set visFlags(vis: number);
get passes(): renderer.Pass[];
get shaders(): gfx.Shader[];
model: renderer.scene.Model | null;
texture: gfx.Texture | null;
@@ -61347,8 +61342,11 @@
useLocalData: Node | null;
isStatic: boolean;
textureHash: number;
samplerHash: number;
+ visFlags: number;
+ inputAssembler: gfx.InputAssembler | null;
+ descriptorSet: gfx.DescriptorSet | null;
destroy(ui: _cocos_2d_renderer_i_batcher__IBatcher): void;
clear(): void;
fillPasses(mat: Material | null, dss: gfx.DepthStencilState | null, dssHash: number, patches: Readonly<renderer.IMacroPatch[] | null>): void;
}
|
@cocos-robot run test cases |
@dumganhar, Please check the result of
Task Details |
@dumganhar, Please check the result of
Task Details |
@@ -971,7 +973,7 @@ class LocalDescriptorSet { | |||
private _transformUpdate = true; | |||
private declare _localData: Float32Array | null; | |||
|
|||
public get descriptorSet (): DescriptorSet | null { | |||
public getDescriptorSet (): DescriptorSet | null { |
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 have to change it?
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.
It's because we're using babel to compile ts to js.
babel has its own getter/setter accessor definition which could not be understood by terser
minifier.
See this issue: terser/terser#322
Since LocalDescriptorSet
is an internal module, change the get descriptSet
to function getDescriptorSet
is fine for us.
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.
Ok, it is better to add a description.
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.
Added comments.
Re: #18222
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: