GSDX: Added a compatibility check to the framebuffer handling for the texture cache and made it preferred and added a writeback as a fallback. Compat should be back to normal?

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5288 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
sudonim1@gmail.com 2012-06-11 10:57:32 +00:00
parent e8257df98d
commit b722dfd013
1 changed files with 27 additions and 18 deletions

View File

@ -132,19 +132,16 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con
} }
} }
if(psm.pal > 0) if (src->m_palette)
{ {
int size = psm.pal * sizeof(clut[0]); int size = psm.pal * sizeof(clut[0]);
if(src->m_palette)
{
if(src->m_initpalette || !GSVector4i::update(src->m_clut, clut, size)) if(src->m_initpalette || !GSVector4i::update(src->m_clut, clut, size))
{ {
src->m_palette->Update(GSVector4i(0, 0, psm.pal, 1), src->m_clut, size); src->m_palette->Update(GSVector4i(0, 0, psm.pal, 1), src->m_clut, size);
src->m_initpalette = false; src->m_initpalette = false;
} }
} }
}
src->Update(r); src->Update(r);
@ -595,16 +592,9 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
else else
src->m_spritehack_t = false; src->m_spritehack_t = false;
if (m_paltex && psm.pal > 0) if (dst && dst->m_type == RenderTarget
{ && (dst->m_TEX0.PSM == TEX0.PSM || dst->m_TEX0.PSM == PSM_PSMCT32 && TEX0.PSM == PSM_PSMCT24
src->m_texture = m_renderer->m_dev->CreateTexture(tw, th, Get8bitFormat()); || m_paltex && dst->m_TEX0.PSM == PSM_PSMCT32 && TEX0.PSM == PSM_PSMT8H))
src->m_palette = m_renderer->m_dev->CreateTexture(256, 1);
}
else if (dst == NULL || dst->m_type != RenderTarget /* TODO */)
{
src->m_texture = m_renderer->m_dev->CreateTexture(tw, th);
}
else
{ {
// TODO: clean up this mess // TODO: clean up this mess
@ -709,7 +699,14 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
GSVector4 sr(0, 0, w, h); GSVector4 sr(0, 0, w, h);
GSTexture* st = src->m_texture ? src->m_texture : dst->m_texture; GSTexture* st = src->m_texture ? src->m_texture : dst->m_texture;
GSTexture* dt = m_renderer->m_dev->CreateRenderTarget(w, h, false); GSTexture *dt;
if (m_paltex && psm.pal > 0)
{
dt = m_renderer->m_dev->CreateRenderTarget(w, h, false, Get8bitFormat());
src->m_palette = m_renderer->m_dev->CreateTexture(256, 1);
}
else
dt = m_renderer->m_dev->CreateRenderTarget(w, h, false);
if(!src->m_texture) if(!src->m_texture)
{ {
@ -769,6 +766,18 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
dst->m_texture->OffsetHack_modx = modx; dst->m_texture->OffsetHack_modx = modx;
dst->m_texture->OffsetHack_mody = mody; dst->m_texture->OffsetHack_mody = mody;
} }
else
{
if (dst)
Read(dst, dst->m_valid);
if (m_paltex && psm.pal > 0)
{
src->m_texture = m_renderer->m_dev->CreateTexture(tw, th, Get8bitFormat());
src->m_palette = m_renderer->m_dev->CreateTexture(256, 1);
}
else
src->m_texture = m_renderer->m_dev->CreateTexture(tw, th);
}
if(src->m_texture == NULL) if(src->m_texture == NULL)
{ {