gsdx-d3d11: ICO depth HLE

Game reads framebuffer depth as alpha of texture.
However, this is a problem for d3d11 as a shader read on the fb is not allowed.

So let's handle it in a similar fasion to channel shuffle:
- Set depth to slot 4
- Detect when slot 4 matches depth rt
- Copy and send the copy to the shader
This commit is contained in:
Kojin 2019-01-20 01:19:59 -05:00 committed by lightningterror
parent 468b9ded46
commit 8c8b1f497c
1 changed files with 19 additions and 3 deletions

View File

@ -948,9 +948,25 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
{
// Note potentially we can limit to TBP0:0x2800
// DX doesn't support depth or channel shuffle yet so we can just do a partial port that skips the bad drawcalls,
// this way we can purge any remaining crc hacks.
throw GSDXRecoverableError();
// Depth buffer was moved so GSdx will invalide it which means a
// downscale. ICO uses the MSB depth bits as the texture alpha
// channel. However this depth of field effect requires
// texel:pixel mapping accuracy.
//
// Use an HLE shader to sample depth directly as the alpha channel
// OutputDebugString("ICO HLE");
m_ps_sel.depth_fmt = 1;
m_ps_sel.channel = ChannelFetch_BLUE;
dev->PSSetShaderResource(4, ds);
if (!tex->m_palette)
{
uint16 pal = GSLocalMemory::m_psm[tex->m_TEX0.PSM].pal;
m_tc->AttachPaletteToSource(tex, pal, true);
}
}
}