GSDX: (New bug?) If "8 bit textures" is disabled format conversion has already happened and we need PS_FMT=0 in the shader for indexed textures.

GSDX: (Old bug) When looking up a texture in the cache, the check didn't take into account CLUT formats, nor did it skip this check when "8 bit textures" is enabled.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5292 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
sudonim1@gmail.com 2012-06-13 17:44:24 +00:00
parent 0bf64fdffd
commit 6bb9339223
2 changed files with 8 additions and 4 deletions

View File

@ -276,7 +276,7 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
if(tex) if(tex)
{ {
const GSLocalMemory::psm_t &psm = GSLocalMemory::m_psm[context->TEX0.PSM]; const GSLocalMemory::psm_t &psm = GSLocalMemory::m_psm[context->TEX0.PSM];
bool bilinear = m_filter == 2 ? m_vt.IsLinear() : m_filter; bool bilinear = m_filter == 2 ? m_vt.IsLinear() : (bool)m_filter;
ps_sel.wms = context->CLAMP.WMS; ps_sel.wms = context->CLAMP.WMS;
ps_sel.wmt = context->CLAMP.WMT; ps_sel.wmt = context->CLAMP.WMT;
@ -285,6 +285,8 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
const GSLocalMemory::psm_t &cpsm = GSLocalMemory::m_psm[context->TEX0.CPSM]; const GSLocalMemory::psm_t &cpsm = GSLocalMemory::m_psm[context->TEX0.CPSM];
ps_sel.fmt = cpsm.fmt | 4; ps_sel.fmt = cpsm.fmt | 4;
} }
else if (psm.pal > 0)
ps_sel.fmt = 0;
else else
ps_sel.fmt = psm.fmt; ps_sel.fmt = psm.fmt;
ps_sel.aem = env.TEXA.AEM; ps_sel.aem = env.TEXA.AEM;

View File

@ -56,6 +56,7 @@ void GSTextureCache::RemoveAll()
GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, const GSVector4i& r) GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, const GSVector4i& r)
{ {
const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[TEX0.PSM]; const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[TEX0.PSM];
const GSLocalMemory::psm_t& cpsm = psm.pal > 0 ? GSLocalMemory::m_psm[TEX0.CPSM] : psm;
const uint32* clut = m_renderer->m_mem.m_clut; const uint32* clut = m_renderer->m_mem.m_clut;
Source* src = NULL; Source* src = NULL;
@ -71,7 +72,7 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con
continue; continue;
} }
if((psm.trbpp == 16 || psm.trbpp == 24) && TEX0.TCC && TEXA != s->m_TEXA) if(!m_paltex && TEX0.TCC && cpsm.fmt > 0 && TEXA != s->m_TEXA)
{ {
continue; continue;
} }
@ -582,6 +583,9 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
bool hack = false; bool hack = false;
if (dst)
dst->Update();
if(m_spritehack && (TEX0.PSM == PSM_PSMT8 || TEX0.PSM == PSM_PSMT8H)) if(m_spritehack && (TEX0.PSM == PSM_PSMT8 || TEX0.PSM == PSM_PSMT8H))
{ {
src->m_spritehack_t = true; src->m_spritehack_t = true;
@ -600,8 +604,6 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
src->m_target = true; src->m_target = true;
dst->Update();
GSTexture* tmp = NULL; GSTexture* tmp = NULL;
if(dst->m_texture->IsMSAA()) if(dst->m_texture->IsMSAA())