Merge pull request #12287 from Tilka/blending

VideoCommon: copy software renderer logic for blend mode priorities
This commit is contained in:
Tilka 2023-11-12 07:31:13 +00:00 committed by GitHub
commit e5d2deb017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 39 deletions

View File

@ -11,8 +11,8 @@ BPMemory bpmem;
bool BlendMode::UseLogicOp() const bool BlendMode::UseLogicOp() const
{ {
// Logicop bit has lowest priority. // Blending overrides the logicop bit.
if (subtract || blendenable || !logicopenable) if (blendenable || !logicopenable)
return false; return false;
// Fast path for Kirby's Return to Dreamland, they use it with dstAlpha. // Fast path for Kirby's Return to Dreamland, they use it with dstAlpha.

View File

@ -120,7 +120,8 @@ void BlendingState::Generate(const BPMemory& bp)
const bool dstalpha = bp.dstalpha.enable && alphaupdate; const bool dstalpha = bp.dstalpha.enable && alphaupdate;
usedualsrc = true; usedualsrc = true;
// The subtract bit has the highest priority if (bp.blendmode.blendenable)
{
if (bp.blendmode.subtract) if (bp.blendmode.subtract)
{ {
blendenable = true; blendenable = true;
@ -135,9 +136,7 @@ void BlendingState::Generate(const BPMemory& bp)
dstfactoralpha = DstBlendFactor::Zero; dstfactoralpha = DstBlendFactor::Zero;
} }
} }
else
// The blendenable bit has the middle priority
else if (bp.blendmode.blendenable)
{ {
blendenable = true; blendenable = true;
srcfactor = bp.blendmode.srcfactor; srcfactor = bp.blendmode.srcfactor;
@ -159,8 +158,7 @@ void BlendingState::Generate(const BPMemory& bp)
dstfactoralpha = DstBlendFactor::Zero; dstfactoralpha = DstBlendFactor::Zero;
} }
} }
}
// The logicop bit has the lowest priority
else if (bp.blendmode.logicopenable) else if (bp.blendmode.logicopenable)
{ {
if (bp.blendmode.logicmode == LogicOp::NoOp) if (bp.blendmode.logicmode == LogicOp::NoOp)