gsdx-ogl: remove support WMS/T == 2 in hardware unit

I think behavior was wrong because only first texel coordinate was clamped.

Beside we can't interpolate if AEM isn't yet applied
This commit is contained in:
Gregory Hainaut 2015-08-14 20:57:45 +02:00
parent 53d1fdd8f1
commit c5a786ed2c
3 changed files with 35 additions and 43 deletions

View File

@ -781,7 +781,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
const GSLocalMemory::psm_t &psm = GSLocalMemory::m_psm[m_context->TEX0.PSM];
const GSLocalMemory::psm_t &cpsm = psm.pal > 0 ? GSLocalMemory::m_psm[m_context->TEX0.CPSM] : psm;
bool bilinear = m_filter == 2 ? m_vt.IsLinear() : m_filter != 0;
bool simple_sample = !tex->m_palette && cpsm.fmt == 0 && m_context->CLAMP.WMS < 3 && m_context->CLAMP.WMT < 3;
bool simple_sample = !tex->m_palette && cpsm.fmt == 0 && m_context->CLAMP.WMS < 2 && m_context->CLAMP.WMT < 2;
// Don't force extra filtering on sprite (it creates various upscaling issue)
bilinear &= !((m_vt.m_primclass == GS_SPRITE_CLASS) && m_userhacks_round_sprite_offset && !m_vt.IsLinear());

View File

@ -63,16 +63,25 @@ layout(std140, binding = 21) uniform cb21
{
vec3 FogColor;
float AREF;
vec4 WH;
vec2 MinF;
vec2 TA;
uvec4 MskFix;
uvec4 FbMask;
vec3 _not_yet_used;
vec3 _pad1;
float Af;
vec4 HalfTexel;
vec4 MinMax;
vec2 TC_OffsetHack;
vec2 _pad2;
};
vec4 sample_c(vec2 uv)
@ -85,7 +94,7 @@ vec4 sample_p(float idx)
return texture(PaletteSampler, vec2(idx, 0.0f));
}
vec4 wrapuv(vec4 uv)
vec4 clamp_wrap_uv(vec4 uv)
{
vec4 uv_out = uv;
@ -120,21 +129,6 @@ vec4 wrapuv(vec4 uv)
return uv_out;
}
vec2 clampuv(vec2 uv)
{
vec2 uv_out = uv;
#if (PS_WMS == 2) && (PS_WMT == 2)
uv_out = clamp(uv, MinF, MinMax.zw);
#elif PS_WMS == 2
uv_out.x = clamp(uv.x, MinF.x, MinMax.z);
#elif PS_WMT == 2
uv_out.y = clamp(uv.y, MinF.y, MinMax.w);
#endif
return uv_out;
}
mat4 sample_4c(vec4 uv)
{
mat4 c;
@ -211,10 +205,12 @@ vec4 sample_color(vec2 st, float q)
mat4 c;
vec2 dd;
#if (PS_LTF == 0 && PS_FMT <= FMT_16 && PS_WMS < 3 && PS_WMT < 3)
c[0] = sample_c(clampuv(st));
// FIXME I'm not sure this condition is useful (I think code will be optimized)
#if (PS_LTF == 0 && PS_FMT == FMT_32 && PS_WMS < 2 && PS_WMT < 2)
// No software LTF and pure 32 bits RGBA texure without special texture wrapping
c[0] = sample_c(st);
#ifdef TEX_COORD_DEBUG
c[0].rg = clampuv(st).xy;
c[0].rg = st.xy;
#endif
#else
@ -230,7 +226,7 @@ vec4 sample_color(vec2 st, float q)
uv = st.xyxy;
}
uv = wrapuv(uv);
uv = clamp_wrap_uv(uv);
if((PS_FMT & FMT_PAL) != 0)
{

View File

@ -922,16 +922,25 @@ static const char* tfx_fs_all_glsl =
"{\n"
" vec3 FogColor;\n"
" float AREF;\n"
"\n"
" vec4 WH;\n"
"\n"
" vec2 MinF;\n"
" vec2 TA;\n"
"\n"
" uvec4 MskFix;\n"
"\n"
" uvec4 FbMask;\n"
" vec3 _not_yet_used;\n"
"\n"
" vec3 _pad1;\n"
" float Af;\n"
"\n"
" vec4 HalfTexel;\n"
"\n"
" vec4 MinMax;\n"
"\n"
" vec2 TC_OffsetHack;\n"
" vec2 _pad2;\n"
"};\n"
"\n"
"vec4 sample_c(vec2 uv)\n"
@ -944,7 +953,7 @@ static const char* tfx_fs_all_glsl =
" return texture(PaletteSampler, vec2(idx, 0.0f));\n"
"}\n"
"\n"
"vec4 wrapuv(vec4 uv)\n"
"vec4 clamp_wrap_uv(vec4 uv)\n"
"{\n"
" vec4 uv_out = uv;\n"
"\n"
@ -979,21 +988,6 @@ static const char* tfx_fs_all_glsl =
" return uv_out;\n"
"}\n"
"\n"
"vec2 clampuv(vec2 uv)\n"
"{\n"
" vec2 uv_out = uv;\n"
"\n"
"#if (PS_WMS == 2) && (PS_WMT == 2)\n"
" uv_out = clamp(uv, MinF, MinMax.zw);\n"
"#elif PS_WMS == 2\n"
" uv_out.x = clamp(uv.x, MinF.x, MinMax.z);\n"
"#elif PS_WMT == 2\n"
" uv_out.y = clamp(uv.y, MinF.y, MinMax.w);\n"
"#endif\n"
"\n"
" return uv_out;\n"
"}\n"
"\n"
"mat4 sample_4c(vec4 uv)\n"
"{\n"
" mat4 c;\n"
@ -1070,10 +1064,12 @@ static const char* tfx_fs_all_glsl =
" mat4 c;\n"
" vec2 dd;\n"
"\n"
"#if (PS_LTF == 0 && PS_FMT <= FMT_16 && PS_WMS < 3 && PS_WMT < 3)\n"
" c[0] = sample_c(clampuv(st));\n"
" // FIXME I'm not sure this condition is useful (I think code will be optimized)\n"
"#if (PS_LTF == 0 && PS_FMT == FMT_32 && PS_WMS < 2 && PS_WMT < 2)\n"
" // No software LTF and pure 32 bits RGBA texure without special texture wrapping\n"
" c[0] = sample_c(st);\n"
"#ifdef TEX_COORD_DEBUG\n"
" c[0].rg = clampuv(st).xy;\n"
" c[0].rg = st.xy;\n"
"#endif\n"
"\n"
"#else\n"
@ -1089,7 +1085,7 @@ static const char* tfx_fs_all_glsl =
" uv = st.xyxy;\n"
" }\n"
"\n"
" uv = wrapuv(uv);\n"
" uv = clamp_wrap_uv(uv);\n"
"\n"
" if((PS_FMT & FMT_PAL) != 0)\n"
" {\n"