GSdx-d3d11: Adjust DATE code, and remove rtCopy.

Remove DATE shader macro and bit.
Remove useless HasStencil case. If DATE is enabled stencil is also
enabled, this check is useless.
Remove leftover rt and rtCopy code case from d3d9.

Remove traces of rtCopy and sampler in slot 2.

rtcopy
This commit is contained in:
lightningterror 2018-12-20 01:19:36 +01:00
parent cdeacafd27
commit 63bbf52219
6 changed files with 49 additions and 88 deletions

View File

@ -1238,13 +1238,12 @@ void GSDevice11::PSSetShaderResourceView(int i, ID3D11ShaderResourceView* srv, G
}
}
void GSDevice11::PSSetSamplerState(ID3D11SamplerState* ss0, ID3D11SamplerState* ss1, ID3D11SamplerState* ss2)
void GSDevice11::PSSetSamplerState(ID3D11SamplerState* ss0, ID3D11SamplerState* ss1)
{
if(m_state.ps_ss[0] != ss0 || m_state.ps_ss[1] != ss1 || m_state.ps_ss[2] != ss2)
if(m_state.ps_ss[0] != ss0 || m_state.ps_ss[1] != ss1)
{
m_state.ps_ss[0] = ss0;
m_state.ps_ss[1] = ss1;
m_state.ps_ss[2] = ss2;
}
}

View File

@ -214,7 +214,7 @@ public:
void PSSetShaderResourceView(int i, ID3D11ShaderResourceView* srv, GSTexture* sr);
void PSSetShader(ID3D11PixelShader* ps, ID3D11Buffer* ps_cb);
void PSUpdateShaderState();
void PSSetSamplerState(ID3D11SamplerState* ss0, ID3D11SamplerState* ss1, ID3D11SamplerState* ss2 = NULL);
void PSSetSamplerState(ID3D11SamplerState* ss0, ID3D11SamplerState* ss1);
void OMSetDepthStencilState(ID3D11DepthStencilState* dss, uint8 sref);
void OMSetBlendState(ID3D11BlendState* bs, float bf);
void OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector4i* scissor = NULL);
@ -225,8 +225,6 @@ public:
void SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSelector ssel);
void SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uint8 afix);
bool HasStencil() { return true; }
ID3D11Device* operator->() {return m_dev;}
operator ID3D11Device*() {return m_dev;}
operator ID3D11DeviceContext*() {return m_ctx;}

View File

@ -103,19 +103,17 @@ void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
if(i == m_vs.end())
{
std::string str[4];
std::string str[3];
str[0] = format("%d", sel.bppz);
str[1] = format("%d", sel.tme);
str[2] = format("%d", sel.fst);
str[3] = format("%d", sel.rtcopy);
D3D_SHADER_MACRO macro[] =
{
{"VS_BPPZ", str[0].c_str()},
{"VS_TME", str[1].c_str()},
{"VS_FST", str[2].c_str()},
{"VS_RTCOPY", str[3].c_str()},
{NULL, NULL},
};
@ -209,7 +207,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
if(i == m_ps.end())
{
std::string str[27];
std::string str[26];
str[0] = format("%d", sel.fst);
str[1] = format("%d", sel.wms);
@ -225,19 +223,18 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
str[11] = format("%d", sel.aout);
str[12] = format("%d", sel.ltf);
str[13] = format("%d", sel.colclip);
str[14] = format("%d", sel.date);
str[15] = format("%d", sel.spritehack);
str[16] = format("%d", sel.tcoffsethack);
str[17] = format("%d", sel.point_sampler);
str[18] = format("%d", sel.shuffle);
str[19] = format("%d", sel.read_ba);
str[20] = format("%d", sel.channel);
str[21] = format("%d", sel.tales_of_abyss_hle);
str[22] = format("%d", sel.urban_chaos_hle);
str[23] = format("%d", sel.dfmt);
str[24] = format("%d", sel.depth_fmt);
str[25] = format("%d", sel.fmt >> 2);
str[26] = format("%d", m_upscale_multiplier);
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);
D3D_SHADER_MACRO macro[] =
{
@ -255,19 +252,18 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
{"PS_AOUT", str[11].c_str()},
{"PS_LTF", str[12].c_str()},
{"PS_COLCLIP", str[13].c_str()},
{"PS_DATE", str[14].c_str()},
{"PS_SPRITEHACK", str[15].c_str()},
{"PS_TCOFFSETHACK", str[16].c_str()},
{"PS_POINT_SAMPLER", str[17].c_str()},
{"PS_SHUFFLE", str[18].c_str() },
{"PS_READ_BA", str[19].c_str() },
{"PS_CHANNEL_FETCH", str[20].c_str() },
{"PS_TALES_OF_ABYSS_HLE", str[21].c_str() },
{"PS_URBAN_CHAOS_HLE", str[22].c_str() },
{"PS_DFMT", str[23].c_str() },
{"PS_DEPTH_FMT", str[24].c_str() },
{"PS_PAL_FMT", str[25].c_str() },
{"PS_SCALE_FACTOR", str[26].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() },
{NULL, NULL},
};
@ -332,7 +328,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
}
}
PSSetSamplerState(ss0, ss1, sel.date ? m_rt_ss : NULL);
PSSetSamplerState(ss0, ss1);
PSSetShader(i->second, m_ps_cb);
}

