diff --git a/plugins/GSdx/GSRendererDX.cpp b/plugins/GSdx/GSRendererDX.cpp index 6c75f7e06b..f7c13aef34 100644 --- a/plugins/GSdx/GSRendererDX.cpp +++ b/plugins/GSdx/GSRendererDX.cpp @@ -276,23 +276,20 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc if(tex) { const GSLocalMemory::psm_t &psm = GSLocalMemory::m_psm[context->TEX0.PSM]; - bool bilinear = m_filter == 2 ? m_vt.IsLinear() : (bool)m_filter; + const GSLocalMemory::psm_t &cpsm = psm.pal > 0 ? GSLocalMemory::m_psm[context->TEX0.CPSM] : psm; + bool bilinear = m_filter == 2 ? m_vt.IsLinear() : m_filter != 0; + bool simple_sample = !tex->m_palette && cpsm.fmt == 0 && context->CLAMP.WMS < 3 && context->CLAMP.WMT < 3; ps_sel.wms = context->CLAMP.WMS; ps_sel.wmt = context->CLAMP.WMT; if (tex->m_palette) - { - const GSLocalMemory::psm_t &cpsm = GSLocalMemory::m_psm[context->TEX0.CPSM]; ps_sel.fmt = cpsm.fmt | 4; - } - else if (psm.pal > 0) - ps_sel.fmt = 0; else - ps_sel.fmt = psm.fmt; + ps_sel.fmt = cpsm.fmt; ps_sel.aem = env.TEXA.AEM; ps_sel.tfx = context->TEX0.TFX; ps_sel.tcc = context->TEX0.TCC; - ps_sel.ltf = bilinear && !(ps_sel.fmt <= 2 && ps_sel.wms < 3 && ps_sel.wmt < 3); + ps_sel.ltf = bilinear && !simple_sample; ps_sel.rt = tex->m_target; ps_sel.spritehack = tex->m_spritehack_t; @@ -324,7 +321,7 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc ps_ssel.tau = (context->CLAMP.WMS + 3) >> 1; ps_ssel.tav = (context->CLAMP.WMT + 3) >> 1; - ps_ssel.ltf = bilinear && ps_sel.fmt <= 2 && ps_sel.wms < 3 && ps_sel.wmt < 3; + ps_ssel.ltf = bilinear && simple_sample; } else { diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index 418a9005c3..bdcf7621eb 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -80,11 +80,6 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con continue; } - if(!m_paltex && TEX0.TCC && cpsm.fmt > 0 && TEXA != s->m_TEXA) - { - continue; - } - if(s->m_palette == NULL && psm.pal > 0 && !GSVector4i::compare64(clut, s->m_clut, psm.pal * sizeof(clut[0]))) { continue; @@ -1039,13 +1034,17 @@ void GSTextureCache::Source::Flush(uint32 count) GSLocalMemory::readTexture rtx = psm.rtx; + GIFRegTEXA plainTEXA; + + plainTEXA.AEM = 1; + plainTEXA.TA0 = 0; + plainTEXA.TA1 = 0x80; + if(m_palette) { pitch >>= 2; rtx = psm.rtxP; } - else if (psm.pal > 0) - m_renderer->m_mem.m_clut.Read32(m_TEX0, m_TEXA); uint8* buff = m_temp; @@ -1065,13 +1064,13 @@ void GSTextureCache::Source::Flush(uint32 count) if(m_texture->Map(m, &r)) { - (mem.*rtx)(o, r, m.bits, m.pitch, m_TEXA); + (mem.*rtx)(o, r, m.bits, m.pitch, plainTEXA); m_texture->Unmap(); } else { - (mem.*rtx)(o, r, buff, pitch, m_TEXA); + (mem.*rtx)(o, r, buff, pitch, plainTEXA); m_texture->Update(r, buff, pitch); } diff --git a/plugins/GSdx/res/tfx.fx b/plugins/GSdx/res/tfx.fx index 7ec53d56aa..70028e01d3 100644 --- a/plugins/GSdx/res/tfx.fx +++ b/plugins/GSdx/res/tfx.fx @@ -362,12 +362,12 @@ float4 sample(float2 st, float q) float2 dd; /* - if(PS_FMT <= FMT_16 && PS_WMS < 2 && PS_WMT < 2) + if(!PS_LTF && PS_FMT <= FMT_16 && PS_WMS < 2 && PS_WMT < 2) { c[0] = sample_c(st); } */ - if(PS_FMT <= FMT_16 && PS_WMS < 3 && PS_WMT < 3) + if (!PS_LTF && PS_FMT <= FMT_16 && PS_WMS < 3 && PS_WMT < 3) { c[0] = sample_c(clampuv(st)); }