mirror of https://github.com/PCSX2/pcsx2.git
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:
parent
d53ed5bbee
commit
9ba470fc63
|
@ -359,7 +359,7 @@ vec4 ps_color()
|
||||||
{
|
{
|
||||||
//FIXME: maybe we can set gl_Position.w = q in VS
|
//FIXME: maybe we can set gl_Position.w = q in VS
|
||||||
#if (PS_FST == 0)
|
#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
|
#else
|
||||||
// Note xy are normalized coordinate
|
// Note xy are normalized coordinate
|
||||||
vec4 T = sample_color(PSin.t_int.xy);
|
vec4 T = sample_color(PSin.t_int.xy);
|
||||||
|
|
|
@ -70,23 +70,16 @@ const float exp_min31 = exp2(-31.0f);
|
||||||
|
|
||||||
void texture_coord()
|
void texture_coord()
|
||||||
{
|
{
|
||||||
|
vec2 uv = (VS_WILDHACK == 1) ? vec2(i_uv & uvec2(0x3FEF, 0x3FEF)) : vec2(i_uv);
|
||||||
|
|
||||||
// Float coordinate
|
// Float coordinate
|
||||||
VSout.t_float.xy = i_st;
|
VSout.t_float.xy = i_st;
|
||||||
VSout.t_float.w = i_q;
|
VSout.t_float.w = i_q;
|
||||||
|
|
||||||
// Integer coordinate
|
// Integer coordinate => normalized
|
||||||
// => normalized
|
VSout.t_int.xy = uv * TextureScale;
|
||||||
if (VS_WILDHACK == 1) {
|
// Integer coordinate => integral
|
||||||
VSout.t_int.xy = vec2(i_uv & uvec2(0x3FEF, 0x3FEF)) * TextureScale;
|
VSout.t_int.zw = uv;
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void vs_main()
|
void vs_main()
|
||||||
|
@ -234,16 +227,17 @@ void gs_main()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Swap texture and position coordinate
|
// Swap texture and position coordinate
|
||||||
vertex lb = rb;
|
vertex lb = rb;
|
||||||
lb.t_int.x = lt.t_int.x;
|
lb.t_float.x = lt.t_float.x;
|
||||||
lb.t_int.z = lt.t_int.z;
|
lb.t_int.x = lt.t_int.x;
|
||||||
lb_p.x = lt_p.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 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
|
// Triangle 1
|
||||||
gl_Position = lt_p;
|
gl_Position = lt_p;
|
||||||
|
|
|
@ -695,23 +695,16 @@ static const char* tfx_vgs_glsl =
|
||||||
"\n"
|
"\n"
|
||||||
"void texture_coord()\n"
|
"void texture_coord()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
" vec2 uv = (VS_WILDHACK == 1) ? vec2(i_uv & uvec2(0x3FEF, 0x3FEF)) : vec2(i_uv);\n"
|
||||||
|
"\n"
|
||||||
" // Float coordinate\n"
|
" // Float coordinate\n"
|
||||||
" VSout.t_float.xy = i_st;\n"
|
" VSout.t_float.xy = i_st;\n"
|
||||||
" VSout.t_float.w = i_q;\n"
|
" VSout.t_float.w = i_q;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" // Integer coordinate\n"
|
" // Integer coordinate => normalized\n"
|
||||||
" // => normalized\n"
|
" VSout.t_int.xy = uv * TextureScale;\n"
|
||||||
" if (VS_WILDHACK == 1) {\n"
|
" // Integer coordinate => integral\n"
|
||||||
" VSout.t_int.xy = vec2(i_uv & uvec2(0x3FEF, 0x3FEF)) * TextureScale;\n"
|
" VSout.t_int.zw = uv;\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"
|
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"void vs_main()\n"
|
"void vs_main()\n"
|
||||||
|
@ -859,16 +852,17 @@ static const char* tfx_vgs_glsl =
|
||||||
"#endif\n"
|
"#endif\n"
|
||||||
"\n"
|
"\n"
|
||||||
" // Swap texture and position coordinate\n"
|
" // Swap texture and position coordinate\n"
|
||||||
" vertex lb = rb;\n"
|
" vertex lb = rb;\n"
|
||||||
" lb.t_int.x = lt.t_int.x;\n"
|
" lb.t_float.x = lt.t_float.x;\n"
|
||||||
" lb.t_int.z = lt.t_int.z;\n"
|
" lb.t_int.x = lt.t_int.x;\n"
|
||||||
" lb_p.x = lt_p.x;\n"
|
" lb.t_int.z = lt.t_int.z;\n"
|
||||||
"\n"
|
" lb_p.x = lt_p.x;\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"
|
|
||||||
"\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"
|
"\n"
|
||||||
" // Triangle 1\n"
|
" // Triangle 1\n"
|
||||||
" gl_Position = lt_p;\n"
|
" gl_Position = lt_p;\n"
|
||||||
|
@ -1258,7 +1252,7 @@ static const char* tfx_fs_all_glsl =
|
||||||
"{\n"
|
"{\n"
|
||||||
" //FIXME: maybe we can set gl_Position.w = q in VS\n"
|
" //FIXME: maybe we can set gl_Position.w = q in VS\n"
|
||||||
"#if (PS_FST == 0)\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"
|
"#else\n"
|
||||||
" // Note xy are normalized coordinate\n"
|
" // Note xy are normalized coordinate\n"
|
||||||
" vec4 T = sample_color(PSin.t_int.xy);\n"
|
" vec4 T = sample_color(PSin.t_int.xy);\n"
|
||||||
|
|
Loading…
Reference in New Issue