glsl: keep fract in [0;1] range

Shin Megami Tensei Lucifers seems to generate infinites values.
I suspect that DX always clamp fract output.

Finally fix #782 !
This commit is contained in:
Gregory Hainaut 2015-10-22 18:36:45 +02:00
parent c0d0e2e89d
commit a8968257db
2 changed files with 14 additions and 0 deletions

View File

@ -236,6 +236,13 @@ vec4 sample_color(vec2 st, float q)
{
uv = st.xyxy + HalfTexel;
dd = fract(uv.xy * WH.zw);
#if (PS_FST == 0)
// Background in Shin Megami Tensei Lucifers
// I suspect that uv isn't a standard number, so fract is outside of the [0;1] range
// Note: it is free on GPU but let's do it only for float coordinate
// Strangely Dx doesn't suffer from this issue.
dd = clamp(dd, vec2(0.0f), vec2(1.0f));
#endif
}
else
{

View File

@ -1140,6 +1140,13 @@ static const char* tfx_fs_all_glsl =
" {\n"
" uv = st.xyxy + HalfTexel;\n"
" dd = fract(uv.xy * WH.zw);\n"
"#if (PS_FST == 0)\n"
" // Background in Shin Megami Tensei Lucifers\n"
" // I suspect that uv isn't a standard number, so fract is outside of the [0;1] range\n"
" // Note: it is free on GPU but let's do it only for float coordinate\n"
" // Strangely Dx doesn't suffer from this issue.\n"
" dd = clamp(dd, vec2(0.0f), vec2(1.0f));\n"
"#endif\n"
" }\n"
" else\n"
" {\n"