aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Engine
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2022-07-05 19:58:36 -0300
committerGitHub <noreply@github.com>2022-07-05 19:58:36 -0300
commitb46b63e06a36845175f68331edb5ddeeb34de27b (patch)
tree1ca8adf9541d1f68e420feb853a612413d690725 /Ryujinx.Graphics.Gpu/Engine
parent594246ea4727c9377b1c916934d9b257a1b5d0d0 (diff)
Add support for alpha to coverage dithering (#3069)
* Add support for alpha to coverage dithering * Shader cache version bump * Fix wrong alpha register * Ensure support buffer is cleared * New shader specialization based approach
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine')
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs24
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs8
2 files changed, 27 insertions, 5 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
index c64c760a..2f5d4fc5 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
@@ -166,7 +166,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
nameof(ThreedClassState.BlendEnable),
nameof(ThreedClassState.BlendState)),
- new StateUpdateCallbackEntry(UpdateLogicOpState, nameof(ThreedClassState.LogicOpState))
+ new StateUpdateCallbackEntry(UpdateLogicOpState, nameof(ThreedClassState.LogicOpState)),
+
+ new StateUpdateCallbackEntry(UpdateMultisampleState,
+ nameof(ThreedClassState.AlphaToCoverageDitherEnable),
+ nameof(ThreedClassState.MultisampleControl))
});
}
@@ -1093,6 +1097,20 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
}
/// <summary>
+ /// Updates multisample state, based on guest state.
+ /// </summary>
+ private void UpdateMultisampleState()
+ {
+ bool alphaToCoverageEnable = (_state.State.MultisampleControl & 1) != 0;
+ bool alphaToOneEnable = (_state.State.MultisampleControl & 0x10) != 0;
+
+ _context.Renderer.Pipeline.SetMultisampleState(new MultisampleDescriptor(
+ alphaToCoverageEnable,
+ _state.State.AlphaToCoverageDitherEnable,
+ alphaToOneEnable));
+ }
+
+ /// <summary>
/// Updates host shaders based on the guest GPU state.
/// </summary>
private void UpdateShaderState()
@@ -1231,7 +1249,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
_state.State.EarlyZForce,
_drawState.Topology,
_state.State.TessMode,
- _state.State.ViewportTransformEnable == 0);
+ _state.State.ViewportTransformEnable == 0,
+ (_state.State.MultisampleControl & 1) != 0,
+ _state.State.AlphaToCoverageDitherEnable);
}
/// <summary>
diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs
index 81a22831..2a831356 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClassState.cs
@@ -767,7 +767,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
public SamplerIndex SamplerIndex;
public fixed uint Reserved1238[37];
public Boolean32 DepthTestEnable;
- public fixed uint Reserved12D0[5];
+ public fixed uint Reserved12D0[4];
+ public Boolean32 AlphaToCoverageDitherEnable;
public Boolean32 BlendIndependent;
public Boolean32 DepthWriteEnable;
public Boolean32 AlphaTestEnable;
@@ -802,9 +803,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
public Boolean32 PointSpriteEnable;
public fixed uint Reserved1524[3];
public uint ResetCounter;
- public uint Reserved1534;
+ public Boolean32 MultisampleEnable;
public Boolean32 RtDepthStencilEnable;
- public fixed uint Reserved153C[5];
+ public uint MultisampleControl;
+ public fixed uint Reserved1540[4];
public GpuVa RenderEnableAddress;
public Condition RenderEnableCondition;
public PoolState SamplerPoolState;