GSdx-d3d: Move Selector reset states in to a separate function.

Also move vs_sel def in header file and rename it using the member name.

Code is easier to read/move/adjust similar to GL.
This commit is contained in:
lightningterror 2018-09-14 15:43:24 +02:00
parent f40c1de919
commit 577bfaa8cd
2 changed files with 24 additions and 21 deletions

View File

@ -329,6 +329,17 @@ void GSRendererDX::EmulateTextureSampler(const GSTextureCache::Source* tex)
m_ps_ssel.ltf = bilinear && !shader_emulated_sampler;
}
void GSRendererDX::ResetStates()
{
m_vs_sel.key = 0;
m_gs_sel.key = 0;
m_ps_sel.key = 0;
m_ps_ssel.key = 0;
om_bsel.key = 0;
om_dssel.key = 0;
}
void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* tex)
{
const GSVector2i& rtsize = ds ? ds->GetSize() : rt->GetSize();
@ -339,8 +350,7 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
bool ate_first_pass = m_context->TEST.DoFirstPass();
bool ate_second_pass = m_context->TEST.DoSecondPass();
m_gs_sel.key = 0;
ResetStates();
vs_cb.Texture_Scale_Offset = GSVector4(0.0f);
GSTexture* rtcopy = NULL;
@ -390,8 +400,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
// om
om_dssel.key = 0;
EmulateZbuffer();
if (m_fba)
@ -399,8 +407,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
om_dssel.fba = m_context->FBA.FBA;
}
om_bsel.key = 0;
if (!IsOpaque())
{
om_bsel.abe = PRIM->ABE || PRIM->AA1 && m_vt.m_primclass == GS_LINE_CLASS;
@ -429,12 +435,10 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
// vs
GSDeviceDX::VSSelector vs_sel;
vs_sel.tme = PRIM->TME;
vs_sel.fst = PRIM->FST;
vs_sel.logz = dev->HasDepth32() ? 0 : m_logz ? 1 : 0;
vs_sel.rtcopy = !!rtcopy;
m_vs_sel.tme = PRIM->TME;
m_vs_sel.fst = PRIM->FST;
m_vs_sel.logz = !dev->HasDepth32() && m_logz;
m_vs_sel.rtcopy = rtcopy != nullptr;
float sx = 2.0f * rtscale.x / (rtsize.x << 4);
float sy = 2.0f * rtscale.y / (rtsize.y << 4);
@ -469,9 +473,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
// ps
m_ps_sel.key = 0;
m_ps_ssel.key = 0;
EmulateTextureShuffleAndFbmask();
if(DATE)
@ -591,7 +592,7 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
SetupIA(sx, sy);
dev->SetupOM(om_dssel, om_bsel, afix);
dev->SetupVS(vs_sel, &vs_cb);
dev->SetupVS(m_vs_sel, &vs_cb);
dev->SetupGS(m_gs_sel, &gs_cb);
dev->SetupPS(m_ps_sel, &ps_cb, m_ps_ssel);

View File

@ -34,6 +34,7 @@ class GSRendererDX : public GSRendererHW
bool UserHacks_AlphaStencil;
protected:
void ResetStates();
void EmulateAtst(const int pass, const GSTextureCache::Source* tex);
void EmulateZbuffer();
void EmulateChannelShuffle(GSTexture** rt, const GSTextureCache::Source* tex);
@ -54,12 +55,13 @@ protected:
GSDeviceDX* dev;
GSDeviceDX::OMDepthStencilSelector om_dssel;
GSDeviceDX::OMBlendSelector om_bsel;
GSDeviceDX::PSSelector m_ps_sel;
GSDeviceDX::PSSamplerSelector m_ps_ssel;
GSDeviceDX::VSSelector m_vs_sel;
GSDeviceDX::GSSelector m_gs_sel;
GSDeviceDX::PSSelector m_ps_sel;
GSDeviceDX::PSSamplerSelector m_ps_ssel;
GSDeviceDX::OMBlendSelector om_bsel;
GSDeviceDX::OMDepthStencilSelector om_dssel;
GSDeviceDX::PSConstantBuffer ps_cb;
GSDeviceDX::VSConstantBuffer vs_cb;