Skip to content
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

fix sampler info packing #17726

Merged
merged 4 commits into from
Oct 16, 2024
Merged

fix sampler info packing #17726

merged 4 commits into from
Oct 16, 2024

Conversation

star-e
Copy link
Contributor

@star-e star-e commented Oct 16, 2024

Increase anisotropic filter value from 0-15 to 0-16. (4bits to 5bits)
Fix sampler info unpacking algorithm.
Add static tests of pack/unpack functions.

#17723

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.

@star-e star-e changed the title fix sampler info compression fix sampler info packing Oct 16, 2024
Copy link

github-actions bot commented Oct 16, 2024

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -7975,9 +7975,9 @@
             get hash(): number;
             protected _info$: SamplerInfo;
             protected _hash$: number;
             constructor(info: Readonly<SamplerInfo>, hash: number);
-            static computeHash(info: Readonly<SamplerInfo>): Filter;
+            static computeHash(info: Readonly<SamplerInfo>): number;
             static unpackFromHash(hash: number): SamplerInfo;
         }
         export class SamplerInfo {
             minFilter: Filter;
@@ -60561,9 +60561,9 @@
             setMipFilter(mipFilter: _cocos_asset_assets_asset_enum__TextureFilter): void;
             /**
              * @en Sets the texture's anisotropy.
              * @zh 设置此贴图的各向异性。
-             * @param anisotropy @en The anisotropy to be set. @zh 待设置的各向异性数值。
+             * @param anisotropy @en The anisotropy to be set. Max value is 16. @zh 待设置的各向异性数值。最大值为16
              */
             setAnisotropy(anisotropy: number): void;
             /**
              * @en Destroy the current texture, clear up the related GPU resources.

info.addressU = (hash >> 6) & 3;
info.addressV = (hash >> 8) & 3;
info.addressW = (hash >> 10) & 3;
info.maxAnisotropy = (hash >> 12) & 31;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Increase maxAnisotropy from 4 bits to 5 bits (0-15 to 0-16)

hash |= (info.maxAnisotropy << 12);
hash |= ((info.cmpFunc as number) << 16);
hash |= (Math.min(info.maxAnisotropy, 16) << 12);
hash |= ((info.cmpFunc as number) << 17);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Increase maxAnisotropy from 4 bits to 5 bits (0-15 to 0-16)

@star-e
Copy link
Contributor Author

star-e commented Oct 16, 2024

@cocos-robot run test cases

@star-e star-e requested review from minggo and dumganhar and removed request for minggo October 16, 2024 05:20
@dumganhar dumganhar merged commit 408425c into cocos:v3.8.5 Oct 16, 2024
26 checks passed
@star-e star-e deleted the v3.8.5-gfx branch October 16, 2024 08:04
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