gsdx-tc: GPU accelerate 8 bits texture when upscaling is enabled

Code unscale the texture to ease the conversion. Quality is awful (same as before)
but I'm not sure we can support an upscaled texture

Maybe the quality loss is due to the reduction without mipmap

Maybe the best solution will be to add an hack to extract the blue channel
(with texture swizzle), and uses a "full page/screen" spirte instead.
(it would be faster too)

Note: won't be compatible with MSAA (but gl doesn't support it anyway)
This commit is contained in:
Gregory Hainaut 2015-06-27 16:45:31 +02:00
parent 6ca7a802bf
commit 2af7dcbda2
1 changed files with 20 additions and 0 deletions

View File

@ -840,6 +840,26 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
dst->m_texture = m_renderer->m_dev->Resolve(dst->m_texture);
}
// Unscale 8 bits textures, quality won't be nice but format is really awful
// Code won't be compatible with MSAA but it is a DX issue
if (TEX0.PSM == PSM_PSMT8) {
GSVector2 old_scale = dst->m_texture->GetScale();
if (old_scale != GSVector2(1.0f, 1.0f)) {
GSVector2i size = dst->m_texture->GetSize();
tmp = dst->m_texture;
dst->m_texture = m_renderer->m_dev->CreateRenderTarget(size.x, size.y, false);
GSVector4 sRect(0.0, 0.0, old_scale.x, old_scale.y);
GSVector4 dRect(0.0, 0.0, size.x, size.y);
m_renderer->m_dev->StretchRect(tmp, sRect, dst->m_texture, dRect, 0, false);
dst->m_texture->SetScale(GSVector2(1.0f, 1.0f));
}
}
// do not round here!!! if edge becomes a black pixel and addressing mode is clamp => everything outside the clamped area turns into black (kh2 shadows)
int w = (int)(dst->m_texture->GetScale().x * tw);