Rasterizer Discard + Multisample State

This commit is contained in:
Isaac Marovitz 2024-08-10 21:07:20 +01:00 committed by Isaac Marovitz
parent 6e3aaa6360
commit bdb00f3981
3 changed files with 20 additions and 8 deletions

View file

@ -399,6 +399,13 @@ namespace Ryujinx.Graphics.Metal
} }
} }
public readonly void UpdateRasterizerDiscard(bool discard)
{
_currentState.Pipeline.RasterizerDiscardEnable = discard;
SignalDirty(DirtyFlags.RenderPipeline);
}
public readonly void UpdateRenderTargets(ITexture[] colors, ITexture depthStencil) public readonly void UpdateRenderTargets(ITexture[] colors, ITexture depthStencil)
{ {
_currentState.FramebufferUsingColorWriteMask = false; _currentState.FramebufferUsingColorWriteMask = false;
@ -656,6 +663,14 @@ namespace Ryujinx.Graphics.Metal
SignalDirty(DirtyFlags.DepthBias); SignalDirty(DirtyFlags.DepthBias);
} }
public readonly void UpdateMultisampleState(MultisampleDescriptor multisample)
{
_currentState.Pipeline.AlphaToCoverageEnable = multisample.AlphaToCoverageEnable;
_currentState.Pipeline.AlphaToOneEnable = multisample.AlphaToOneEnable;
SignalDirty(DirtyFlags.RenderPipeline);
}
public void UpdateScissors(ReadOnlySpan<Rectangle<int>> regions) public void UpdateScissors(ReadOnlySpan<Rectangle<int>> regions)
{ {
for (int i = 0; i < regions.Length; i++) for (int i = 0; i < regions.Length; i++)

View file

@ -597,7 +597,7 @@ namespace Ryujinx.Graphics.Metal
public void SetMultisampleState(MultisampleDescriptor multisample) public void SetMultisampleState(MultisampleDescriptor multisample)
{ {
Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!"); _encoderStateManager.UpdateMultisampleState(multisample);
} }
public void SetPatchParameters(int vertices, ReadOnlySpan<float> defaultOuterLevel, ReadOnlySpan<float> defaultInnerLevel) public void SetPatchParameters(int vertices, ReadOnlySpan<float> defaultOuterLevel, ReadOnlySpan<float> defaultInnerLevel)
@ -638,7 +638,7 @@ namespace Ryujinx.Graphics.Metal
public void SetRasterizerDiscard(bool discard) public void SetRasterizerDiscard(bool discard)
{ {
Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!"); _encoderStateManager.UpdateRasterizerDiscard(discard);
} }
public void SetRenderTargetColorMasks(ReadOnlySpan<uint> componentMask) public void SetRenderTargetColorMasks(ReadOnlySpan<uint> componentMask)

View file

@ -208,12 +208,9 @@ namespace Ryujinx.Graphics.Metal
} }
} }
/* TODO: enable when sharpmetal fixes the bindings renderPipelineDescriptor.SetAlphaToCoverageEnabled(AlphaToCoverageEnable);
renderPipelineDescriptor.AlphaToCoverageEnabled = AlphaToCoverageEnable; renderPipelineDescriptor.SetAlphaToOneEnabled(AlphaToOneEnable);
renderPipelineDescriptor.AlphaToOneEnabled = AlphaToOneEnable; renderPipelineDescriptor.SetRasterizationEnabled(!RasterizerDiscardEnable);
renderPipelineDescriptor.RasterizationEnabled = !RasterizerDiscardEnable;
*/
renderPipelineDescriptor.SampleCount = Math.Max(1, SamplesCount); renderPipelineDescriptor.SampleCount = Math.Max(1, SamplesCount);
var vertexDescriptor = BuildVertexDescriptor(); var vertexDescriptor = BuildVertexDescriptor();