mirror of https://github.com/PCSX2/pcsx2.git
GS/TextureCache: Expand perfect-matched targets for display when needed
Hitman Contracts draws a line near the bottom of the screen, presumably with a smaller scissor, then scans out 448 lines. Which meant the merge oversampled and smeared.
This commit is contained in:
parent
794c73a613
commit
63b3646e73
|
@ -469,6 +469,9 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, con
|
||||||
{
|
{
|
||||||
dst = t;
|
dst = t;
|
||||||
GL_CACHE("TC: Lookup Frame %dx%d, perfect hit: %d (0x%x -> 0x%x %s)", size.x, size.y, dst->m_texture->GetID(), bp, t->m_end_block, psm_str(TEX0.PSM));
|
GL_CACHE("TC: Lookup Frame %dx%d, perfect hit: %d (0x%x -> 0x%x %s)", size.x, size.y, dst->m_texture->GetID(), bp, t->m_end_block, psm_str(TEX0.PSM));
|
||||||
|
if (real_h > 0)
|
||||||
|
ScaleTargetForDisplay(dst, TEX0, real_h);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -676,6 +679,9 @@ void GSTextureCache::ScaleTargetForDisplay(Target* t, const GIFRegTEX0& dispfb,
|
||||||
|
|
||||||
// We unconditionally preload the frame here, because otherwise we'll end up with blackness for one frame (when the expand happens).
|
// We unconditionally preload the frame here, because otherwise we'll end up with blackness for one frame (when the expand happens).
|
||||||
t->m_dirty.push_back(GSDirtyRect(GSVector4i(0, 0, t->m_TEX0.TBW * 64, needed_height), t->m_TEX0.PSM, t->m_TEX0.TBW));
|
t->m_dirty.push_back(GSDirtyRect(GSVector4i(0, 0, t->m_TEX0.TBW * 64, needed_height), t->m_TEX0.PSM, t->m_TEX0.TBW));
|
||||||
|
|
||||||
|
// Inject the new height back into the cache.
|
||||||
|
GetTargetHeight(t->m_TEX0.TBP0, t->m_TEX0.TBW, t->m_TEX0.PSM, static_cast<u32>(needed_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Goal: Depth And Target at the same address is not possible. On GS it is
|
// Goal: Depth And Target at the same address is not possible. On GS it is
|
||||||
|
|
|
@ -309,6 +309,10 @@ protected:
|
||||||
Source* CreateSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, Target* t = NULL, bool half_right = false, int x_offset = 0, int y_offset = 0, const GSVector2i* lod = nullptr, const GSVector4i* src_range = nullptr);
|
Source* CreateSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, Target* t = NULL, bool half_right = false, int x_offset = 0, int y_offset = 0, const GSVector2i* lod = nullptr, const GSVector4i* src_range = nullptr);
|
||||||
Target* CreateTarget(const GIFRegTEX0& TEX0, int w, int h, int type, const bool clear);
|
Target* CreateTarget(const GIFRegTEX0& TEX0, int w, int h, int type, const bool clear);
|
||||||
|
|
||||||
|
/// Expands a target when the block pointer for a display framebuffer is within another target, but the read offset
|
||||||
|
/// plus the height is larger than the current size of the target.
|
||||||
|
void ScaleTargetForDisplay(Target* t, const GIFRegTEX0& dispfb, int real_h);
|
||||||
|
|
||||||
HashCacheEntry* LookupHashCache(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, bool& paltex, const u32* clut, const GSVector2i* lod);
|
HashCacheEntry* LookupHashCache(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, bool& paltex, const u32* clut, const GSVector2i* lod);
|
||||||
|
|
||||||
static void PreloadTexture(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, GSLocalMemory& mem, bool paltex, GSTexture* tex, u32 level);
|
static void PreloadTexture(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, GSLocalMemory& mem, bool paltex, GSTexture* tex, u32 level);
|
||||||
|
@ -360,10 +364,6 @@ public:
|
||||||
SurfaceOffset ComputeSurfaceOffset(const uint32_t bp, const uint32_t bw, const uint32_t psm, const GSVector4i& r, const Target* t);
|
SurfaceOffset ComputeSurfaceOffset(const uint32_t bp, const uint32_t bw, const uint32_t psm, const GSVector4i& r, const Target* t);
|
||||||
SurfaceOffset ComputeSurfaceOffset(const SurfaceOffsetKey& sok);
|
SurfaceOffset ComputeSurfaceOffset(const SurfaceOffsetKey& sok);
|
||||||
|
|
||||||
/// Expands a target when the block pointer for a display framebuffer is within another target, but the read offset
|
|
||||||
/// plus the height is larger than the current size of the target.
|
|
||||||
static void ScaleTargetForDisplay(Target* t, const GIFRegTEX0& dispfb, int real_h);
|
|
||||||
|
|
||||||
/// Invalidates a temporary source, a partial copy only created from the current RT/DS for the current draw.
|
/// Invalidates a temporary source, a partial copy only created from the current RT/DS for the current draw.
|
||||||
void InvalidateTemporarySource();
|
void InvalidateTemporarySource();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue