GSdx-d3d11: Remove colclip and negative blend algo.

Code was old and inefficient. HDR colclip will do a better job.
This commit is contained in:
lightningterror 2019-01-10 12:38:12 +01:00
parent 1b41d19016
commit 8a57d7f470
4 changed files with 27 additions and 102 deletions

View File

@ -207,7 +207,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
if(i == m_ps.end())
{
std::string str[26];
std::string str[25];
str[0] = format("%d", sel.fst);
str[1] = format("%d", sel.wms);
@ -222,19 +222,18 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
str[10] = format("%d", sel.fba);
str[11] = format("%d", sel.aout);
str[12] = format("%d", sel.ltf);
str[13] = format("%d", sel.colclip);
str[14] = format("%d", sel.spritehack);
str[15] = format("%d", sel.tcoffsethack);
str[16] = format("%d", sel.point_sampler);
str[17] = format("%d", sel.shuffle);
str[18] = format("%d", sel.read_ba);
str[19] = format("%d", sel.channel);
str[20] = format("%d", sel.tales_of_abyss_hle);
str[21] = format("%d", sel.urban_chaos_hle);
str[22] = format("%d", sel.dfmt);
str[23] = format("%d", sel.depth_fmt);
str[24] = format("%d", sel.fmt >> 2);
str[25] = format("%d", m_upscale_multiplier);
str[13] = format("%d", sel.spritehack);
str[14] = format("%d", sel.tcoffsethack);
str[15] = format("%d", sel.point_sampler);
str[16] = format("%d", sel.shuffle);
str[17] = format("%d", sel.read_ba);
str[18] = format("%d", sel.channel);
str[19] = format("%d", sel.tales_of_abyss_hle);
str[20] = format("%d", sel.urban_chaos_hle);
str[21] = format("%d", sel.dfmt);
str[22] = format("%d", sel.depth_fmt);
str[23] = format("%d", sel.fmt >> 2);
str[24] = format("%d", m_upscale_multiplier);
D3D_SHADER_MACRO macro[] =
{
@ -251,19 +250,18 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
{"PS_FBA", str[10].c_str()},
{"PS_AOUT", str[11].c_str()},
{"PS_LTF", str[12].c_str()},
{"PS_COLCLIP", str[13].c_str()},
{"PS_SPRITEHACK", str[14].c_str()},
{"PS_TCOFFSETHACK", str[15].c_str()},
{"PS_POINT_SAMPLER", str[16].c_str()},
{"PS_SHUFFLE", str[17].c_str() },
{"PS_READ_BA", str[18].c_str() },
{"PS_CHANNEL_FETCH", str[19].c_str() },
{"PS_TALES_OF_ABYSS_HLE", str[20].c_str() },
{"PS_URBAN_CHAOS_HLE", str[21].c_str() },
{"PS_DFMT", str[22].c_str() },
{"PS_DEPTH_FMT", str[23].c_str() },
{"PS_PAL_FMT", str[24].c_str() },
{"PS_SCALE_FACTOR", str[25].c_str() },
{"PS_SPRITEHACK", str[13].c_str()},
{"PS_TCOFFSETHACK", str[14].c_str()},
{"PS_POINT_SAMPLER", str[15].c_str()},
{"PS_SHUFFLE", str[16].c_str() },
{"PS_READ_BA", str[17].c_str() },
{"PS_CHANNEL_FETCH", str[18].c_str() },
{"PS_TALES_OF_ABYSS_HLE", str[19].c_str() },
{"PS_URBAN_CHAOS_HLE", str[20].c_str() },
{"PS_DFMT", str[21].c_str() },
{"PS_DEPTH_FMT", str[22].c_str() },
{"PS_PAL_FMT", str[23].c_str() },
{"PS_SCALE_FACTOR", str[24].c_str() },
{NULL, NULL},
};
@ -404,22 +402,6 @@ void GSDevice11::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uin
bd.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
bd.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
bd.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
// Not very good but I don't wanna write another 81 row table
if(bsel.negative)
{
if(bd.RenderTarget[0].BlendOp == D3D11_BLEND_OP_ADD)
{
bd.RenderTarget[0].BlendOp = D3D11_BLEND_OP_REV_SUBTRACT;
}
else if(bd.RenderTarget[0].BlendOp == D3D11_BLEND_OP_REV_SUBTRACT)
{
bd.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
}
else
; // god knows, best just not to mess with it for now
}
}
if(bsel.wr) bd.RenderTarget[0].RenderTargetWriteMask |= D3D11_COLOR_WRITE_ENABLE_RED;

