-
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
fix sampler info packing #17726
Merged
Merged
fix sampler info packing #17726
Conversation
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
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.
|
star-e
commented
Oct 16, 2024
info.addressU = (hash >> 6) & 3; | ||
info.addressV = (hash >> 8) & 3; | ||
info.addressW = (hash >> 10) & 3; | ||
info.maxAnisotropy = (hash >> 12) & 31; |
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.
Increase maxAnisotropy from 4 bits to 5 bits (0-15 to 0-16)
star-e
commented
Oct 16, 2024
hash |= (info.maxAnisotropy << 12); | ||
hash |= ((info.cmpFunc as number) << 16); | ||
hash |= (Math.min(info.maxAnisotropy, 16) << 12); | ||
hash |= ((info.cmpFunc as number) << 17); |
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.
Increase maxAnisotropy from 4 bits to 5 bits (0-15 to 0-16)
@cocos-robot run test cases |
star-e
requested review from
minggo and
dumganhar
and removed request for
minggo
October 16, 2024 05:20
dumganhar
approved these changes
Oct 16, 2024
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.
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:
Compatibility Check
This pull request: