Fix blend state optimisation breaking attachments

Fixes SM3DW
This commit is contained in:
Isaac Marovitz 2024-07-03 23:58:27 +01:00
parent e1568613af
commit 5a8e070c04
No known key found for this signature in database
GPG Key ID: 97250B2B09A132E1
2 changed files with 11 additions and 3 deletions

View File

@ -390,11 +390,11 @@ namespace Ryujinx.Graphics.Metal
{
_currentState.StoredBlend[i] = mtlBlend;
mtlBlend = new ColorBlendStateUid();
mtlBlend.Swap(new ColorBlendStateUid());
}
else if (mtlBlend.WriteMask == 0)
{
mtlBlend = _currentState.StoredBlend[i];
mtlBlend.Swap(_currentState.StoredBlend[i]);
}
}
@ -535,7 +535,7 @@ namespace Ryujinx.Graphics.Metal
{
_currentState.StoredBlend[index] = blendState;
blendState = new ColorBlendStateUid();
blendState.Swap(new ColorBlendStateUid());
}
_currentState.BlendColor = blend.BlendConstant;

View File

@ -111,6 +111,14 @@ namespace Ryujinx.Graphics.Metal
readonly get => ((Id0 >> 63) & 0x1) != 0UL;
set => Id0 = (Id0 & 0x7FFFFFFFFFFFFFFF) | ((value ? 1UL : 0UL) << 63);
}
public void Swap(ColorBlendStateUid uid)
{
var format = PixelFormat;
this = uid;
PixelFormat = format;
}
}
[SupportedOSPlatform("macos")]