View File

@ -202,7 +202,6 @@ public:
// *** Word 2
// Blend and Colclip
uint32 clr1:1;
uint32 colclip:2;
// Others ways to fetch the texture
uint32 channel:3;
@ -215,7 +214,7 @@ public:
uint32 tales_of_abyss_hle:1;
uint32 point_sampler:1;
uint32 _free:26;
uint32 _free:28;
};
uint64 key;
@ -281,7 +280,6 @@ public:
uint32 wg:1;
uint32 wb:1;
uint32 wa:1;
uint32 negative:1;
};
struct
@ -294,7 +292,7 @@ public:
uint32 key;
};
operator uint32() {return key & 0x3fff;}
operator uint32() {return key & 0x1fff;}
OMBlendSelector() : key(0) {}

View File

@ -538,21 +538,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
}
}
bool colclip_wrap = m_env.COLCLAMP.CLAMP == 0 && !tex && PRIM->PRIM != GS_POINTLIST;
if (colclip_wrap)
{
if ((m_context->ALPHA.A == m_context->ALPHA.B) || !m_om_bsel.abe) // Optimize-away colclip
{
// No addition neither substraction so no risk of overflow the [0:255] range.
colclip_wrap = false;
}
else
{
m_ps_sel.colclip = 1;
// fprintf(stderr, "COLCLIP ENABLED (blending is %d/%d/%d/%d)\n", m_context->ALPHA.A, m_context->ALPHA.B, m_context->ALPHA.C, m_context->ALPHA.D);
}
}
m_ps_sel.clr1 = m_om_bsel.IsCLR1();
m_ps_sel.fba = m_context->FBA.FBA;
@ -691,21 +676,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
if (ate_first_pass)
{
dev->DrawIndexedPrimitive();
if (colclip_wrap)
{
GSDeviceDX::OMBlendSelector om_bselneg(m_om_bsel);
GSDeviceDX::PSSelector ps_selneg(m_ps_sel);
om_bselneg.negative = 1;
ps_selneg.colclip = 2;
dev->SetupOM(m_om_dssel, om_bselneg, afix);
dev->SetupPS(ps_selneg, &ps_cb, m_ps_ssel);
dev->DrawIndexedPrimitive();
dev->SetupOM(m_om_dssel, m_om_bsel, afix);
}
}
if (ate_second_pass)
@ -767,20 +737,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
dev->SetupOM(m_om_dssel, m_om_bsel, afix);
dev->DrawIndexedPrimitive();
if (colclip_wrap)
{
GSDeviceDX::OMBlendSelector om_bselneg(m_om_bsel);
GSDeviceDX::PSSelector ps_selneg(m_ps_sel);
om_bselneg.negative = 1;
ps_selneg.colclip = 2;
dev->SetupOM(m_om_dssel, om_bselneg, afix);
dev->SetupPS(ps_selneg, &ps_cb, m_ps_ssel);
dev->DrawIndexedPrimitive();
}
}
}

View File

@ -31,7 +31,6 @@
#define PS_FBA 0
#define PS_AOUT 0
#define PS_LTF 1
#define PS_COLCLIP 0
#define PS_SPRITEHACK 0
#define PS_TCOFFSETHACK 0
#define PS_POINT_SAMPLER 0
@ -635,16 +634,6 @@ float4 ps_color(PS_INPUT input)
c = fog(c, input.t.z);
// FIXME: Colclip and Depth sampling shouldn't run together.
if (PS_COLCLIP == 2)
{
c.rgb = 256./255. - c.rgb;
}
if (PS_COLCLIP > 0)
{
c.rgb *= c.rgb < 128./255;
}
if(PS_CLR1) // needed for Cd * (As/Ad/F + 1) blending modes
{
c.rgb = 1;