Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
star-e committed Oct 16, 2024
1 parent e8da8bd commit 1c2dd60
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion native/cocos/renderer/gfx-base/GFXDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ bool operator==(const BufferInfo &lhs, const BufferInfo &rhs) {

template <>
ccstd::hash_t Hasher<SamplerInfo>::operator()(const SamplerInfo &info) const {
return static_cast<ccstd::hash_t>(compressSamplerInfo(info));
return static_cast<ccstd::hash_t>(packSamplerInfo(info));
}

bool operator==(const SamplerInfo &lhs, const SamplerInfo &rhs) {
Expand Down
4 changes: 2 additions & 2 deletions native/cocos/renderer/gfx-base/GFXSamplerUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
namespace cc {
namespace gfx {

constexpr uint32_t compressSamplerInfo(const SamplerInfo &info) noexcept {
constexpr uint32_t packSamplerInfo(const SamplerInfo &info) noexcept {
CC_ASSERT(static_cast<uint32_t>(info.minFilter) < (1 << 2));
CC_ASSERT(static_cast<uint32_t>(info.magFilter) < (1 << 2));
CC_ASSERT(static_cast<uint32_t>(info.mipFilter) < (1 << 2));
Expand All @@ -49,7 +49,7 @@ constexpr uint32_t compressSamplerInfo(const SamplerInfo &info) noexcept {
return packed;
}

constexpr SamplerInfo uncompressSamplerInfo(const uint32_t packed) noexcept {
constexpr SamplerInfo unpackSamplerInfo(const uint32_t packed) noexcept {
SamplerInfo info{};
info.minFilter = static_cast<Filter>(packed & ((1 << 2) - 1));
info.magFilter = static_cast<Filter>((packed >> 2) & ((1 << 2) - 1));
Expand Down
6 changes: 3 additions & 3 deletions native/cocos/renderer/gfx-base/states/GFXSampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ ccstd::hash_t Sampler::computeHash(const SamplerInfo &info) {
}

SamplerInfo Sampler::unpackFromHash(ccstd::hash_t hash) {
return uncompressSamplerInfo(hash);
return unpackSamplerInfo(hash);
}

namespace {

constexpr bool testSamplerInfo(const SamplerInfo &info) {
const uint32_t packed = compressSamplerInfo(info);
const SamplerInfo unpacked = uncompressSamplerInfo(packed);
const uint32_t packed = packSamplerInfo(info);
const SamplerInfo unpacked = unpackSamplerInfo(packed);

return info.minFilter == unpacked.minFilter &&
info.magFilter == unpacked.magFilter &&
Expand Down

0 comments on commit 1c2dd60

Please sign in to comment.