Optimize code size for draw-batch.ts and batcher-2d.ts, remove needless setter/getter.#18238
Merged
Merged
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;
}
|
Contributor
Author
|
@cocos-robot run test cases |
|
@dumganhar, Please check the result of
Task Details |
|
@dumganhar, Please check the result of
Task Details |
minggo
reviewed
Jan 23, 2025
| private declare _localData: Float32Array | null; | ||
|
|
||
| public get descriptorSet (): DescriptorSet | null { | ||
| public getDescriptorSet (): DescriptorSet | null { |
Contributor
Author
There was a problem hiding this comment.
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.
Contributor
There was a problem hiding this comment.
Ok, it is better to add a description.
minggo
approved these changes
Jan 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re: #18222
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: