diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2017-05-25 06:37:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-25 06:37:42 +0200 |
commit | bae3799bd5208d08bb52546ad0723103c94cada3 (patch) | |
tree | e4c921df6bf28cdeb50f48d1b7aa4d7a0bc002ed /src/video_core/pica_state.h | |
parent | Merge pull request #2683 from bunnei/telemetry-framework (diff) | |
parent | gl_rasterizer: implement procedural texture (diff) | |
download | yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.gz yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.bz2 yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.lz yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.xz yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.zst yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.zip |
Diffstat (limited to 'src/video_core/pica_state.h')
-rw-r--r-- | src/video_core/pica_state.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/video_core/pica_state.h b/src/video_core/pica_state.h index af7536d11..f46db09fb 100644 --- a/src/video_core/pica_state.h +++ b/src/video_core/pica_state.h @@ -7,6 +7,7 @@ #include <array> #include "common/bit_field.h" #include "common/common_types.h" +#include "common/vector_math.h" #include "video_core/primitive_assembly.h" #include "video_core/regs.h" #include "video_core/shader/shader.h" @@ -25,6 +26,59 @@ struct State { Shader::AttributeBuffer input_default_attributes; + struct ProcTex { + union ValueEntry { + u32 raw; + + // LUT value, encoded as 12-bit fixed point, with 12 fraction bits + BitField<0, 12, u32> value; // 0.0.12 fixed point + + // Difference between two entry values. Used for efficient interpolation. + // 0.0.12 fixed point with two's complement. The range is [-0.5, 0.5). + // Note: the type of this is different from the one of lighting LUT + BitField<12, 12, s32> difference; + + float ToFloat() const { + return static_cast<float>(value) / 4095.f; + } + + float DiffToFloat() const { + return static_cast<float>(difference) / 4095.f; + } + }; + + union ColorEntry { + u32 raw; + BitField<0, 8, u32> r; + BitField<8, 8, u32> g; + BitField<16, 8, u32> b; + BitField<24, 8, u32> a; + + Math::Vec4<u8> ToVector() const { + return {static_cast<u8>(r), static_cast<u8>(g), static_cast<u8>(b), + static_cast<u8>(a)}; + } + }; + + union ColorDifferenceEntry { + u32 raw; + BitField<0, 8, s32> r; // half of the difference between two ColorEntry + BitField<8, 8, s32> g; + BitField<16, 8, s32> b; + BitField<24, 8, s32> a; + + Math::Vec4<s32> ToVector() const { + return Math::Vec4<s32>{r, g, b, a} * 2; + } + }; + + std::array<ValueEntry, 128> noise_table; + std::array<ValueEntry, 128> color_map_table; + std::array<ValueEntry, 128> alpha_map_table; + std::array<ColorEntry, 256> color_table; + std::array<ColorDifferenceEntry, 256> color_diff_table; + } proctex; + struct { union LutEntry { // Used for raw access |