summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/RenderState.cpp
diff options
context:
space:
mode:
authorTilka <tilkax@gmail.com>2023-11-12 07:31:13 +0000
committerGitHub <noreply@github.com>2023-11-12 07:31:13 +0000
commite5d2deb0174b5be00fbe95fb38942c65ba5d2d74 (patch)
tree5e616464a75bc66f11049ab2878ccebf37489b90 /Source/Core/VideoCommon/RenderState.cpp
parentf35ee227550ccb6fb1feb9b7c0ab2f7428089824 (diff)
parentac9079f2cad9953958112da158b2ffb6c5f2e4a8 (diff)
Merge pull request #12287 from Tilka/blending
VideoCommon: copy software renderer logic for blend mode priorities
Diffstat (limited to 'Source/Core/VideoCommon/RenderState.cpp')
-rw-r--r--Source/Core/VideoCommon/RenderState.cpp66
1 files changed, 32 insertions, 34 deletions
diff --git a/Source/Core/VideoCommon/RenderState.cpp b/Source/Core/VideoCommon/RenderState.cpp
index ec010756ba..89f36f2b18 100644
--- a/Source/Core/VideoCommon/RenderState.cpp
+++ b/Source/Core/VideoCommon/RenderState.cpp
@@ -120,47 +120,45 @@ void BlendingState::Generate(const BPMemory& bp)
const bool dstalpha = bp.dstalpha.enable && alphaupdate;
usedualsrc = true;
- // The subtract bit has the highest priority
- if (bp.blendmode.subtract)
+ if (bp.blendmode.blendenable)
{
- blendenable = true;
- subtractAlpha = subtract = true;
- srcfactoralpha = srcfactor = SrcBlendFactor::One;
- dstfactoralpha = dstfactor = DstBlendFactor::One;
-
- if (dstalpha)
+ if (bp.blendmode.subtract)
{
- subtractAlpha = false;
- srcfactoralpha = SrcBlendFactor::One;
- dstfactoralpha = DstBlendFactor::Zero;
- }
- }
+ blendenable = true;
+ subtractAlpha = subtract = true;
+ srcfactoralpha = srcfactor = SrcBlendFactor::One;
+ dstfactoralpha = dstfactor = DstBlendFactor::One;
- // The blendenable bit has the middle priority
- else if (bp.blendmode.blendenable)
- {
- blendenable = true;
- srcfactor = bp.blendmode.srcfactor;
- dstfactor = bp.blendmode.dstfactor;
- if (!target_has_alpha)
- {
- // uses ONE instead of DSTALPHA
- srcfactor = RemoveDstAlphaUsage(srcfactor);
- dstfactor = RemoveDstAlphaUsage(dstfactor);
+ if (dstalpha)
+ {
+ subtractAlpha = false;
+ srcfactoralpha = SrcBlendFactor::One;
+ dstfactoralpha = DstBlendFactor::Zero;
+ }
}
- // replaces SrcClr with SrcAlpha and DstClr with DstAlpha, it is important to
- // use the dst function for the src factor and vice versa
- srcfactoralpha = RemoveDstColorUsage(srcfactor);
- dstfactoralpha = RemoveSrcColorUsage(dstfactor);
-
- if (dstalpha)
+ else
{
- srcfactoralpha = SrcBlendFactor::One;
- dstfactoralpha = DstBlendFactor::Zero;
+ blendenable = true;
+ srcfactor = bp.blendmode.srcfactor;
+ dstfactor = bp.blendmode.dstfactor;
+ if (!target_has_alpha)
+ {
+ // uses ONE instead of DSTALPHA
+ srcfactor = RemoveDstAlphaUsage(srcfactor);
+ dstfactor = RemoveDstAlphaUsage(dstfactor);
+ }
+ // replaces SrcClr with SrcAlpha and DstClr with DstAlpha, it is important to
+ // use the dst function for the src factor and vice versa
+ srcfactoralpha = RemoveDstColorUsage(srcfactor);
+ dstfactoralpha = RemoveSrcColorUsage(dstfactor);
+
+ if (dstalpha)
+ {
+ srcfactoralpha = SrcBlendFactor::One;
+ dstfactoralpha = DstBlendFactor::Zero;
+ }
}
}
-
- // The logicop bit has the lowest priority
else if (bp.blendmode.logicopenable)
{
if (bp.blendmode.logicmode == LogicOp::NoOp)