diff options
| author | 2017-06-09 18:18:57 -0500 | |
|---|---|---|
| committer | 2017-07-11 19:39:15 +0300 | |
| commit | 2a75837bc30ba08e2470f4b91078747a08c5213a (patch) | |
| tree | d5932cb0b6f2e519da6cf0cbb4fb8800c6d496f7 /src | |
| parent | SwRasterizer: Corrected the light LUT lookups. (diff) | |
| download | yuzu-2a75837bc30ba08e2470f4b91078747a08c5213a.tar.gz yuzu-2a75837bc30ba08e2470f4b91078747a08c5213a.tar.xz yuzu-2a75837bc30ba08e2470f4b91078747a08c5213a.zip | |
SwRasterizer: Corrected the light LUT lookups.
Diffstat (limited to 'src')
| -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 | |||
| 177 | 177 | ||
| 178 | float sample_loc = scale * distance + bias; | 178 | float sample_loc = scale * distance + bias; |
| 179 | 179 | ||
| 180 | u8 lutindex = MathUtil::Clamp(floorf(sample_loc * 256.f), 0.0f, 255.0f); | 180 | u8 lutindex = MathUtil::Clamp(std::floor(sample_loc * 256.f), 0.0f, 255.0f); |
| 181 | float delta = sample_loc * 256 - lutindex; | 181 | float delta = sample_loc * 256 - lutindex; |
| 182 | dist_atten = LookupLightingLut(lut, lutindex, delta / 256.f); | 182 | dist_atten = LookupLightingLut(lut, lutindex, delta); |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | float clamp_highlights = 1.0f; | 185 | float clamp_highlights = 1.0f; |
| @@ -227,13 +227,14 @@ std::tuple<Math::Vec4<u8>, Math::Vec4<u8>> ComputeFragmentsColors(const Math::Qu | |||
| 227 | else | 227 | else |
| 228 | result = std::max(result, 0.0f); | 228 | result = std::max(result, 0.0f); |
| 229 | 229 | ||
| 230 | u8 lutindex = MathUtil::Clamp(floorf(result * 256.f), 0.0f, 255.0f); | 230 | u8 lutindex = MathUtil::Clamp(std::floor(result * 256.f), 0.0f, 255.0f); |
| 231 | float delta = result * 256 - lutindex; | 231 | float delta = result * 256 - lutindex; |
| 232 | return { lutindex, delta / 256.f }; | 232 | return { lutindex, delta }; |
| 233 | } else { | 233 | } else { |
| 234 | u8 tmpi = MathUtil::Clamp(floorf(result * 128.f), 0.0f, 127.0f); | 234 | float flr = std::floor(result * 128.f); |
| 235 | s8 tmpi = MathUtil::Clamp(flr, -128.0f, 127.0f); | ||
| 235 | float delta = result * 128.f - tmpi; | 236 | float delta = result * 128.f - tmpi; |
| 236 | return { tmpi & 0xFF, delta / 128.f }; | 237 | return { tmpi & 0xFF, delta }; |
| 237 | } | 238 | } |
| 238 | }; | 239 | }; |
| 239 | 240 | ||