mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-25 17:20:04 +00:00
video_core/textures: Move GetMaxAnisotropy to cpp file
This commit is contained in:
parent
d7db088180
commit
a209d464f9
@ -2,8 +2,10 @@
|
|||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
#include "core/settings.h"
|
||||||
#include "video_core/textures/texture.h"
|
#include "video_core/textures/texture.h"
|
||||||
|
|
||||||
namespace Tegra::Texture {
|
namespace Tegra::Texture {
|
||||||
@ -45,6 +47,22 @@ constexpr std::array<float, 256> SRGB_CONVERSION_LUT = {
|
|||||||
0.917104f, 0.929242f, 0.941493f, 0.953859f, 0.966338f, 1.000000f, 1.000000f, 1.000000f,
|
0.917104f, 0.929242f, 0.941493f, 0.953859f, 0.966338f, 1.000000f, 1.000000f, 1.000000f,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
unsigned SettingsMinimumAnisotropy() noexcept {
|
||||||
|
switch (static_cast<Anisotropy>(Settings::values.max_anisotropy)) {
|
||||||
|
default:
|
||||||
|
case Anisotropy::Default:
|
||||||
|
return 1U;
|
||||||
|
case Anisotropy::Filter2x:
|
||||||
|
return 2U;
|
||||||
|
case Anisotropy::Filter4x:
|
||||||
|
return 4U;
|
||||||
|
case Anisotropy::Filter8x:
|
||||||
|
return 8U;
|
||||||
|
case Anisotropy::Filter16x:
|
||||||
|
return 16U;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
std::array<float, 4> TSCEntry::GetBorderColor() const noexcept {
|
std::array<float, 4> TSCEntry::GetBorderColor() const noexcept {
|
||||||
@ -55,4 +73,8 @@ std::array<float, 4> TSCEntry::GetBorderColor() const noexcept {
|
|||||||
SRGB_CONVERSION_LUT[srgb_border_color_b], border_color[3]};
|
SRGB_CONVERSION_LUT[srgb_border_color_b], border_color[3]};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float TSCEntry::GetMaxAnisotropy() const noexcept {
|
||||||
|
return static_cast<float>(std::max(1U << max_anisotropy, SettingsMinimumAnisotropy()));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Tegra::Texture
|
} // namespace Tegra::Texture
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/settings.h"
|
|
||||||
|
|
||||||
namespace Tegra::Texture {
|
namespace Tegra::Texture {
|
||||||
|
|
||||||
@ -338,24 +337,7 @@ struct TSCEntry {
|
|||||||
|
|
||||||
std::array<float, 4> GetBorderColor() const noexcept;
|
std::array<float, 4> GetBorderColor() const noexcept;
|
||||||
|
|
||||||
float GetMaxAnisotropy() const {
|
float GetMaxAnisotropy() const noexcept;
|
||||||
const u32 min_value = [] {
|
|
||||||
switch (static_cast<Anisotropy>(Settings::values.max_anisotropy)) {
|
|
||||||
default:
|
|
||||||
case Anisotropy::Default:
|
|
||||||
return 1U;
|
|
||||||
case Anisotropy::Filter2x:
|
|
||||||
return 2U;
|
|
||||||
case Anisotropy::Filter4x:
|
|
||||||
return 4U;
|
|
||||||
case Anisotropy::Filter8x:
|
|
||||||
return 8U;
|
|
||||||
case Anisotropy::Filter16x:
|
|
||||||
return 16U;
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
return static_cast<float>(std::max(1U << max_anisotropy, min_value));
|
|
||||||
}
|
|
||||||
|
|
||||||
float GetMinLod() const {
|
float GetMinLod() const {
|
||||||
return static_cast<float>(min_lod_clamp) / 256.0f;
|
return static_cast<float>(min_lod_clamp) / 256.0f;
|
||||||
|
Loading…
Reference in New Issue
Block a user