From e31cb171fa10fe93b71b71fd339bdd39b2093219 Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 13 Jun 2017 12:53:50 -0500 Subject: [PATCH] SwRasterizer/Lighting: Fixed a bug where the distance attenuation bias was being set to the dist atten scale. --- src/video_core/swrasterizer/rasterizer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/video_core/swrasterizer/rasterizer.cpp b/src/video_core/swrasterizer/rasterizer.cpp index f9a02c6f1..773b3baf0 100644 --- a/src/video_core/swrasterizer/rasterizer.cpp +++ b/src/video_core/swrasterizer/rasterizer.cpp @@ -175,12 +175,11 @@ std::tuple, Math::Vec4> ComputeFragmentsColors( if (!lighting.IsDistAttenDisabled(num)) { auto distance = (-view - position).Length(); float scale = Pica::float20::FromRaw(light_config.dist_atten_scale).ToFloat32(); - float dist_aten_bias = - Pica::float20::FromRaw(light_config.dist_atten_scale).ToFloat32(); + float bias = Pica::float20::FromRaw(light_config.dist_atten_bias).ToFloat32(); size_t lut = static_cast(LightingRegs::LightingSampler::DistanceAttenuation) + num; - float sample_loc = scale * distance + dist_aten_bias; + float sample_loc = scale * distance + bias; u8 lutindex = static_cast(MathUtil::Clamp(std::floor(sample_loc * 256.f), 0.0f, 255.0f));