From ab60414122184851415a27ae8bcacb4aab0504b6 Mon Sep 17 00:00:00 2001 From: wwylele Date: Fri, 16 Jun 2017 14:00:15 +0300 Subject: gl_rasterizer/lighting: fix LUT interpolation --- src/video_core/pica_state.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/video_core/pica_state.h') diff --git a/src/video_core/pica_state.h b/src/video_core/pica_state.h index f46db09fb..3b00df0b3 100644 --- a/src/video_core/pica_state.h +++ b/src/video_core/pica_state.h @@ -87,12 +87,18 @@ struct State { // LUT value, encoded as 12-bit fixed point, with 12 fraction bits BitField<0, 12, u32> value; // 0.0.12 fixed point - // Used by HW for efficient interpolation, Citra does not use these - BitField<12, 12, s32> difference; // 1.0.11 fixed point + // Used for efficient interpolation. + BitField<12, 11, u32> difference; // 0.0.11 fixed point + BitField<23, 1, u32> neg_difference; - float ToFloat() { + float ToFloat() const { return static_cast(value) / 4095.f; } + + float DiffToFloat() const { + float diff = static_cast(difference) / 2047.f; + return neg_difference ? -diff : diff; + } }; std::array, 24> luts; -- cgit v1.2.3