mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 22:57:22 +00:00
rasterizer: Implement AddSigned combiner function for alpha channel.
This commit is contained in:
parent
1574c44586
commit
3b5ff61201
1 changed files with 7 additions and 0 deletions
|
@ -570,6 +570,13 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
|
||||||
case Operation::Add:
|
case Operation::Add:
|
||||||
return std::min(255, input[0] + input[1]);
|
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<int>(input[0]) + static_cast<int>(input[1]) - 128;
|
||||||
|
return static_cast<u8>(MathUtil::Clamp<int>(result, 0, 255));
|
||||||
|
}
|
||||||
|
|
||||||
case Operation::Lerp:
|
case Operation::Lerp:
|
||||||
return (input[0] * input[2] + input[1] * (255 - input[2])) / 255;
|
return (input[0] * input[2] + input[1] * (255 - input[2])) / 255;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue