summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/RenderState.cpp
diff options
context:
space:
mode:
authorTellowKrinkle <tellowkrinkle@gmail.com>2022-06-11 21:03:09 -0500
committerTellowKrinkle <tellowkrinkle@gmail.com>2022-07-13 21:51:24 -0500
commit6ab24e6c176bfd288296bf8284a30b0835fa45c3 (patch)
treea35536d212d2cc22777672454e84cc883883c46e /Source/Core/VideoCommon/RenderState.cpp
parent99eef447651d40ed1954ccd5a83557478546face (diff)
VideoCommon: Better driver bug handling
Adds a pass to process driver deficiencies between UID caching and use, allowing a full view of the whole pipeline, since some bugs/workarounds involve interactions between blend modes and the pixel shader
Diffstat (limited to 'Source/Core/VideoCommon/RenderState.cpp')
-rw-r--r--Source/Core/VideoCommon/RenderState.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/RenderState.cpp b/Source/Core/VideoCommon/RenderState.cpp
index 3b3554b4fe..a997c654f2 100644
--- a/Source/Core/VideoCommon/RenderState.cpp
+++ b/Source/Core/VideoCommon/RenderState.cpp
@@ -25,6 +25,34 @@ void DepthState::Generate(const BPMemory& bp)
func = bp.zmode.func.Value();
}
+static bool IsDualSrc(SrcBlendFactor factor)
+{
+ return factor == SrcBlendFactor::SrcAlpha || factor == SrcBlendFactor::InvSrcAlpha;
+}
+
+static bool IsDualSrc(DstBlendFactor factor)
+{
+ switch (factor)
+ {
+ case DstBlendFactor::SrcClr:
+ case DstBlendFactor::SrcAlpha:
+ case DstBlendFactor::InvSrcClr:
+ case DstBlendFactor::InvSrcAlpha:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool BlendingState::RequiresDualSrc() const
+{
+ bool requires_dual_src = false;
+ requires_dual_src |= IsDualSrc(srcfactor) || IsDualSrc(srcfactoralpha);
+ requires_dual_src |= IsDualSrc(dstfactor) || IsDualSrc(dstfactoralpha);
+ requires_dual_src &= blendenable && usedualsrc;
+ return requires_dual_src;
+}
+
// If the framebuffer format has no alpha channel, it is assumed to
// ONE on blending. As the backends may emulate this framebuffer
// configuration with an alpha channel, we just drop all references