Skip to content

Optimize code size for webgl-commands.ts & webgl2-commands.ts - #18266

Merged
minggo merged 3 commits into
cocos:v3.8.6from
dumganhar:386-opt-size-webgl
Feb 5, 2025
Merged

Optimize code size for webgl-commands.ts & webgl2-commands.ts#18266
minggo merged 3 commits into
cocos:v3.8.6from
dumganhar:386-opt-size-webgl

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 30, 2025

Copy link
Copy Markdown

👍 Package size ⤵ -1086 bytes, old: 5218954, new: 5217868

Interface Check Report

This pull request does not change any public interfaces !

@dumganhar
dumganhar requested review from minggo and star-e February 5, 2025 05:51
Comment thread cocos/gfx/webgl/webgl-commands.ts Outdated

offset.x = regionTexOffset.x === 0 ? 0 : alignTo(regionTexOffset.x, blockSizeWidth);
offset.y = regionTexOffset.y === 0 ? 0 : alignTo(regionTexOffset.y, blockSizeHeight);
extent.width = regionTexExtentWidth < blockSizeWidth ? regionTexExtent.width : alignTo(regionTexExtentWidth, blockSizeWidth);

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.

regionTexExtent.width -> regionTexExtentWidth

offset.y = regionTexOffset.y === 0 ? 0 : alignTo(regionTexOffset.y, blockSizeHeight);
extent.width = regionTexExtentWidth < blockSizeWidth ? regionTexExtent.width : alignTo(regionTexExtentWidth, blockSizeWidth);
extent.height = regionTexExtentHeight < blockSizeHeight ? regionTexExtent.width
: alignTo(regionTexExtentHeight, blockSizeHeight);

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.

regionTexExtent.width -> regionTexExtentWidth

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.

Good catch.

Fixed.

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

Copy link
Copy Markdown
Contributor Author

@cocos-robot run test cases

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