aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Engine
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine')
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs14
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs22
2 files changed, 36 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs
index 62df15e7..a8af5497 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs
@@ -328,5 +328,19 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
Signal();
}
}
+
+ /// <summary>
+ /// Sets the dual-source blend enabled state.
+ /// </summary>
+ /// <param name="enabled">True if blending is enabled and using dual-source blend</param>
+ public void SetDualSourceBlendEnabled(bool enabled)
+ {
+ if (enabled != _graphics.DualSourceBlendEnable)
+ {
+ _graphics.DualSourceBlendEnable = enabled;
+
+ Signal();
+ }
+ }
}
}
diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
index d7d197ad..00e09a31 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
@@ -1183,6 +1183,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
bool blendIndependent = _state.State.BlendIndependent;
ColorF blendConstant = _state.State.BlendConstant;
+ bool dualSourceBlendEnabled = false;
+
if (blendIndependent)
{
for (int index = 0; index < Constants.TotalRenderTargets; index++)
@@ -1200,6 +1202,15 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
FilterBlendFactor(blend.AlphaSrcFactor, index),
FilterBlendFactor(blend.AlphaDstFactor, index));
+ if (enable &&
+ (blend.ColorSrcFactor.IsDualSource() ||
+ blend.ColorDstFactor.IsDualSource() ||
+ blend.AlphaSrcFactor.IsDualSource() ||
+ blend.AlphaDstFactor.IsDualSource()))
+ {
+ dualSourceBlendEnabled = true;
+ }
+
_pipeline.BlendDescriptors[index] = descriptor;
_context.Renderer.Pipeline.SetBlendState(index, descriptor);
}
@@ -1219,12 +1230,23 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
FilterBlendFactor(blend.AlphaSrcFactor, 0),
FilterBlendFactor(blend.AlphaDstFactor, 0));
+ if (enable &&
+ (blend.ColorSrcFactor.IsDualSource() ||
+ blend.ColorDstFactor.IsDualSource() ||
+ blend.AlphaSrcFactor.IsDualSource() ||
+ blend.AlphaDstFactor.IsDualSource()))
+ {
+ dualSourceBlendEnabled = true;
+ }
+
for (int index = 0; index < Constants.TotalRenderTargets; index++)
{
_pipeline.BlendDescriptors[index] = descriptor;
_context.Renderer.Pipeline.SetBlendState(index, descriptor);
}
}
+
+ _currentSpecState.SetDualSourceBlendEnabled(dualSourceBlendEnabled);
}
/// <summary>