-
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
[v3.8.5] Support inline enum and mangle private variables to reduce engine size. #17703
Merged
Merged
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
d1a693c
Inline enum
dumganhar b0df8ec
$ suffix.
dumganhar 562c3fe
Update
dumganhar 47ae217
optimize
dumganhar 2613bcf
Remove second commandbuffer.
dumganhar d7a24a3
Shorter state cache invocations
dumganhar 1ab40f1
Update webgl-wapchain.ts
dumganhar 1664022
Remove unused code in gfx/base, gfx/webgl module and mangle propertie…
dumganhar 947d3b9
Use function reference instead of defining a function for Math.ceil a…
dumganhar 4d8a212
Fix device-manager.ts
dumganhar 6362bc6
Fix wrong variables
dumganhar eab5c82
Temp commit
dumganhar 8f9b485
Merge branch 'v3.8.5' of https://github.com/cocos/cocos-engine into 3…
dumganhar 3f28f59
Update WebGL2 backend.
dumganhar ffb3317
Merge branch '385-reduce-gfx-code' into inline-enum
dumganhar d7fef7e
For testing.
dumganhar 57e230f
continue fix webgl2 backend.
dumganhar ad8f641
Update
dumganhar 31577e7
optimize math library size.
dumganhar c32026e
revert splash-screen hack.
dumganhar 84d7f76
smaller scheduler.ts
dumganhar f709b20
Update spine.
dumganhar 932ccbb
smaller editboximpl
dumganhar 76a1069
update prefab.ts for SUPPORT_JIT.
dumganhar 04cd30f
Update mesh.ts and minigame Editbox.js
dumganhar c971773
Add ONLY_2D flag
dumganhar 95f119b
smaller root.ts
dumganhar 0a6c1f9
smaller minigame pal.
dumganhar b964b90
smaller render-scene code.
dumganhar dbdef07
smaller scene-global
dumganhar 4e5fad4
smaller ui.
dumganhar acf6a03
smaller asset
dumganhar c99386a
smaller core
dumganhar eaadd3d
smaller game
dumganhar 2de84fa
const enum WebGLConstants
dumganhar 91502cf
smaller input
dumganhar e46bec4
smaller scene-graph
dumganhar bb5c015
smaller serialization
dumganhar 07e8686
smaller zlib.min.js
dumganhar fb94e5b
smaller sorting-layer
dumganhar b9cd18c
Merge branch 'v3.8.5' of https://github.com/cocos/cocos-engine into i…
dumganhar e688401
Update cc.config.json, add treeshake config.
dumganhar e526fa2
Update ccbuild to 2.2.14.
dumganhar d21ce5f
Merge branch 'v3.8.5' of https://github.com/cocos/cocos-engine into i…
dumganhar 5390acf
Fix splash-screen and don't mangle game._calculateDT
dumganhar 8c0d452
Revert gl-constants.ts
dumganhar 4e861d8
Fix import file extension in tmx-xml-parser.ts
dumganhar 7ddf682
Should not mangle _exportedExts since it's used by editor.
dumganhar 8ef55c0
Update error map.
dumganhar c342462
Fix SplashScreen
dumganhar 52893fa
Update game.ts
dumganhar ed552cb
Fix enum export for camera.jsb.ts
dumganhar e086fa6
Update tiled-layer.ts
dumganhar e12058f
Update ccbuild to 2.2.15
dumganhar e2752ef
Revert ONLY_2D
dumganhar 37fb5fc
Update model.ts
dumganhar 851ae8b
Update root.ts and action-manager.ts
dumganhar 93f7839
Fix SplashScreen.destroy
dumganhar fec9da3
Update unitest
dumganhar b156569
Fix issues reported in PR review
dumganhar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
import { ccclass, help, executionOrder, menu, tooltip, displayOrder, type, range, editable, serializable, visible } from 'cc.decorator'; | ||
import { BUILD, EDITOR } from 'internal:constants'; | ||
import { SpriteAtlas } from '../assets/sprite-atlas'; | ||
import { SpriteFrame } from '../assets/sprite-frame'; | ||
import { SpriteFrame, SpriteFrameEvent } from '../assets/sprite-frame'; | ||
import { Vec2, cclegacy, ccenum, clamp, warnID } from '../../core'; | ||
import { IBatcher } from '../renderer/i-batcher'; | ||
import { UIRenderer, InstanceMaterialType } from '../framework/ui-renderer'; | ||
|
@@ -151,7 +151,7 @@ | |
} | ||
ccenum(SizeMode); | ||
|
||
enum EventType { | ||
export enum SpriteEventType { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The functionality of inline enum doesn't allow the same name, so add a prefix. |
||
SPRITE_FRAME_CHANGED = 'spriteframe-changed', | ||
} | ||
|
||
|
@@ -214,7 +214,7 @@ | |
this.markForUpdateRenderData(); | ||
this._applySpriteFrame(lastSprite); | ||
if (EDITOR) { | ||
this.node.emit(EventType.SPRITE_FRAME_CHANGED, this); | ||
this.node.emit(SpriteEventType.SPRITE_FRAME_CHANGED, this); | ||
} | ||
} | ||
|
||
|
@@ -369,7 +369,7 @@ | |
* sprite.trim = true; | ||
* ``` | ||
*/ | ||
@visible(function (this: Sprite) { | ||
return this._type === SpriteType.SIMPLE; | ||
}) | ||
@displayOrder(8) | ||
|
@@ -458,7 +458,7 @@ | |
* @en Event types for sprite. | ||
* @zh sprite 的事件类型。 | ||
*/ | ||
public static EventType = EventType; | ||
public static EventType = SpriteEventType; | ||
|
||
@serializable | ||
protected _spriteFrame: SpriteFrame | null = null; | ||
|
@@ -500,15 +500,15 @@ | |
if (spriteFrame) { | ||
this._updateUVs(); | ||
if (this._type === SpriteType.SLICED) { | ||
spriteFrame.on(SpriteFrame.EVENT_UV_UPDATED, this._updateUVs, this); | ||
spriteFrame.on(SpriteFrameEvent.UV_UPDATED, this._updateUVs, this); | ||
} | ||
} | ||
} | ||
|
||
public onDisable (): void { | ||
super.onDisable(); | ||
if (this._spriteFrame && this._type === SpriteType.SLICED) { | ||
this._spriteFrame.off(SpriteFrame.EVENT_UV_UPDATED, this._updateUVs, this); | ||
this._spriteFrame.off(SpriteFrameEvent.UV_UPDATED, this._updateUVs, this); | ||
} | ||
} | ||
|
||
|
@@ -616,9 +616,9 @@ | |
// Only Sliced type need update uv when sprite frame insets changed | ||
if (this._spriteFrame) { | ||
if (this._type === SpriteType.SLICED) { | ||
this._spriteFrame.on(SpriteFrame.EVENT_UV_UPDATED, this._updateUVs, this); | ||
this._spriteFrame.on(SpriteFrameEvent.UV_UPDATED, this._updateUVs, this); | ||
} else { | ||
this._spriteFrame.off(SpriteFrame.EVENT_UV_UPDATED, this._updateUVs, this); | ||
this._spriteFrame.off(SpriteFrameEvent.UV_UPDATED, this._updateUVs, this); | ||
} | ||
} | ||
} | ||
|
@@ -686,7 +686,7 @@ | |
const spriteFrame = this._spriteFrame; | ||
|
||
if (oldFrame && this._type === SpriteType.SLICED) { | ||
oldFrame.off(SpriteFrame.EVENT_UV_UPDATED, this._updateUVs, this); | ||
oldFrame.off(SpriteFrameEvent.UV_UPDATED, this._updateUVs, this); | ||
} | ||
|
||
let textureChanged = false; | ||
|
@@ -706,7 +706,7 @@ | |
} | ||
this._applySpriteSize(); | ||
if (this._type === SpriteType.SLICED) { | ||
spriteFrame.on(SpriteFrame.EVENT_UV_UPDATED, this._updateUVs, this); | ||
spriteFrame.on(SpriteFrameEvent.UV_UPDATED, this._updateUVs, this); | ||
} | ||
} | ||
} | ||
|
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
We only inline enums, doesn't support to inline static const varibles in class.
So define a enum for those constants.