diff options
author | Tony Wasserka <NeoBrainX@gmail.com> | 2014-12-21 02:57:56 +0100 |
---|---|---|
committer | Tony Wasserka <NeoBrainX@gmail.com> | 2014-12-31 15:35:54 +0100 |
commit | 77bb58afeb39344b7481f6f003a9beb6c7b87199 (patch) | |
tree | 81117ddffd5b0abe54dd03bbdacb4093e5c7e01b /src | |
parent | Pica: Add output merger definitions. (diff) | |
download | yuzu-77bb58afeb39344b7481f6f003a9beb6c7b87199.tar yuzu-77bb58afeb39344b7481f6f003a9beb6c7b87199.tar.gz yuzu-77bb58afeb39344b7481f6f003a9beb6c7b87199.tar.bz2 yuzu-77bb58afeb39344b7481f6f003a9beb6c7b87199.tar.lz yuzu-77bb58afeb39344b7481f6f003a9beb6c7b87199.tar.xz yuzu-77bb58afeb39344b7481f6f003a9beb6c7b87199.tar.zst yuzu-77bb58afeb39344b7481f6f003a9beb6c7b87199.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/video_core/rasterizer.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index a80148872..04ff68615 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -279,12 +279,15 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, } }; - auto GetColorModifier = [](ColorModifier factor, const Math::Vec4<u8>& values) -> Math::Vec3<u8> { + static auto GetColorModifier = [](ColorModifier factor, const Math::Vec4<u8>& values) -> Math::Vec3<u8> { switch (factor) { case ColorModifier::SourceColor: return values.rgb(); + case ColorModifier::OneMinusSourceColor: + return (Math::Vec3<u8>(255, 255, 255) - values.rgb()).Cast<u8>(); + case ColorModifier::SourceAlpha: return { values.a(), values.a(), values.a() }; @@ -295,7 +298,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, } }; - auto GetAlphaModifier = [](AlphaModifier factor, u8 value) -> u8 { + static auto GetAlphaModifier = [](AlphaModifier factor, u8 value) -> u8 { switch (factor) { case AlphaModifier::SourceAlpha: return value; @@ -310,7 +313,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, } }; - auto ColorCombine = [](Operation op, const Math::Vec3<u8> input[3]) -> Math::Vec3<u8> { + static auto ColorCombine = [](Operation op, const Math::Vec3<u8> input[3]) -> Math::Vec3<u8> { switch (op) { case Operation::Replace: return input[0]; @@ -330,6 +333,15 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, case Operation::Lerp: return ((input[0] * input[2] + input[1] * (Math::MakeVec<u8>(255, 255, 255) - input[2]).Cast<u8>()) / 255).Cast<u8>(); + case Operation::Subtract: + { + auto result = input[0].Cast<int>() - input[1].Cast<int>(); + result.r() = std::max(0, result.r()); + result.g() = std::max(0, result.g()); + result.b() = std::max(0, result.b()); + return result.Cast<u8>(); + } + default: LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op); _dbg_assert_(HW_GPU, 0); @@ -337,7 +349,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, } }; - auto AlphaCombine = [](Operation op, const std::array<u8,3>& input) -> u8 { + static auto AlphaCombine = [](Operation op, const std::array<u8,3>& input) -> u8 { switch (op) { case Operation::Replace: return input[0]; @@ -351,6 +363,9 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, case Operation::Lerp: return (input[0] * input[2] + input[1] * (255 - input[2])) / 255; + case Operation::Subtract: + return std::max(0, (int)input[0] - (int)input[1]); + default: LOG_ERROR(HW_GPU, "Unknown alpha combiner operation %d\n", (int)op); _dbg_assert_(HW_GPU, 0); |