mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-20 01:09:55 +00:00
Video backends: fix rounding in lighting computation.
For whatever reason, the hardware doesn't do a full divide by 255, but instead uses an approximation with shifting, similar to the way it is done in TEV.
This commit is contained in:
parent
36720e6822
commit
9e4eeb3b9b
2 changed files with 16 additions and 11 deletions
|
@ -255,7 +255,8 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com
|
|||
GenerateLightShader<T>(object, uid_data, i, lit_index, lightsColName, lightsName, coloralpha);
|
||||
}
|
||||
}
|
||||
object.Write("%s%d = float4(mat * clamp(lacc, 0, 255) / 255) / 255.0;\n", dest, j);
|
||||
object.Write("lacc = clamp(lacc, 0, 255);");
|
||||
object.Write("%s%d = float4((mat * (lacc + (lacc >> 7))) >> 8) / 255.0;\n", dest, j);
|
||||
object.Write("}\n");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue