Skip to content

Optimize code size for render-data.ts#18259

Merged
minggo merged 2 commits into
cocos:v3.8.6from
dumganhar:386-opt-size-render-data
Feb 13, 2025
Merged

Optimize code size for render-data.ts#18259
minggo merged 2 commits into
cocos:v3.8.6from
dumganhar:386-opt-size-render-data

Conversation

@dumganhar

Copy link
Copy Markdown
Contributor

Re: #18222

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

@github-actions

github-actions Bot commented Jan 27, 2025

Copy link
Copy Markdown

👍 Package size ⤵ -922 bytes, old: 5193364, new: 5192442

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -3415,9 +3415,8 @@
         constructor(vertexFormat?: gfx.Attribute[]);
         isValid(): false | __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor;
         initRenderDrawInfo(comp: UIRenderer, drawInfoType?: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfoType): void;
         removeRenderDrawInfo(comp: UIRenderer): void;
-        protected setRenderDrawInfoAttributes(): void;
     }
     /**
      * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
      */
@@ -3446,13 +3445,16 @@
         vertexRow: number;
         vertexCol: number;
         constructor(vertexFormat?: gfx.Attribute[], accessor?: __private._cocos_2d_renderer_static_vb_accessor__StaticVBAccessor | null);
         resize(vertexCount: number, indexCount: number): void;
+        /** @mangle */
         protected setRenderDrawInfoAttributes(): void;
         /**
          * @internal
+         * @mangle
          */
         fillDrawInfoAttributes(drawInfo: __private._cocos_2d_renderer_render_draw_info__RenderDrawInfo): void;
+        /** @mangle */
         protected syncRender2dBuffer(): void;
         resizeAndCopy(vertexCount: number, indexCount: number): void;
         getMeshBuffer(): MeshBuffer | null;
         updateNode(comp: UIRenderer): void;
@@ -3513,9 +3515,8 @@
         clear(): void;
         protected _initIAInfo(device: gfx.Device): void;
         protected _reallocBuffer(vCount: number, iCount: number): void;
         setRenderDrawInfoAttributes(): void;
-        particleInitRenderDrawInfo(entity: __private._cocos_2d_renderer_render_entity__RenderEntity): void;
     }
     /**
      * @internal
      */

@dumganhar dumganhar requested a review from minggo February 5, 2025 05:55
@dumganhar

Copy link
Copy Markdown
Contributor Author

@minggo

@dumganhar

Copy link
Copy Markdown
Contributor Author

@cocos-robot run test cases

1 similar comment
@dumganhar

Copy link
Copy Markdown
Contributor Author

@cocos-robot run test cases

@github-actions

Copy link
Copy Markdown

@dumganhar, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
web-mobile PASS PASS FAIL SkewTest
ios PASS PASS FAIL reflection-probe
mac PASS PASS FAIL reflection-probe

@github-actions

Copy link
Copy Markdown

@dumganhar, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
windows PASS PASS FAIL BuildTimeConstantsTest
android PASS PASS FAIL BuildTimeConstantsTest
wechatgame PASS PASS FAIL SkewTest,BuildTimeConstantsTest


protected setRenderDrawInfoAttributes (): void {
/** @mangle */
protected override setRenderDrawInfoAttributes (): void {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can use mangle for protected function?

@minggo minggo Feb 13, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it because it is related with jsb?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RenderDrawInfo relevant APIs are all used for native (JSB). Non-native platforms don't need that.

@minggo minggo merged commit 5a27f11 into cocos:v3.8.6 Feb 13, 2025
@dumganhar

Copy link
Copy Markdown
Contributor Author

@cocos-robot run test cases

@github-actions

Copy link
Copy Markdown

@dumganhar, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
web-mobile PASS PASS PASS
ios PASS PASS FAIL reflection-probe
mac PASS PASS FAIL reflection-probe

@github-actions

Copy link
Copy Markdown

@dumganhar, Please check the result of run test cases:

Task Details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants