texture_cache: Enable anisotropic filtering (#1872)

This commit is contained in:
Quang Ngô 2024-12-27 21:47:26 +07:00 committed by GitHub
parent a86ee7e7f5
commit 0351b864d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 41 additions and 0 deletions

View file

@ -364,6 +364,16 @@ enum class Filter : u64 {
AnisoLinear = 3,
};
constexpr bool IsAnisoFilter(const Filter filter) {
switch (filter) {
case Filter::AnisoPoint:
case Filter::AnisoLinear:
return true;
default:
return false;
}
}
enum class MipFilter : u64 {
None = 0,
Point = 1,
@ -435,6 +445,23 @@ struct Sampler {
float MaxLod() const noexcept {
return static_cast<float>(max_lod.Value()) / 256.0f;
}
float MaxAniso() const {
switch (max_aniso) {
case AnisoRatio::One:
return 1.0f;
case AnisoRatio::Two:
return 2.0f;
case AnisoRatio::Four:
return 4.0f;
case AnisoRatio::Eight:
return 8.0f;
case AnisoRatio::Sixteen:
return 16.0f;
default:
UNREACHABLE();
}
}
};
} // namespace AmdGpu