summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/pica.h1
-rw-r--r--src/video_core/rasterizer.cpp13
2 files changed, 13 insertions, 1 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index 46a7b21dc..026b10a62 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -290,6 +290,7 @@ struct Regs {
290 AddSigned = 3, 290 AddSigned = 3,
291 Lerp = 4, 291 Lerp = 4,
292 Subtract = 5, 292 Subtract = 5,
293 Dot3_RGB = 6,
293 294
294 MultiplyThenAdd = 8, 295 MultiplyThenAdd = 8,
295 AddThenMultiply = 9, 296 AddThenMultiply = 9,
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index c381c2bd9..a6b7997ce 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -641,7 +641,18 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
641 result = (result * input[2].Cast<int>()) / 255; 641 result = (result * input[2].Cast<int>()) / 255;
642 return result.Cast<u8>(); 642 return result.Cast<u8>();
643 } 643 }
644 644 case Operation::Dot3_RGB:
645 {
646 // Not fully accurate.
647 // Worst case scenario seems to yield a +/-3 error
648 // Some HW results indicate that the per-component computation can't have a higher precision than 1/256,
649 // while dot3_rgb( (0x80,g0,b0),(0x7F,g1,b1) ) and dot3_rgb( (0x80,g0,b0),(0x80,g1,b1) ) give different results
650 int result = ((input[0].r() * 2 - 255) * (input[1].r() * 2 - 255) + 128) / 256 +
651 ((input[0].g() * 2 - 255) * (input[1].g() * 2 - 255) + 128) / 256 +
652 ((input[0].b() * 2 - 255) * (input[1].b() * 2 - 255) + 128) / 256;
653 result = std::max(0, std::min(255, result));
654 return { (u8)result, (u8)result, (u8)result };
655 }
645 default: 656 default:
646 LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op); 657 LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op);
647 UNIMPLEMENTED(); 658 UNIMPLEMENTED();