GSdx-hw: use CanUseSwSpriteRender in OI_JakGames. (#3463)

In GSRendererHW, reuse the method CanUseSwSpriteRender for OI_JakGames.

As in current master, 16x16 "flat" sprite draws are performed via CPU: those are palette rendering better emulated with the SwSpriteRender.

Jak games do also many 64x64 "flat" draws, but mostly for render to texture effects that are already correctly emulated in the TC, so those draws are not done via CPU (as on the contrary happens for DBZ BT games).
This commit is contained in:
iMineLink 2020-06-20 20:22:27 +02:00 committed by GitHub
parent e2c472baa9
commit 1426dc1fc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 51 deletions

View File

@ -2193,60 +2193,13 @@ bool GSRendererHW::OI_ItadakiStreet(GSTexture* rt, GSTexture* ds, GSTextureCache
bool GSRendererHW::OI_JakGames(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t) bool GSRendererHW::OI_JakGames(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* t)
{ {
GSVector4i r = GSVector4i(m_vt.m_min.p.xyxy(m_vt.m_max.p)).rintersect(GSVector4i(m_context->scissor.in)); if (!CanUseSwSpriteRender(false))
GSVector4i r_p = GSVector4i(0, 0, 16, 16);
if (!(r == r_p).alltrue())
return true; return true;
// Rendering 16x16 palette // Render 16x16 palette via CPU.
SwSpriteRender();
if (m_vt.m_eq.rgba != 0xffff || m_vt.m_eq.z != 0x1 || m_vt.m_eq.q != 0x1) return false; // Skip current draw.
return true;
// No rasterization
if (m_context->DepthRead() || m_context->DepthWrite())
return true;
// No depth handling
// Game is clearing palette content.
// Jak X does a constant RGBA color write to clear palette prior to actual rendering
// that is not being handled correctly, most likely due to TC issue, so let's bypass
// GPU render and TC and clear GS memory directly instead
bool palette_clear = PRIM->PRIM == 6
&& !PRIM->IIP
&& !PRIM->TME
&& !PRIM->FGE
&& !PRIM->ABE
&& !PRIM->AA1
&& !PRIM->FST
&& !PRIM->FIX
&& m_context->FRAME.FBMSK == 0x0
&& m_context->FRAME.FBW == 1
&& m_context->FRAME.PSM == PSM_PSMCT32
;
// Game is rendering directly to palette.
// Cannot perform GPU render to FB as reading back is both slow and clashes with
// texture inside FB reading needed for correct eye rendering,
// so perform CPU rendering instead and skip draw.
bool palette_render = !PRIM->FST
&& PRIM->TME
&& m_context->TEX0.TBW == 1
&& m_context->TEX0.TW == 4
&& m_context->TEX0.TH == 4
&& m_context->TEX0.PSM == PSM_PSMCT32
;
if (palette_clear || palette_render)
{
SwSpriteRender();
return false; // skip current draw
}
return true;
} }
// OO (others output?) hacks: invalidate extra local memory after the draw call // OO (others output?) hacks: invalidate extra local memory after the draw call