From 862183906ead6461a48ef0dc609c8270a0a79143 Mon Sep 17 00:00:00 2001 From: Darius Goad Date: Tue, 24 Feb 2015 13:56:31 -0600 Subject: [PATCH] Fix Dot3RGB and Dot3RGBA according to GL spec --- src/video_core/rasterizer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index 7813b2a17..9688d5b7c 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -440,6 +440,7 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, return result.Cast(); } + case Operation::Dot3RGB: case Operation::Dot3RGBA: { //return std::inner_product(begin(a), end(a), begin(b), 0.0); @@ -493,9 +494,17 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, case Operation::Subtract: return std::max(0, (int)input[0] - (int)input[1]); - case Operation::Dot3RGBA: + case Operation::Dot3RGB: return 255; + case Operation::Dot3RGBA: + //return std::inner_product(begin(a), end(a), begin(b), 0.0); + int a[] = { input[0].r(), input[0].g(), input[0].b() }; //int a[] = { 1, 3, -5 }; + int b[] = { input[1].r(), input[1].g(), input[1].b() }; + + auto res = std::inner_product(a, a + sizeof(a) / sizeof(a[0]), b, 0); + return res; + case Operation::MultiplyThenAdd: return std::min(255, (input[0] * input[1] + 255 * input[2]) / 255);