gsdx-d3d11: Move shader/sample state set to it's own function

This commit is contained in:
Kojin 2018-12-16 03:51:00 -05:00 committed by lightningterror
parent 84dbdd6b18
commit 554b797b92
2 changed files with 9 additions and 19 deletions

View File

@ -1216,8 +1216,6 @@ void GSDevice11::PSSetShaderResourceView(int i, ID3D11ShaderResourceView* srv, G
{
m_state.ps_sr_views[i] = srv;
m_state.ps_sr_texture[i] = (GSTexture11*)sr;
m_srv_changed = true;
}
}
@ -1228,8 +1226,6 @@ void GSDevice11::PSSetSamplerState(ID3D11SamplerState* ss0, ID3D11SamplerState*
m_state.ps_ss[0] = ss0;
m_state.ps_ss[1] = ss1;
m_state.ps_ss[2] = ss2;
m_ss_changed = true;
}
}
@ -1242,26 +1238,20 @@ void GSDevice11::PSSetShader(ID3D11PixelShader* ps, ID3D11Buffer* ps_cb)
m_ctx->PSSetShader(ps, NULL, 0);
}
if(m_srv_changed)
{
m_ctx->PSSetShaderResources(0, m_state.ps_sr_views.size(), m_state.ps_sr_views.data());
m_srv_changed = false;
}
if(m_ss_changed)
{
m_ctx->PSSetSamplers(0, countof(m_state.ps_ss), m_state.ps_ss);
m_ss_changed = false;
}
if(m_state.ps_cb != ps_cb)
{
m_state.ps_cb = ps_cb;
m_ctx->PSSetConstantBuffers(0, 1, &ps_cb);
}
PSUpdateShaderState();
}
void GSDevice11::PSUpdateShaderState()
{
m_ctx->PSSetShaderResources(0, m_state.ps_sr_views.size(), m_state.ps_sr_views.data());
m_ctx->PSSetSamplers(0, countof(m_state.ps_ss), m_state.ps_ss);
}
void GSDevice11::OMSetDepthStencilState(ID3D11DepthStencilState* dss, uint8 sref)

View File

@ -53,7 +53,6 @@ class GSDevice11 : public GSDeviceDX
CComPtr<ID3D11Buffer> m_ib;
CComPtr<ID3D11Buffer> m_ib_old;
bool m_srv_changed, m_ss_changed;
float m_hack_topleft_offset;
int m_mipmap;
@ -214,6 +213,7 @@ public:
void PSSetShaderResource(int i, GSTexture* sr);
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 OMSetDepthStencilState(ID3D11DepthStencilState* dss, uint8 sref);
void OMSetBlendState(ID3D11BlendState* bs, float bf);