mirror of https://github.com/PCSX2/pcsx2.git
gsdx mipmap:ogl: extend shader to support trilinear filtering
This commit is contained in:
parent
d185a85a07
commit
7ea0e90678
|
@ -954,6 +954,8 @@ GLuint GSDeviceOGL::CompilePS(PSSelector sel)
|
||||||
+ format("#define PS_CLR1 %d\n", sel.clr1)
|
+ format("#define PS_CLR1 %d\n", sel.clr1)
|
||||||
+ format("#define PS_FBA %d\n", sel.fba)
|
+ format("#define PS_FBA %d\n", sel.fba)
|
||||||
+ format("#define PS_LTF %d\n", sel.ltf)
|
+ format("#define PS_LTF %d\n", sel.ltf)
|
||||||
|
+ format("#define PS_AUTOMATIC_LOD %d\n", sel.automatic_lod)
|
||||||
|
+ format("#define PS_MANUAL_LOD %d\n", sel.manual_lod)
|
||||||
+ format("#define PS_COLCLIP %d\n", sel.colclip)
|
+ format("#define PS_COLCLIP %d\n", sel.colclip)
|
||||||
+ format("#define PS_DATE %d\n", sel.date)
|
+ format("#define PS_DATE %d\n", sel.date)
|
||||||
+ format("#define PS_TCOFFSETHACK %d\n", sel.tcoffsethack)
|
+ format("#define PS_TCOFFSETHACK %d\n", sel.tcoffsethack)
|
||||||
|
|
|
@ -293,8 +293,10 @@ public:
|
||||||
uint32 urban_chaos_hle:1;
|
uint32 urban_chaos_hle:1;
|
||||||
uint32 tales_of_abyss_hle:1;
|
uint32 tales_of_abyss_hle:1;
|
||||||
uint32 tex_is_fb:1; // Jak Shadows
|
uint32 tex_is_fb:1; // Jak Shadows
|
||||||
|
uint32 automatic_lod:1;
|
||||||
|
uint32 manual_lod:1;
|
||||||
|
|
||||||
uint32 _free2:13;
|
uint32 _free2:11;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint64 key;
|
uint64 key;
|
||||||
|
|
|
@ -78,7 +78,26 @@ vec4 sample_c(vec2 uv)
|
||||||
#if PS_TEX_IS_FB == 1
|
#if PS_TEX_IS_FB == 1
|
||||||
return texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0);
|
return texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#if PS_AUTOMATIC_LOD == 1
|
||||||
return texture(TextureSampler, uv);
|
return texture(TextureSampler, uv);
|
||||||
|
#elif PS_MANUAL_LOD == 1
|
||||||
|
// FIXME add LOD: K - ( LOG2(Q) * (1 << L))
|
||||||
|
float K = MinMax.x;
|
||||||
|
float L = MinMax.y;
|
||||||
|
float bias = MinMax.z;
|
||||||
|
float max_lod = MinMax.w;
|
||||||
|
|
||||||
|
float gs_lod = K - log2(abs(PSin.t_float.w)) * L;
|
||||||
|
// FIXME max useful ?
|
||||||
|
//float lod = max(min(gs_lod, max_lod) - bias, 0.0f);
|
||||||
|
float lod = min(gs_lod, max_lod) - bias;
|
||||||
|
|
||||||
|
return textureLod(TextureSampler, uv, lod);
|
||||||
|
#else
|
||||||
|
return textureLod(TextureSampler, uv, 0); // No lod
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -998,7 +998,26 @@ static const char* const tfx_fs_all_glsl =
|
||||||
"#if PS_TEX_IS_FB == 1\n"
|
"#if PS_TEX_IS_FB == 1\n"
|
||||||
" return texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0);\n"
|
" return texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0);\n"
|
||||||
"#else\n"
|
"#else\n"
|
||||||
|
"\n"
|
||||||
|
"#if PS_AUTOMATIC_LOD == 1\n"
|
||||||
" return texture(TextureSampler, uv);\n"
|
" return texture(TextureSampler, uv);\n"
|
||||||
|
"#elif PS_MANUAL_LOD == 1\n"
|
||||||
|
" // FIXME add LOD: K - ( LOG2(Q) * (1 << L))\n"
|
||||||
|
" float K = MinMax.x;\n"
|
||||||
|
" float L = MinMax.y;\n"
|
||||||
|
" float bias = MinMax.z;\n"
|
||||||
|
" float max_lod = MinMax.w;\n"
|
||||||
|
"\n"
|
||||||
|
" float gs_lod = K - log2(abs(PSin.t_float.w)) * L;\n"
|
||||||
|
" // FIXME max useful ?\n"
|
||||||
|
" //float lod = max(min(gs_lod, max_lod) - bias, 0.0f);\n"
|
||||||
|
" float lod = min(gs_lod, max_lod) - bias;\n"
|
||||||
|
"\n"
|
||||||
|
" return textureLod(TextureSampler, uv, lod);\n"
|
||||||
|
"#else\n"
|
||||||
|
" return textureLod(TextureSampler, uv, 0); // No lod\n"
|
||||||
|
"#endif\n"
|
||||||
|
"\n"
|
||||||
"#endif\n"
|
"#endif\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
Loading…
Reference in New Issue