diff options
| author | 2015-05-14 15:49:40 +0200 | |
|---|---|---|
| committer | 2015-07-14 02:16:10 -0300 | |
| commit | d08e9b29e2f512a94da22399b9d68b7d2ad6c4a3 (patch) | |
| tree | d6f74cf0bae4962298eba8c8a92512cb23761444 /src/video_core/rasterizer.cpp | |
| parent | Merge pull request #904 from aroulin/y2r-narrowing-warning (diff) | |
| download | yuzu-d08e9b29e2f512a94da22399b9d68b7d2ad6c4a3.tar.gz yuzu-d08e9b29e2f512a94da22399b9d68b7d2ad6c4a3.tar.xz yuzu-d08e9b29e2f512a94da22399b9d68b7d2ad6c4a3.zip | |
VideoCore: Implement the DOT3_RGB combiner
Diffstat (limited to 'src/video_core/rasterizer.cpp')
| -rw-r--r-- | src/video_core/rasterizer.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
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(); |