gsdx-ogl: properly handle t_float in GS

f8c442cf76 misses the swap of t_float in GS

Fix regression in Okami

Bonus: factorize VS_WILDHACK in the VS
This commit is contained in:
Gregory Hainaut 2016-02-21 11:48:30 +01:00
parent d53ed5bbee
commit 9ba470fc63
3 changed files with 34 additions and 46 deletions

View File

@ -359,7 +359,7 @@ vec4 ps_color()
{
//FIXME: maybe we can set gl_Position.w = q in VS
#if (PS_FST == 0)
vec4 T = sample_color(PSin.t_float.xy / PSin.t_float.w);
vec4 T = sample_color(PSin.t_float.xy / vec2(PSin.t_float.w));
#else
// Note xy are normalized coordinate
vec4 T = sample_color(PSin.t_int.xy);

View File

@ -70,23 +70,16 @@ const float exp_min31 = exp2(-31.0f);
void texture_coord()
{
vec2 uv = (VS_WILDHACK == 1) ? vec2(i_uv & uvec2(0x3FEF, 0x3FEF)) : vec2(i_uv);
// Float coordinate
VSout.t_float.xy = i_st;
VSout.t_float.w = i_q;
// Integer coordinate
// => normalized
if (VS_WILDHACK == 1) {
VSout.t_int.xy = vec2(i_uv & uvec2(0x3FEF, 0x3FEF)) * TextureScale;
} else {
VSout.t_int.xy = vec2(i_uv) * TextureScale;
}
// => integral
if (VS_WILDHACK == 1) {
VSout.t_int.zw = vec2(i_uv & uvec2(0x3FEF, 0x3FEF));
} else {
VSout.t_int.zw = vec2(i_uv);
}
// Integer coordinate => normalized
VSout.t_int.xy = uv * TextureScale;
// Integer coordinate => integral
VSout.t_int.zw = uv;
}
void vs_main()
@ -234,16 +227,17 @@ void gs_main()
#endif
// Swap texture and position coordinate
vertex lb = rb;
lb.t_int.x = lt.t_int.x;
lb.t_int.z = lt.t_int.z;
lb_p.x = lt_p.x;
vertex rt = rb;
rt_p.y = lt_p.y;
rt.t_int.y = lt.t_int.y;
rt.t_int.w = lt.t_int.w;
vertex lb = rb;
lb.t_float.x = lt.t_float.x;
lb.t_int.x = lt.t_int.x;
lb.t_int.z = lt.t_int.z;
lb_p.x = lt_p.x;
vertex rt = rb;
rt_p.y = lt_p.y;
rt.t_float.y = lt.t_float.y;
rt.t_int.y = lt.t_int.y;
rt.t_int.w = lt.t_int.w;
// Triangle 1
gl_Position = lt_p;

View File

@ -695,23 +695,16 @@ static const char* tfx_vgs_glsl =
"\n"
"void texture_coord()\n"
"{\n"
" vec2 uv = (VS_WILDHACK == 1) ? vec2(i_uv & uvec2(0x3FEF, 0x3FEF)) : vec2(i_uv);\n"
"\n"
" // Float coordinate\n"
" VSout.t_float.xy = i_st;\n"
" VSout.t_float.w = i_q;\n"
"\n"
" // Integer coordinate\n"
" // => normalized\n"
" if (VS_WILDHACK == 1) {\n"
" VSout.t_int.xy = vec2(i_uv & uvec2(0x3FEF, 0x3FEF)) * TextureScale;\n"
" } else {\n"
" VSout.t_int.xy = vec2(i_uv) * TextureScale;\n"
" }\n"
" // => integral\n"
" if (VS_WILDHACK == 1) {\n"
" VSout.t_int.zw = vec2(i_uv & uvec2(0x3FEF, 0x3FEF));\n"
" } else {\n"
" VSout.t_int.zw = vec2(i_uv);\n"
" }\n"
" // Integer coordinate => normalized\n"
" VSout.t_int.xy = uv * TextureScale;\n"
" // Integer coordinate => integral\n"
" VSout.t_int.zw = uv;\n"
"}\n"
"\n"
"void vs_main()\n"
@ -859,16 +852,17 @@ static const char* tfx_vgs_glsl =
"#endif\n"
"\n"
" // Swap texture and position coordinate\n"
" vertex lb = rb;\n"
" lb.t_int.x = lt.t_int.x;\n"
" lb.t_int.z = lt.t_int.z;\n"
" lb_p.x = lt_p.x;\n"
"\n"
" vertex rt = rb;\n"
" rt_p.y = lt_p.y;\n"
" rt.t_int.y = lt.t_int.y;\n"
" rt.t_int.w = lt.t_int.w;\n"
" vertex lb = rb;\n"
" lb.t_float.x = lt.t_float.x;\n"
" lb.t_int.x = lt.t_int.x;\n"
" lb.t_int.z = lt.t_int.z;\n"
" lb_p.x = lt_p.x;\n"
"\n"
" vertex rt = rb;\n"
" rt_p.y = lt_p.y;\n"
" rt.t_float.y = lt.t_float.y;\n"
" rt.t_int.y = lt.t_int.y;\n"
" rt.t_int.w = lt.t_int.w;\n"
"\n"
" // Triangle 1\n"
" gl_Position = lt_p;\n"
@ -1258,7 +1252,7 @@ static const char* tfx_fs_all_glsl =
"{\n"
" //FIXME: maybe we can set gl_Position.w = q in VS\n"
"#if (PS_FST == 0)\n"
" vec4 T = sample_color(PSin.t_float.xy / PSin.t_float.w);\n"
" vec4 T = sample_color(PSin.t_float.xy / vec2(PSin.t_float.w));\n"
"#else\n"
" // Note xy are normalized coordinate\n"
" vec4 T = sample_color(PSin.t_int.xy);\n"