GS:MTL: Disable blending when color isn't written

Can come up in two-pass alpha, and Metal doesn't like it if blending uses SRC1 and your shader doesn't output it
This commit is contained in:
TellowKrinkle 2022-05-05 22:26:23 -05:00 committed by refractionpcsx2
parent 3a97688804
commit bd3e1299a3
1 changed files with 3 additions and 1 deletions

View File

@ -1129,6 +1129,8 @@ static MTLBlendOperation ConvertBlendOp(GSDevice::BlendOp generic)
}
}
static constexpr MTLColorWriteMask MTLColorWriteMaskRGB = MTLColorWriteMaskRed | MTLColorWriteMaskGreen | MTLColorWriteMaskBlue;
void GSDeviceMTL::MRESetHWPipelineState(GSHWDrawConfig::VSSelector vssel, GSHWDrawConfig::PSSelector pssel, GSHWDrawConfig::BlendState blend, GSHWDrawConfig::ColorMaskSelector cms)
{
PipelineSelectorExtrasMTL extras(blend, m_current_render.color_target, cms, m_current_render.depth_target, m_current_render.stencil_target);
@ -1224,7 +1226,7 @@ void GSDeviceMTL::MRESetHWPipelineState(GSHWDrawConfig::VSSelector vssel, GSHWDr
color.sourceRGBBlendFactor = MTLBlendFactorOne;
color.destinationRGBBlendFactor = MTLBlendFactorOne;
}
else if (extras.blend_enable)
else if (extras.blend_enable && (extras.writemask & MTLColorWriteMaskRGB))
{
color.blendingEnabled = YES;
color.rgbBlendOperation = ConvertBlendOp(extras.blend_op);