aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Engine/Methods.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-07-28 18:30:08 -0300
committerGitHub <noreply@github.com>2020-07-28 18:30:08 -0300
commit43c13057da7726c324f2b5d674e5e1308eb1f6a7 (patch)
tree222d8bace4d35166aa9a0ca8d6ed121bec20b287 /Ryujinx.Graphics.Gpu/Engine/Methods.cs
parent938c06c652ca15e4a5f776e434fa8304b4b43f0b (diff)
Implement alpha test using legacy functions (#1426)
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/Methods.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/Methods.cs25
1 files changed, 22 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Methods.cs b/Ryujinx.Graphics.Gpu/Engine/Methods.cs
index fbde0f0a..f8b6e43f 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Methods.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Methods.cs
@@ -164,6 +164,13 @@ namespace Ryujinx.Graphics.Gpu.Engine
UpdateDepthClampState(state);
}
+ if (state.QueryModified(MethodOffset.AlphaTestEnable,
+ MethodOffset.AlphaTestRef,
+ MethodOffset.AlphaTestFunc))
+ {
+ UpdateAlphaTestState(state);
+ }
+
if (state.QueryModified(MethodOffset.DepthTestEnable,
MethodOffset.DepthWriteEnable,
MethodOffset.DepthTestFunc))
@@ -372,7 +379,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
if (dsEnable)
{
var dsState = state.Get<RtDepthStencilState>(MethodOffset.RtDepthStencilState);
- var dsSize = state.Get<Size3D> (MethodOffset.RtDepthStencilSize);
+ var dsSize = state.Get<Size3D>(MethodOffset.RtDepthStencilSize);
depthStencil = TextureManager.FindOrCreateTexture(dsState, dsSize, samplesInX, samplesInY);
}
@@ -451,6 +458,18 @@ namespace Ryujinx.Graphics.Gpu.Engine
}
/// <summary>
+ /// Updates host alpha test state based on current GPU state.
+ /// </summary>
+ /// <param name="state">Current GPU state</param>
+ private void UpdateAlphaTestState(GpuState state)
+ {
+ _context.Renderer.Pipeline.SetAlphaTest(
+ state.Get<Boolean32>(MethodOffset.AlphaTestEnable),
+ state.Get<float>(MethodOffset.AlphaTestRef),
+ state.Get<CompareOp>(MethodOffset.AlphaTestFunc));
+ }
+
+ /// <summary>
/// Updates host depth test state based on current GPU state.
/// </summary>
/// <param name="state">Current GPU state</param>
@@ -577,8 +596,8 @@ namespace Ryujinx.Graphics.Gpu.Engine
/// <param name="state">Current GPU state</param>
private void UpdateStencilTestState(GpuState state)
{
- var backMasks = state.Get<StencilBackMasks> (MethodOffset.StencilBackMasks);
- var test = state.Get<StencilTestState> (MethodOffset.StencilTestState);
+ var backMasks = state.Get<StencilBackMasks>(MethodOffset.StencilBackMasks);
+ var test = state.Get<StencilTestState>(MethodOffset.StencilTestState);
var backTest = state.Get<StencilBackTestState>(MethodOffset.StencilBackTestState);
CompareOp backFunc;