Maintain the PICA's 8 bits of color precision when using the interpolated primary color

This matches the software renderer by using round.
The actual hardware rounds the results up instead of flooring.
This commit is contained in:
Dwayne Slater 2017-11-29 16:49:04 -05:00
parent 350082ab75
commit fcc141a327

View file

@ -234,7 +234,7 @@ static void AppendSource(std::string& out, const PicaShaderConfig& config,
using Source = TevStageConfig::Source;
switch (source) {
case Source::PrimaryColor:
out += "primary_color";
out += "rounded_primary_color";
break;
case Source::PrimaryFragmentColor:
out += "primary_fragment_color";
@ -1100,8 +1100,11 @@ float LookupLightingLUTSigned(int lut_index, float pos) {
if (config.state.proctex.enable)
AppendProcTexSampler(out, config);
// We round the interpolated primary color to the nearest 1/255th
// This maintains the PICA's 8 bits of precision
out += R"(
void main() {
vec4 rounded_primary_color = round(primary_color * 255.0) / 255.0;
vec4 primary_fragment_color = vec4(0.0);
vec4 secondary_fragment_color = vec4(0.0);
)";