diff --git a/plugins/GSdx/Renderers/DX11/GSDevice11.cpp b/plugins/GSdx/Renderers/DX11/GSDevice11.cpp index 6f5074af71..196120aa2a 100644 --- a/plugins/GSdx/Renderers/DX11/GSDevice11.cpp +++ b/plugins/GSdx/Renderers/DX11/GSDevice11.cpp @@ -1181,7 +1181,7 @@ void GSDevice11::PSSetShaderResources(GSTexture* sr0, GSTexture* sr1) PSSetShaderResource(0, sr0); PSSetShaderResource(1, sr1); - for(size_t i = 2; i < countof(m_state.ps_srv); i++) + for(size_t i = 2; i < m_state.ps_sr_views.size(); i++) { PSSetShaderResource(i, NULL); } @@ -1193,16 +1193,17 @@ void GSDevice11::PSSetShaderResource(int i, GSTexture* sr) if(sr) srv = *(GSTexture11*)sr; - PSSetShaderResourceView(i, srv); + PSSetShaderResourceView(i, srv, sr); } -void GSDevice11::PSSetShaderResourceView(int i, ID3D11ShaderResourceView* srv) +void GSDevice11::PSSetShaderResourceView(int i, ID3D11ShaderResourceView* srv, GSTexture* sr) { - ASSERT(i < countof(m_state.ps_srv)); + ASSERT(i < m_state.ps_sr_views.size()); - if(m_state.ps_srv[i] != srv) + if(m_state.ps_sr_views[i] != srv) { - m_state.ps_srv[i] = srv; + m_state.ps_sr_views[i] = srv; + m_state.ps_sr_texture[i] = (GSTexture11*)sr; m_srv_changed = true; } @@ -1231,7 +1232,7 @@ void GSDevice11::PSSetShader(ID3D11PixelShader* ps, ID3D11Buffer* ps_cb) if(m_srv_changed) { - m_ctx->PSSetShaderResources(0, countof(m_state.ps_srv), m_state.ps_srv); + m_ctx->PSSetShaderResources(0, m_state.ps_sr_views.size(), m_state.ps_sr_views.data()); m_srv_changed = false; } diff --git a/plugins/GSdx/Renderers/DX11/GSDevice11.h b/plugins/GSdx/Renderers/DX11/GSDevice11.h index c8ebfdc331..6d50d76a93 100644 --- a/plugins/GSdx/Renderers/DX11/GSDevice11.h +++ b/plugins/GSdx/Renderers/DX11/GSDevice11.h @@ -69,7 +69,8 @@ class GSDevice11 : public GSDeviceDX ID3D11Buffer* vs_cb; ID3D11GeometryShader* gs; ID3D11Buffer* gs_cb; - ID3D11ShaderResourceView* ps_srv[16]; + std::array ps_sr_views; + std::array ps_sr_texture; ID3D11PixelShader* ps; ID3D11Buffer* ps_cb; ID3D11SamplerState* ps_ss[3]; @@ -209,7 +210,7 @@ public: void GSSetShader(ID3D11GeometryShader* gs, ID3D11Buffer* gs_cb = NULL); void PSSetShaderResources(GSTexture* sr0, GSTexture* sr1); void PSSetShaderResource(int i, GSTexture* sr); - void PSSetShaderResourceView(int i, ID3D11ShaderResourceView* srv); + void PSSetShaderResourceView(int i, ID3D11ShaderResourceView* srv, GSTexture* sr); void PSSetShader(ID3D11PixelShader* ps, ID3D11Buffer* ps_cb); void PSSetSamplerState(ID3D11SamplerState* ss0, ID3D11SamplerState* ss1, ID3D11SamplerState* ss2 = NULL); void OMSetDepthStencilState(ID3D11DepthStencilState* dss, uint8 sref);