mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-01-22 22:06:58 +00:00
Software: clamp inverse factors to zero.
Just to make sure we don't end up with negative factors when adding/subtracting/etc.
This commit is contained in:
parent
c22953a4b9
commit
c90559262b
@ -830,14 +830,13 @@ static inline Vec3<int> GetSourceFactor(const Vec4<int>& source, const Vec4<int>
|
||||
return Vec3<int>::AssignToAll(2 * source.a());
|
||||
|
||||
case GE_SRCBLEND_DOUBLEINVSRCALPHA:
|
||||
return Vec3<int>::AssignToAll(255 - 2 * source.a());
|
||||
return Vec3<int>::AssignToAll(255 - std::min(2 * source.a(), 255));
|
||||
|
||||
case GE_SRCBLEND_DOUBLEDSTALPHA:
|
||||
return Vec3<int>::AssignToAll(2 * dst.a());
|
||||
|
||||
case GE_SRCBLEND_DOUBLEINVDSTALPHA:
|
||||
// TODO: Clamping?
|
||||
return Vec3<int>::AssignToAll(255 - 2 * dst.a());
|
||||
return Vec3<int>::AssignToAll(255 - std::min(2 * dst.a(), 255));
|
||||
|
||||
case GE_SRCBLEND_FIXA:
|
||||
default:
|
||||
@ -879,13 +878,13 @@ static inline Vec3<int> GetDestFactor(const Vec4<int>& source, const Vec4<int>&
|
||||
return Vec3<int>::AssignToAll(2 * source.a());
|
||||
|
||||
case GE_DSTBLEND_DOUBLEINVSRCALPHA:
|
||||
return Vec3<int>::AssignToAll(255 - 2 * source.a());
|
||||
return Vec3<int>::AssignToAll(255 - std::min(2 * source.a(), 255));
|
||||
|
||||
case GE_DSTBLEND_DOUBLEDSTALPHA:
|
||||
return Vec3<int>::AssignToAll(2 * dst.a());
|
||||
|
||||
case GE_DSTBLEND_DOUBLEINVDSTALPHA:
|
||||
return Vec3<int>::AssignToAll(255 - 2 * dst.a());
|
||||
return Vec3<int>::AssignToAll(255 - std::min(2 * dst.a(), 255));
|
||||
|
||||
case GE_DSTBLEND_FIXB:
|
||||
default:
|
||||
@ -896,6 +895,7 @@ static inline Vec3<int> GetDestFactor(const Vec4<int>& source, const Vec4<int>&
|
||||
|
||||
static inline Vec3<int> AlphaBlendingResult(const Vec4<int> &source, const Vec4<int> &dst)
|
||||
{
|
||||
// Note: These factors cannot go below 0, but they can go above 255 when doubling.
|
||||
Vec3<int> srcfactor = GetSourceFactor(source, dst);
|
||||
Vec3<int> dstfactor = GetDestFactor(source, dst);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user