diff options
author | bunnei <bunneidev@gmail.com> | 2019-03-12 18:10:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-12 18:10:53 +0100 |
commit | 2ad44a453f39dd7d78eb7513a277872169b42b3a (patch) | |
tree | 1e2b8b9c61e2ffb8d63e2a19f2fe8fde7e42105d /src/video_core/textures | |
parent | Merge pull request #2207 from lioncash/hwopus (diff) | |
parent | gl_rasterizer: Encapsulate sampler queries into methods (diff) | |
download | yuzu-2ad44a453f39dd7d78eb7513a277872169b42b3a.tar yuzu-2ad44a453f39dd7d78eb7513a277872169b42b3a.tar.gz yuzu-2ad44a453f39dd7d78eb7513a277872169b42b3a.tar.bz2 yuzu-2ad44a453f39dd7d78eb7513a277872169b42b3a.tar.lz yuzu-2ad44a453f39dd7d78eb7513a277872169b42b3a.tar.xz yuzu-2ad44a453f39dd7d78eb7513a277872169b42b3a.tar.zst yuzu-2ad44a453f39dd7d78eb7513a277872169b42b3a.zip |
Diffstat (limited to 'src/video_core/textures')
-rw-r--r-- | src/video_core/textures/texture.h | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index 0fc5530f2..8c278c0e2 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h @@ -4,6 +4,7 @@ #pragma once +#include <array> #include "common/assert.h" #include "common/bit_field.h" #include "common/common_funcs.h" @@ -293,7 +294,7 @@ struct TSCEntry { union { BitField<0, 2, TextureFilter> mag_filter; BitField<4, 2, TextureFilter> min_filter; - BitField<6, 2, TextureMipmapFilter> mip_filter; + BitField<6, 2, TextureMipmapFilter> mipmap_filter; BitField<9, 1, u32> cubemap_interface_filtering; BitField<12, 13, u32> mip_lod_bias; }; @@ -306,10 +307,33 @@ struct TSCEntry { BitField<12, 8, u32> srgb_border_color_g; BitField<20, 8, u32> srgb_border_color_b; }; - float border_color_r; - float border_color_g; - float border_color_b; - float border_color_a; + std::array<f32, 4> border_color; + + float GetMaxAnisotropy() const { + return static_cast<float>(1U << max_anisotropy); + } + + float GetMinLod() const { + return static_cast<float>(min_lod_clamp) / 256.0f; + } + + float GetMaxLod() const { + return static_cast<float>(max_lod_clamp) / 256.0f; + } + + float GetLodBias() const { + // Sign extend the 13-bit value. + constexpr u32 mask = 1U << (13 - 1); + return static_cast<float>((mip_lod_bias ^ mask) - mask) / 256.0f; + } + + std::array<float, 4> GetBorderColor() const { + if (srgb_conversion) { + return {srgb_border_color_r / 255.0f, srgb_border_color_g / 255.0f, + srgb_border_color_b / 255.0f, border_color[3]}; + } + return border_color; + } }; static_assert(sizeof(TSCEntry) == 0x20, "TSCEntry has wrong size"); |