mirror of
https://github.com/libretro/pcsx2.git
synced 2024-12-28 04:35:08 +00:00
gsdx tc: trick the texture cache to use a depth format for depth texture
This way we avoid the rescaling of the depth buffer and texture allocation.
This commit is contained in:
parent
1960d51e60
commit
ad08701cb1
@ -873,7 +873,9 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
||||
|
||||
if (tex)
|
||||
{
|
||||
const GSLocalMemory::psm_t &psm = GSLocalMemory::m_psm[m_context->TEX0.PSM];
|
||||
// Warning fetch the texture PSM format rather than the context format. The latter could have been corrected in the texture cache for depth.
|
||||
//const GSLocalMemory::psm_t &psm = GSLocalMemory::m_psm[m_context->TEX0.PSM];
|
||||
const GSLocalMemory::psm_t &psm = GSLocalMemory::m_psm[tex->m_TEX0.PSM];
|
||||
const GSLocalMemory::psm_t &cpsm = psm.pal > 0 ? GSLocalMemory::m_psm[m_context->TEX0.CPSM] : psm;
|
||||
bool bilinear = m_filter == 2 ? m_vt.IsLinear() : m_filter != 0;
|
||||
bool simple_sample = !tex->m_palette && cpsm.fmt == 0 && m_context->CLAMP.WMS < 2 && m_context->CLAMP.WMT < 2 && !psm.depth;
|
||||
|
@ -295,8 +295,14 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con
|
||||
if(!t->m_age && t->m_used && t->m_dirty.empty() && GSUtil::HasSharedBits(bp, psm, t->m_TEX0.TBP0, t->m_TEX0.PSM))
|
||||
{
|
||||
GL_INS("TC: Warning depth format read as color format. Pixels will be scrambled");
|
||||
dst = t;
|
||||
break;
|
||||
//dst = t;
|
||||
//break;
|
||||
// Let's fetch a depth format texture. Rational, it will avoid the texture allocation and the
|
||||
// rescaling of the current function.
|
||||
GIFRegTEX0 depth_TEX0;
|
||||
depth_TEX0.u32[0] = TEX0.u32[0] | (0x30u << 20u);
|
||||
depth_TEX0.u32[1] = TEX0.u32[1];
|
||||
return LookupDepthSource(depth_TEX0, TEXA, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user