diff options
| -rw-r--r-- | src/video_core/shader/decode/texture.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/video_core/shader/decode/texture.cpp b/src/video_core/shader/decode/texture.cpp index 4b14cdf58..cd984f763 100644 --- a/src/video_core/shader/decode/texture.cpp +++ b/src/video_core/shader/decode/texture.cpp | |||
| @@ -794,14 +794,10 @@ std::tuple<std::size_t, std::size_t> ShaderIR::ValidateAndGetCoordinateElement( | |||
| 794 | 794 | ||
| 795 | std::vector<Node> ShaderIR::GetAoffiCoordinates(Node aoffi_reg, std::size_t coord_count, | 795 | std::vector<Node> ShaderIR::GetAoffiCoordinates(Node aoffi_reg, std::size_t coord_count, |
| 796 | bool is_tld4) { | 796 | bool is_tld4) { |
| 797 | const auto [coord_offsets, size, wrap_value, | 797 | const std::array coord_offsets = is_tld4 ? std::array{0U, 8U, 16U} : std::array{0U, 4U, 8U}; |
| 798 | diff_value] = [is_tld4]() -> std::tuple<std::array<u32, 3>, u32, s32, s32> { | 798 | const u32 size = is_tld4 ? 6 : 4; |
| 799 | if (is_tld4) { | 799 | const s32 wrap_value = is_tld4 ? 32 : 8; |
| 800 | return {{0, 8, 16}, 6, 32, 64}; | 800 | const s32 diff_value = is_tld4 ? 64 : 16; |
| 801 | } else { | ||
| 802 | return {{0, 4, 8}, 4, 8, 16}; | ||
| 803 | } | ||
| 804 | }(); | ||
| 805 | const u32 mask = (1U << size) - 1; | 801 | const u32 mask = (1U << size) - 1; |
| 806 | 802 | ||
| 807 | std::vector<Node> aoffi; | 803 | std::vector<Node> aoffi; |
| @@ -814,7 +810,7 @@ std::vector<Node> ShaderIR::GetAoffiCoordinates(Node aoffi_reg, std::size_t coor | |||
| 814 | LOG_WARNING(HW_GPU, | 810 | LOG_WARNING(HW_GPU, |
| 815 | "AOFFI constant folding failed, some hardware might have graphical issues"); | 811 | "AOFFI constant folding failed, some hardware might have graphical issues"); |
| 816 | for (std::size_t coord = 0; coord < coord_count; ++coord) { | 812 | for (std::size_t coord = 0; coord < coord_count; ++coord) { |
| 817 | const Node value = BitfieldExtract(aoffi_reg, coord_offsets.at(coord), size); | 813 | const Node value = BitfieldExtract(aoffi_reg, coord_offsets[coord], size); |
| 818 | const Node condition = | 814 | const Node condition = |
| 819 | Operation(OperationCode::LogicalIGreaterEqual, value, Immediate(wrap_value)); | 815 | Operation(OperationCode::LogicalIGreaterEqual, value, Immediate(wrap_value)); |
| 820 | const Node negative = Operation(OperationCode::IAdd, value, Immediate(-diff_value)); | 816 | const Node negative = Operation(OperationCode::IAdd, value, Immediate(-diff_value)); |
| @@ -824,7 +820,7 @@ std::vector<Node> ShaderIR::GetAoffiCoordinates(Node aoffi_reg, std::size_t coor | |||
| 824 | } | 820 | } |
| 825 | 821 | ||
| 826 | for (std::size_t coord = 0; coord < coord_count; ++coord) { | 822 | for (std::size_t coord = 0; coord < coord_count; ++coord) { |
| 827 | s32 value = (*aoffi_immediate >> coord_offsets.at(coord)) & mask; | 823 | s32 value = (*aoffi_immediate >> coord_offsets[coord]) & mask; |
| 828 | if (value >= wrap_value) { | 824 | if (value >= wrap_value) { |
| 829 | value -= diff_value; | 825 | value -= diff_value; |
| 830 | } | 826 | } |