From 3b5ff61201e23068a4e4e526e3c51dd9732b7ae4 Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 25 May 2015 00:40:01 -0400 Subject: rasterizer: Implement AddSigned combiner function for alpha channel. --- src/video_core/rasterizer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index 6df3a74f2..8f39e609b 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -570,6 +570,13 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, case Operation::Add: return std::min(255, input[0] + input[1]); + case Operation::AddSigned: + { + // TODO(bunnei): Verify that the color conversion from (float) 0.5f to (byte) 128 is correct + auto result = static_cast(input[0]) + static_cast(input[1]) - 128; + return static_cast(MathUtil::Clamp(result, 0, 255)); + } + case Operation::Lerp: return (input[0] * input[2] + input[1] * (255 - input[2])) / 255; -- cgit v1.2.3