GS-hw: Rename clr_hw to blend_hw PSSampler bit.

This commit is contained in:
lightningterror 2023-03-10 10:48:17 +01:00
parent 62497b9300
commit a6c372de46
7 changed files with 19 additions and 19 deletions

View File

@ -328,7 +328,7 @@ struct alignas(16) GSHWDrawConfig
u32 blend_c : 2; u32 blend_c : 2;
u32 blend_d : 2; u32 blend_d : 2;
u32 fixed_one_a : 1; u32 fixed_one_a : 1;
u32 clr_hw : 3; u32 blend_hw : 3;
u32 hdr : 1; u32 hdr : 1;
u32 colclip : 1; u32 colclip : 1;
u32 blend_mix : 2; u32 blend_mix : 2;

View File

@ -152,7 +152,7 @@ void GSDevice11::SetupPS(const PSSelector& sel, const GSHWDrawConfig::PSConstant
sm.AddMacro("PS_ATST", sel.atst); sm.AddMacro("PS_ATST", sel.atst);
sm.AddMacro("PS_FOG", sel.fog); sm.AddMacro("PS_FOG", sel.fog);
sm.AddMacro("PS_IIP", sel.iip); sm.AddMacro("PS_IIP", sel.iip);
sm.AddMacro("PS_BLEND_HW", sel.clr_hw); sm.AddMacro("PS_BLEND_HW", sel.blend_hw);
sm.AddMacro("PS_FBA", sel.fba); sm.AddMacro("PS_FBA", sel.fba);
sm.AddMacro("PS_FBMASK", sel.fbmask); sm.AddMacro("PS_FBMASK", sel.fbmask);
sm.AddMacro("PS_LTF", sel.ltf); sm.AddMacro("PS_LTF", sel.ltf);

View File

@ -1613,7 +1613,7 @@ const ID3DBlob* GSDevice12::GetTFXPixelShader(const GSHWDrawConfig::PSSelector&
sm.AddMacro("PS_ATST", sel.atst); sm.AddMacro("PS_ATST", sel.atst);
sm.AddMacro("PS_FOG", sel.fog); sm.AddMacro("PS_FOG", sel.fog);
sm.AddMacro("PS_IIP", sel.iip); sm.AddMacro("PS_IIP", sel.iip);
sm.AddMacro("PS_BLEND_HW", sel.clr_hw); sm.AddMacro("PS_BLEND_HW", sel.blend_hw);
sm.AddMacro("PS_FBA", sel.fba); sm.AddMacro("PS_FBA", sel.fba);
sm.AddMacro("PS_FBMASK", sel.fbmask); sm.AddMacro("PS_FBMASK", sel.fbmask);
sm.AddMacro("PS_LTF", sel.ltf); sm.AddMacro("PS_LTF", sel.ltf);

View File

@ -3125,8 +3125,8 @@ void GSRendererHW::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER, bool&
// As - 1 or F - 1 subtraction is only done for the dual source output (hw blending part) since we are changing the equation. // As - 1 or F - 1 subtraction is only done for the dual source output (hw blending part) since we are changing the equation.
// Af will be replaced with As in shader and send it to dual source output. // Af will be replaced with As in shader and send it to dual source output.
m_conf.blend = {true, GSDevice::CONST_ONE, GSDevice::SRC1_COLOR, GSDevice::OP_SUBTRACT, false, 0}; m_conf.blend = {true, GSDevice::CONST_ONE, GSDevice::SRC1_COLOR, GSDevice::OP_SUBTRACT, false, 0};
// clr_hw 1 will disable alpha clamp, we can reuse the old bits. // blend hw 1 will disable alpha clamp, we can reuse the old bits.
m_conf.ps.clr_hw = 1; m_conf.ps.blend_hw = 1;
// DSB output will always be used. // DSB output will always be used.
m_conf.ps.no_color1 = false; m_conf.ps.no_color1 = false;
} }
@ -3134,7 +3134,7 @@ void GSRendererHW::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER, bool&
{ {
// Compensate slightly for Cd*(As + 1) - Cs*As. // Compensate slightly for Cd*(As + 1) - Cs*As.
// Try to compensate a bit with subtracting 1 (0.00392) * (Alpha + 1) from Cs. // Try to compensate a bit with subtracting 1 (0.00392) * (Alpha + 1) from Cs.
m_conf.ps.clr_hw = blend_ad_alpha_masked ? 4 : 2; m_conf.ps.blend_hw = blend_ad_alpha_masked ? 4 : 2;
} }
m_conf.ps.blend_a = 0; m_conf.ps.blend_a = 0;
@ -3146,7 +3146,7 @@ void GSRendererHW::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER, bool&
// Allow to compensate when Cs*(Alpha + 1) overflows, to compensate we change // Allow to compensate when Cs*(Alpha + 1) overflows, to compensate we change
// the alpha output value for Cd*Alpha. // the alpha output value for Cd*Alpha.
m_conf.blend = {true, GSDevice::CONST_ONE, GSDevice::SRC1_COLOR, blend.op, false, 0}; m_conf.blend = {true, GSDevice::CONST_ONE, GSDevice::SRC1_COLOR, blend.op, false, 0};
m_conf.ps.clr_hw = blend_ad_alpha_masked ? 5 : 3; m_conf.ps.blend_hw = blend_ad_alpha_masked ? 5 : 3;
m_conf.ps.no_color1 = false; m_conf.ps.no_color1 = false;
m_conf.ps.blend_a = 0; m_conf.ps.blend_a = 0;
@ -3166,8 +3166,8 @@ void GSRendererHW::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER, bool&
m_conf.require_one_barrier |= true; m_conf.require_one_barrier |= true;
// Swap Ad with As for hw blend // Swap Ad with As for hw blend
// Check if blend mix 1 or 2 already enabled clr // Check if blend mix 1 or 2 already enabled clr
if (m_conf.ps.clr_hw == 0) if (m_conf.ps.blend_hw == 0)
m_conf.ps.clr_hw = 6; m_conf.ps.blend_hw = 6;
} }
} }
else else
@ -3194,35 +3194,35 @@ void GSRendererHW::EmulateBlending(bool& DATE_PRIMID, bool& DATE_BARRIER, bool&
m_conf.ps.blend_b = 0; m_conf.ps.blend_b = 0;
m_conf.ps.blend_d = 0; m_conf.ps.blend_d = 0;
// Care for clr_hw value, 6 is for hw/sw, sw blending used. // Care for hw blend value, 6 is for hw/sw, sw blending used.
if (blend_flag & BLEND_C_CLR1) if (blend_flag & BLEND_C_CLR1)
{ {
if (blend_ad_alpha_masked) if (blend_ad_alpha_masked)
m_conf.ps.clr_hw = 5; m_conf.ps.blend_hw = 5;
else else
m_conf.ps.clr_hw = 1; m_conf.ps.blend_hw = 1;
} }
else if (blend_flag & (BLEND_C_CLR2_AS | BLEND_C_CLR2_AF)) else if (blend_flag & (BLEND_C_CLR2_AS | BLEND_C_CLR2_AF))
{ {
if (blend_ad_alpha_masked) if (blend_ad_alpha_masked)
{ {
m_conf.ps.clr_hw = 4; m_conf.ps.blend_hw = 4;
} }
else else
{ {
if (m_conf.ps.blend_c == 2) if (m_conf.ps.blend_c == 2)
m_conf.cb_ps.TA_MaxDepth_Af.a = static_cast<float>(AFIX) / 128.0f; m_conf.cb_ps.TA_MaxDepth_Af.a = static_cast<float>(AFIX) / 128.0f;
m_conf.ps.clr_hw = 2; m_conf.ps.blend_hw = 2;
} }
} }
else if (blend_flag & BLEND_C_CLR3) else if (blend_flag & BLEND_C_CLR3)
{ {
m_conf.ps.clr_hw = 3; m_conf.ps.blend_hw = 3;
} }
else if (blend_ad_alpha_masked) else if (blend_ad_alpha_masked)
{ {
m_conf.ps.clr_hw = 6; m_conf.ps.blend_hw = 6;
} }
m_conf.require_one_barrier |= blend_ad_alpha_masked; m_conf.require_one_barrier |= blend_ad_alpha_masked;

View File

@ -1387,7 +1387,7 @@ void GSDeviceMTL::MRESetHWPipelineState(GSHWDrawConfig::VSSelector vssel, GSHWDr
setFnConstantI(m_fn_constants, pssel.blend_b, GSMTLConstantIndex_PS_BLEND_B); setFnConstantI(m_fn_constants, pssel.blend_b, GSMTLConstantIndex_PS_BLEND_B);
setFnConstantI(m_fn_constants, pssel.blend_c, GSMTLConstantIndex_PS_BLEND_C); setFnConstantI(m_fn_constants, pssel.blend_c, GSMTLConstantIndex_PS_BLEND_C);
setFnConstantI(m_fn_constants, pssel.blend_d, GSMTLConstantIndex_PS_BLEND_D); setFnConstantI(m_fn_constants, pssel.blend_d, GSMTLConstantIndex_PS_BLEND_D);
setFnConstantI(m_fn_constants, pssel.clr_hw, GSMTLConstantIndex_PS_BLEND_HW); setFnConstantI(m_fn_constants, pssel.blend_hw, GSMTLConstantIndex_PS_BLEND_HW);
setFnConstantB(m_fn_constants, pssel.hdr, GSMTLConstantIndex_PS_HDR); setFnConstantB(m_fn_constants, pssel.hdr, GSMTLConstantIndex_PS_HDR);
setFnConstantB(m_fn_constants, pssel.colclip, GSMTLConstantIndex_PS_COLCLIP); setFnConstantB(m_fn_constants, pssel.colclip, GSMTLConstantIndex_PS_COLCLIP);
setFnConstantI(m_fn_constants, pssel.blend_mix, GSMTLConstantIndex_PS_BLEND_MIX); setFnConstantI(m_fn_constants, pssel.blend_mix, GSMTLConstantIndex_PS_BLEND_MIX);

View File

@ -1044,7 +1044,7 @@ std::string GSDeviceOGL::GetPSSource(const PSSelector& sel)
+ fmt::format("#define PS_TCC {}\n", sel.tcc) + fmt::format("#define PS_TCC {}\n", sel.tcc)
+ fmt::format("#define PS_ATST {}\n", sel.atst) + fmt::format("#define PS_ATST {}\n", sel.atst)
+ fmt::format("#define PS_FOG {}\n", sel.fog) + fmt::format("#define PS_FOG {}\n", sel.fog)
+ fmt::format("#define PS_BLEND_HW {}\n", sel.clr_hw) + fmt::format("#define PS_BLEND_HW {}\n", sel.blend_hw)
+ fmt::format("#define PS_FBA {}\n", sel.fba) + fmt::format("#define PS_FBA {}\n", sel.fba)
+ fmt::format("#define PS_LTF {}\n", sel.ltf) + fmt::format("#define PS_LTF {}\n", sel.ltf)
+ fmt::format("#define PS_AUTOMATIC_LOD {}\n", sel.automatic_lod) + fmt::format("#define PS_AUTOMATIC_LOD {}\n", sel.automatic_lod)

View File

@ -2076,7 +2076,7 @@ VkShaderModule GSDeviceVK::GetTFXFragmentShader(const GSHWDrawConfig::PSSelector
AddMacro(ss, "PS_TCC", sel.tcc); AddMacro(ss, "PS_TCC", sel.tcc);
AddMacro(ss, "PS_ATST", sel.atst); AddMacro(ss, "PS_ATST", sel.atst);
AddMacro(ss, "PS_FOG", sel.fog); AddMacro(ss, "PS_FOG", sel.fog);
AddMacro(ss, "PS_BLEND_HW", sel.clr_hw); AddMacro(ss, "PS_BLEND_HW", sel.blend_hw);
AddMacro(ss, "PS_FBA", sel.fba); AddMacro(ss, "PS_FBA", sel.fba);
AddMacro(ss, "PS_LTF", sel.ltf); AddMacro(ss, "PS_LTF", sel.ltf);
AddMacro(ss, "PS_AUTOMATIC_LOD", sel.automatic_lod); AddMacro(ss, "PS_AUTOMATIC_LOD", sel.automatic_lod);