View File

@ -74,9 +74,8 @@ public:
uint32 bppz:2;
uint32 tme:1;
uint32 fst:1;
uint32 rtcopy:1;
uint32 _free:27;
uint32 _free:28;
};
uint32 key;
@ -188,7 +187,6 @@ public:
// Fog
uint32 fog:1;
// Pixel test
uint32 date:2;
uint32 atst:3;
// Color sampling
uint32 fst:1;
@ -204,7 +202,6 @@ public:
// *** Word 2
// Blend and Colclip
uint32 clr1:1;
uint32 rt:1;
uint32 colclip:2;
// Others ways to fetch the texture
@ -218,7 +215,7 @@ public:
uint32 tales_of_abyss_hle:1;
uint32 point_sampler:1;
uint32 _free:23;
uint32 _free:26;
};
uint64 key;
@ -339,8 +336,6 @@ public:
virtual void SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm) = 0;
virtual bool HasStencil() = 0;
static bool LoadD3DCompiler();
static void FreeD3DCompiler();

View File

@ -294,7 +294,6 @@ void GSRendererDX::EmulateTextureSampler(const GSTextureCache::Source* tex)
m_ps_sel.ltf = bilinear && shader_emulated_sampler;
m_ps_sel.rt = tex->m_target;
m_ps_sel.spritehack = tex->m_spritehack_t;
m_ps_sel.point_sampler = !bilinear || shader_emulated_sampler;
@ -339,8 +338,6 @@ void GSRendererDX::ResetStates()
void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* tex)
{
GSTexture* rtcopy = NULL;
const GSVector2i& rtsize = ds ? ds->GetSize() : rt->GetSize();
const GSVector2& rtscale = ds ? ds->GetScale() : rt->GetScale();
@ -458,8 +455,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
}
if (DATE)
{
if (dev->HasStencil())
{
GSVector4 s = GSVector4(rtscale.x / rtsize.x, rtscale.y / rtsize.y);
GSVector4 off = GSVector4(-1.0f, 1.0f);
@ -477,15 +472,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
dev->SetupDATE(rt, ds, vertices, m_context->TEST.DATM);
}
else
{
rtcopy = dev->CreateRenderTarget(rtsize.x, rtsize.y, false, rt->GetFormat());
// I'll use VertexTrace when I consider it more trustworthy
dev->CopyRect(rt, rtcopy, GSVector4i(rtsize).zwxy());
}
}
//
@ -499,7 +485,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
m_vs_sel.tme = PRIM->TME;
m_vs_sel.fst = PRIM->FST;
m_vs_sel.rtcopy = rtcopy != nullptr;
float sx = 2.0f * rtscale.x / (rtsize.x << 4);
float sy = 2.0f * rtscale.y / (rtsize.y << 4);
@ -538,8 +523,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
// ps
if (DATE)
{
if (dev->HasStencil())
{
m_om_dssel.date = 1;
if (DATE_one)
@ -547,11 +530,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
m_om_dssel.date_one = 1;
}
}
else
{
m_ps_sel.date = 1 + m_context->TEST.DATM;
}
}
bool colclip_wrap = m_env.COLCLAMP.CLAMP == 0 && !tex && PRIM->PRIM != GS_POINTLIST;
if (colclip_wrap)
@ -641,7 +619,7 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
// to only draw pixels which would cause the destination alpha test to fail in the future once.
// Unfortunately this also means only drawing those pixels at all, which is why this is a hack.
// The interaction with FBA in D3D9 is probably less than ideal.
if (UserHacks_AlphaStencil && DATE && !DATE_one && dev->HasStencil() && m_om_bsel.wa && !m_context->TEST.ATE)
if (UserHacks_AlphaStencil && DATE && !DATE_one && m_om_bsel.wa && !m_context->TEST.ATE)
{
// fprintf(stderr, "Alpha Stencil detected\n");
if (!m_context->FBA.FBA)
@ -694,7 +672,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
dev->OMSetRenderTargets(rt, ds, &scissor);
dev->PSSetShaderResource(0, tex ? tex->m_texture : NULL);
dev->PSSetShaderResource(1, tex ? tex->m_palette : NULL);
dev->PSSetShaderResource(2, rtcopy);
SetupIA(sx, sy);
@ -802,6 +779,4 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
}
dev->EndScene();
dev->Recycle(rtcopy);
}

View File

@ -519,8 +519,6 @@ public:
// Used by OpenGL, so the same calling convention is required.
static void APIENTRY DebugOutputToFile(GLenum gl_source, GLenum gl_type, GLuint id, GLenum gl_severity, GLsizei gl_length, const GLchar *gl_message, const void* userParam);
bool HasStencil() { return true; }
bool Create(const std::shared_ptr<GSWnd> &wnd);
bool Reset(int w, int h);
void Flip();