diff options
author | Tony Wasserka <NeoBrainX@gmail.com> | 2015-01-03 13:45:10 +0100 |
---|---|---|
committer | Tony Wasserka <NeoBrainX@gmail.com> | 2015-02-18 14:50:28 +0100 |
commit | 04cd06d5c285848c29278083891474ee78797c8a (patch) | |
tree | 850483bcfd106c8c4e3257b96f1b71f06cd21e60 /src/video_core | |
parent | Pica/OutputMerger: Fix flipped framebuffers. (diff) | |
download | yuzu-04cd06d5c285848c29278083891474ee78797c8a.tar yuzu-04cd06d5c285848c29278083891474ee78797c8a.tar.gz yuzu-04cd06d5c285848c29278083891474ee78797c8a.tar.bz2 yuzu-04cd06d5c285848c29278083891474ee78797c8a.tar.lz yuzu-04cd06d5c285848c29278083891474ee78797c8a.tar.xz yuzu-04cd06d5c285848c29278083891474ee78797c8a.tar.zst yuzu-04cd06d5c285848c29278083891474ee78797c8a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/pica.h | 3 | ||||
-rw-r--r-- | src/video_core/rasterizer.cpp | 25 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h index c20bf99d4..23fc6b9ba 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -266,6 +266,9 @@ struct Regs { AddSigned = 3, Lerp = 4, Subtract = 5, + + MultiplyThenAdd = 8, + AddThenMultiply = 9, }; union { diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index 9cad5f9b6..eacca82e5 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -419,6 +419,25 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, return result.Cast<u8>(); } + case Operation::MultiplyThenAdd: + { + auto result = (input[0] * input[1] + 255 * input[2].Cast<int>()) / 255; + result.r() = std::min(255, result.r()); + result.g() = std::min(255, result.g()); + result.b() = std::min(255, result.b()); + return result.Cast<u8>(); + } + + case Operation::AddThenMultiply: + { + auto result = input[0] + input[1]; + result.r() = std::min(255, result.r()); + result.g() = std::min(255, result.g()); + result.b() = std::min(255, result.b()); + result = (result * input[2].Cast<int>()) / 255; + return result.Cast<u8>(); + } + default: LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op); UNIMPLEMENTED(); @@ -443,6 +462,12 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, case Operation::Subtract: return std::max(0, (int)input[0] - (int)input[1]); + case Operation::MultiplyThenAdd: + return std::min(255, (input[0] * input[1] + 255 * input[2]) / 255); + + case Operation::AddThenMultiply: + return (std::min(255, (input[0] + input[1])) * input[2]) / 255; + default: LOG_ERROR(HW_GPU, "Unknown alpha combiner operation %d\n", (int)op); UNIMPLEMENTED(); |