Skip to content

Commit

Permalink
gsdx-d3d11: Copy render target when it matches texture in slot 4
Browse files Browse the repository at this point in the history
Needed for channel shuffle, this copies the render target when it's
the same as the resource texture bound on slot 4.
  • Loading branch information
tadanokojin committed Dec 16, 2018
1 parent 3330306 commit e448e17
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion plugins/GSdx/Renderers/DX11/GSDevice11.cpp
Expand Up @@ -479,7 +479,26 @@ void GSDevice11::DrawPrimitive()

void GSDevice11::DrawIndexedPrimitive()
{
m_ctx->DrawIndexed(m_index.count, m_index.start, m_vertex.start);
// DX can't read from the FB
// So let's copy it and set that as the shader
// resource for slot 4 to avoid issues.
if (m_state.ps_sr_texture[4] && m_state.ps_sr_texture[4]->Equal(m_state.rt_texture))
{
//fprintf(stdout, "FB read detected on slot 4: copying fb...\n");

GSTexture *cp = CopyRenderTarget(m_state.rt_texture);

PSSetShaderResource(4, cp);
PSUpdateShaderState();

m_ctx->DrawIndexed(m_index.count, m_index.start, m_vertex.start);

Recycle(cp);
}
else
{
m_ctx->DrawIndexed(m_index.count, m_index.start, m_vertex.start);
}
}

void GSDevice11::DrawIndexedPrimitive(int offset, int count)
Expand Down

0 comments on commit e448e17

Please sign in to comment.