mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-11-01 04:37:52 +00:00
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:
parent
350082ab75
commit
fcc141a327
1 changed files with 4 additions and 1 deletions
|
@ -234,7 +234,7 @@ static void AppendSource(std::string& out, const PicaShaderConfig& config,
|
||||||
using Source = TevStageConfig::Source;
|
using Source = TevStageConfig::Source;
|
||||||
switch (source) {
|
switch (source) {
|
||||||
case Source::PrimaryColor:
|
case Source::PrimaryColor:
|
||||||
out += "primary_color";
|
out += "rounded_primary_color";
|
||||||
break;
|
break;
|
||||||
case Source::PrimaryFragmentColor:
|
case Source::PrimaryFragmentColor:
|
||||||
out += "primary_fragment_color";
|
out += "primary_fragment_color";
|
||||||
|
@ -1100,8 +1100,11 @@ float LookupLightingLUTSigned(int lut_index, float pos) {
|
||||||
if (config.state.proctex.enable)
|
if (config.state.proctex.enable)
|
||||||
AppendProcTexSampler(out, config);
|
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"(
|
out += R"(
|
||||||
void main() {
|
void main() {
|
||||||
|
vec4 rounded_primary_color = round(primary_color * 255.0) / 255.0;
|
||||||
vec4 primary_fragment_color = vec4(0.0);
|
vec4 primary_fragment_color = vec4(0.0);
|
||||||
vec4 secondary_fragment_color = vec4(0.0);
|
vec4 secondary_fragment_color = vec4(0.0);
|
||||||
)";
|
)";
|
||||||
|
|
Loading…
Reference in a new issue