GSdx-d3d: Partial port of the ICO HLE workaround.

We can't do a full port because channel shuffle and depth sampling need
to be ported to d3d but at the very least we can do a partial port that
skips the bad draw calls.
This way we can remove all the remaining crc hacks for ICO in GSHwHacks.
This commit is contained in:
lightningterror 2018-10-18 11:04:43 +02:00
parent 6ab47c934d
commit 5ef53b4587
3 changed files with 18 additions and 34 deletions

View File

@ -1210,37 +1210,6 @@ bool GSC_DeathByDegreesTekkenNinaWilliams(const GSFrameInfo& fi, int& skip)
return true;
}
bool GSC_ICO(const GSFrameInfo& fi, int& skip)
{
if(skip == 0)
{
if(Aggressive && fi.TME && fi.FBP == 0x00800 && fi.FPSM == PSM_PSMCT32 && fi.TBP0 == 0x03d00 && fi.TPSM == PSM_PSMCT32)
{
// Removes shadows, shadows can be a little misaligned when upscaled. HPO fixes the issue.
// Can be used as a speed hack.
skip = 3;
}
else if(fi.TME && fi.FBP == 0x00800 && fi.FPSM == PSM_PSMCT32 && fi.TBP0 == 0x02800 && fi.TPSM == PSM_PSMT8H)
{
// Depth effects.
skip = 1;
}
else if(Aggressive && fi.TME && fi.FBP == 0x0800 && (fi.TBP0 == 0x2800 || fi.TBP0 ==0x2c00) && fi.TPSM ==0 && fi.FBMSK == 0)
{
skip = 1;
}
}
else
{
if(fi.TME && fi.TBP0 == 0x00800 && fi.TPSM == PSM_PSMCT32)
{
skip = 0;
}
}
return true;
}
bool GSC_StarWarsBattlefront(const GSFrameInfo& fi, int& skip)
{
if(skip == 0)
@ -2253,7 +2222,6 @@ void GSState::SetupCrcHack()
lut[CRC::FrontMission5] = GSC_FrontMission5;
lut[CRC::GodOfWar2] = GSC_GodOfWar2;
lut[CRC::HeavyMetalThunder] = GSC_HeavyMetalThunder;
lut[CRC::ICO] = GSC_ICO;
lut[CRC::LordOfTheRingsTwoTowers] = GSC_LordOfTheRingsTwoTowers;
lut[CRC::Okami] = GSC_Okami;
lut[CRC::SoulCalibur2] = GSC_SoulCaliburGames;

View File

@ -650,8 +650,24 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
m_ps_sel.tfx = 4;
}
// rs
if (m_game.title == CRC::ICO)
{
GSVertex* v = &m_vertex.buff[0];
const GSVideoMode mode = GetVideoMode();
if (tex && m_vt.m_primclass == GS_SPRITE_CLASS && m_vertex.next == 2 && PRIM->ABE && // Blend texture
((v[1].U == 8200 && v[1].V == 7176 && mode == GSVideoMode::NTSC) || // at display resolution 512x448
(v[1].U == 8200 && v[1].V == 8200 && mode == GSVideoMode::PAL)) && // at display resolution 512x512
tex->m_TEX0.PSM == PSM_PSMT8H) // i.e. read the alpha channel of a 32 bits texture
{
// 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();
}
}
// rs
GSVector4i scissor = GSVector4i(GSVector4(rtscale).xyxy() * m_context->scissor.in).rintersect(GSVector4i(rtsize).zwxy());
dev->OMSetRenderTargets(rt, ds, &scissor);

View File

@ -1312,7 +1312,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
// 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 accuraccy.
// texel:pixel mapping accuracy.
//
// Use an HLE shader to sample depth directly as the alpha channel
GL_INS("ICO sample depth as alpha");