gsdx ogl: add a Tales of Abyss HLE shader

Again fast and efficient but it relies on CRC

v2: forget to update the precompiled shader...
This commit is contained in:
Gregory Hainaut 2016-05-06 19:57:42 +02:00
parent d5681ba01c
commit d41613c46a
5 changed files with 29 additions and 8 deletions

View File

@ -767,7 +767,8 @@ GLuint GSDeviceOGL::CompilePS(PSSelector sel)
+ format("#define PS_DFMT %d\n", sel.dfmt)
+ format("#define PS_DEPTH_FMT %d\n", sel.depth_fmt)
+ format("#define PS_CHANNEL_FETCH %d\n", sel.channel)
+ format("#define PS_URBAN_CHAOS_HACK %d\n", sel.urban_chaos_hack)
+ format("#define PS_URBAN_CHAOS_HLE %d\n", sel.urban_chaos_hle)
+ format("#define PS_TALES_OF_ABYSS_HLE %d\n", sel.tales_of_abyss_hle)
+ format("#define PS_AEM %d\n", sel.aem)
+ format("#define PS_TFX %d\n", sel.tfx)
+ format("#define PS_TCC %d\n", sel.tcc)

View File

@ -289,9 +289,10 @@ class GSDeviceOGL final : public GSDevice
// Hack
uint32 tcoffsethack:1;
uint32 urban_chaos_hack:1;
uint32 urban_chaos_hle:1;
uint32 tales_of_abyss_hle:1;
uint32 _free2:15;
uint32 _free2:14;
};
uint64 key;

View File

@ -678,6 +678,14 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
ps_sel.channel = 7;
m_context->TEX0.TFX = TFX_DECAL;
rt = tex->m_from_target;
} else if ((tex->m_texture->GetType() == GSTexture::DepthStencil) && !(tex->m_32_bits_fmt)) {
if (m_game.title == CRC::TalesOfAbyss) {
GL_INS("Tales Of Abyss Crazyness (MSB 16b depth to Alpha)");
ps_sel.tales_of_abyss_hle = 1;
} else {
GL_INS("Urban Chaos Crazyness (Green extraction)");
ps_sel.urban_chaos_hle = 1;
}
} else if (m_context->CLAMP.WMS == 3 && ((m_context->CLAMP.MAXU & 0x8) == 8)) {
// Read either blue or Alpha. Let's go for Blue ;)
// MGS3/Kill Zone
@ -688,9 +696,6 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
// Pop
GL_INS("Red channel");
ps_sel.channel = 1;
} else if ((tex->m_texture->GetType() == GSTexture::DepthStencil) && !(tex->m_32_bits_fmt)) {
GL_INS("Urban Chaos Crazyness");
ps_sel.urban_chaos_hack = 1;
} else {
GL_INS("channel not supported");
m_channel_shuffle = false;

View File

@ -235,7 +235,14 @@ vec4 sample_depth(vec2 st)
ivec2 uv = ivec2(uv_f);
vec4 t;
#if PS_URBAN_CHAOS_HACK == 1
#if PS_TALES_OF_ABYSS_HLE == 1
// Warning: UV can't be used in channel effect
int depth = fetch_raw_depth();
// Convert msb based on the palette
t = texelFetch(PaletteSampler, ivec2((depth >> 8) & 0xFF, 0), 0) * 255.0f;
#elif PS_URBAN_CHAOS_HLE == 1
// Depth buffer is read as a RGB5A1 texture. The game try to extract the green channel.
// So it will do a first channel trick to extract lsb, value is right-shifted.
// Then a new channel trick to extract msb which will shifted to the left.

View File

@ -1079,7 +1079,14 @@ static const char* const tfx_fs_all_glsl =
" ivec2 uv = ivec2(uv_f);\n"
"\n"
" vec4 t;\n"
"#if PS_URBAN_CHAOS_HACK == 1\n"
"#if PS_TALES_OF_ABYSS_HLE == 1\n"
" // Warning: UV can't be used in channel effect\n"
" int depth = fetch_raw_depth();\n"
"\n"
" // Convert msb based on the palette\n"
" t = texelFetch(PaletteSampler, ivec2((depth >> 8) & 0xFF, 0), 0) * 255.0f;\n"
"\n"
"#elif PS_URBAN_CHAOS_HLE == 1\n"
" // Depth buffer is read as a RGB5A1 texture. The game try to extract the green channel.\n"
" // So it will do a first channel trick to extract lsb, value is right-shifted.\n"
" // Then a new channel trick to extract msb which will shifted to the left.\n"