GSRendererOGL/GSTextureCache: Improve ICO hack by using palette cache for depth sampling, removing only point of creation of palette textures outside TC.

This commit is contained in:
Alessandro Vetere 2018-12-10 21:11:14 +01:00 committed by lightningterror
parent 202945aa49
commit acbe6c24a0
2 changed files with 1 additions and 14 deletions

View File

@ -1593,11 +1593,6 @@ GSTextureCache::Source::Source(GSRenderer* r, const GIFRegTEX0& TEX0, const GIFR
GSTextureCache::Source::~Source()
{
if (!m_should_have_tex_palette) {
// Eventually valid reference for m_palette is not managed by PaletteMap, so it has to be recycled
m_renderer->m_dev->Recycle(m_palette);
}
_aligned_free(m_write.rect);
}

View File

@ -1338,16 +1338,8 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
// We need the palette to convert the depth to the correct alpha value.
if (!tex->m_palette) {
// If this asserts fails, the allocated palette texture (tex->m_palette)
// is leaked because it is not released on tex destruction
ASSERT(!tex->m_should_have_tex_palette); // No 8-bit texture enabled
tex->m_palette = m_dev->CreateTexture(256, 1);
const uint32* clut = m_mem.m_clut;
uint16 pal = GSLocalMemory::m_psm[tex->m_TEX0.PSM].pal;
tex->m_palette->Update(GSVector4i(0, 0, pal, 1), clut, pal * sizeof(clut[0]));
m_tc->AttachPaletteToSource(tex, pal, true);
dev->PSSetShaderResource(1, tex->m_palette);
}
}