diff options
author | Subv <subv2112@gmail.com> | 2017-06-10 01:18:57 +0200 |
---|---|---|
committer | wwylele <wwylele@gmail.com> | 2017-07-11 18:39:15 +0200 |
commit | 2a75837bc30ba08e2470f4b91078747a08c5213a (patch) | |
tree | d5932cb0b6f2e519da6cf0cbb4fb8800c6d496f7 /src/video_core/swrasterizer | |
parent | SwRasterizer: Corrected the light LUT lookups. (diff) | |
download | yuzu-2a75837bc30ba08e2470f4b91078747a08c5213a.tar yuzu-2a75837bc30ba08e2470f4b91078747a08c5213a.tar.gz yuzu-2a75837bc30ba08e2470f4b91078747a08c5213a.tar.bz2 yuzu-2a75837bc30ba08e2470f4b91078747a08c5213a.tar.lz yuzu-2a75837bc30ba08e2470f4b91078747a08c5213a.tar.xz yuzu-2a75837bc30ba08e2470f4b91078747a08c5213a.tar.zst yuzu-2a75837bc30ba08e2470f4b91078747a08c5213a.zip |
Diffstat (limited to 'src/video_core/swrasterizer')
-rw-r--r-- | src/video_core/swrasterizer/rasterizer.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/video_core/swrasterizer/rasterizer.cpp b/src/video_core/swrasterizer/rasterizer.cpp index a9098e1f0..2c804b6e7 100644 --- a/src/video_core/swrasterizer/rasterizer.cpp +++ b/src/video_core/swrasterizer/rasterizer.cpp @@ -177,9 +177,9 @@ std::tuple<Math::Vec4<u8>, Math::Vec4<u8>> ComputeFragmentsColors(const Math::Qu float sample_loc = scale * distance + bias; - u8 lutindex = MathUtil::Clamp(floorf(sample_loc * 256.f), 0.0f, 255.0f); + u8 lutindex = MathUtil::Clamp(std::floor(sample_loc * 256.f), 0.0f, 255.0f); float delta = sample_loc * 256 - lutindex; - dist_atten = LookupLightingLut(lut, lutindex, delta / 256.f); + dist_atten = LookupLightingLut(lut, lutindex, delta); } float clamp_highlights = 1.0f; @@ -227,13 +227,14 @@ std::tuple<Math::Vec4<u8>, Math::Vec4<u8>> ComputeFragmentsColors(const Math::Qu else result = std::max(result, 0.0f); - u8 lutindex = MathUtil::Clamp(floorf(result * 256.f), 0.0f, 255.0f); + u8 lutindex = MathUtil::Clamp(std::floor(result * 256.f), 0.0f, 255.0f); float delta = result * 256 - lutindex; - return { lutindex, delta / 256.f }; + return { lutindex, delta }; } else { - u8 tmpi = MathUtil::Clamp(floorf(result * 128.f), 0.0f, 127.0f); + float flr = std::floor(result * 128.f); + s8 tmpi = MathUtil::Clamp(flr, -128.0f, 127.0f); float delta = result * 128.f - tmpi; - return { tmpi & 0xFF, delta / 128.f }; + return { tmpi & 0xFF, delta }; } }; |