mirror of https://github.com/PCSX2/pcsx2.git
GSDX: fixed an oversight in my shader change gregory caught which removed alpha expansion for the direct sampling case, should probably fix the remaining bugs. Also set the texture sampler to point sampling when the shader will be performing its own bilinear filtering (effect on games unknown but should be an improvement).
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5291 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
b8b451340c
commit
0bf64fdffd
|
@ -276,6 +276,7 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
|
|||
if(tex)
|
||||
{
|
||||
const GSLocalMemory::psm_t &psm = GSLocalMemory::m_psm[context->TEX0.PSM];
|
||||
bool bilinear = m_filter == 2 ? m_vt.IsLinear() : m_filter;
|
||||
|
||||
ps_sel.wms = context->CLAMP.WMS;
|
||||
ps_sel.wmt = context->CLAMP.WMT;
|
||||
|
@ -289,7 +290,7 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
|
|||
ps_sel.aem = env.TEXA.AEM;
|
||||
ps_sel.tfx = context->TEX0.TFX;
|
||||
ps_sel.tcc = context->TEX0.TCC;
|
||||
ps_sel.ltf = m_filter == 2 ? m_vt.IsLinear() : m_filter;
|
||||
ps_sel.ltf = bilinear && !(ps_sel.fmt <= 2 && ps_sel.wms < 3 && ps_sel.wmt < 3);
|
||||
ps_sel.rt = tex->m_target;
|
||||
ps_sel.spritehack = tex->m_spritehack_t;
|
||||
|
||||
|
@ -321,7 +322,7 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
|
|||
|
||||
ps_ssel.tau = (context->CLAMP.WMS + 3) >> 1;
|
||||
ps_ssel.tav = (context->CLAMP.WMT + 3) >> 1;
|
||||
ps_ssel.ltf = ps_sel.ltf;
|
||||
ps_ssel.ltf = bilinear && ps_sel.fmt <= 2 && ps_sel.wms < 3 && ps_sel.wmt < 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -358,20 +358,22 @@ float4 sample(float2 st, float q)
|
|||
}
|
||||
|
||||
float4 t;
|
||||
float4x4 c;
|
||||
float2 dd;
|
||||
|
||||
/*
|
||||
if(PS_FMT <= FMT_16 && PS_WMS < 2 && PS_WMT < 2)
|
||||
{
|
||||
t = sample_c(st);
|
||||
c[0] = sample_c(st);
|
||||
}
|
||||
*/
|
||||
if(PS_FMT <= FMT_16 && PS_WMS < 3 && PS_WMT < 3)
|
||||
{
|
||||
t = sample_c(clampuv(st));
|
||||
c[0] = sample_c(clampuv(st));
|
||||
}
|
||||
else
|
||||
{
|
||||
float4 uv;
|
||||
float2 dd;
|
||||
|
||||
if(PS_LTF)
|
||||
{
|
||||
|
@ -385,8 +387,6 @@ float4 sample(float2 st, float q)
|
|||
|
||||
uv = wrapuv(uv);
|
||||
|
||||
float4x4 c;
|
||||
|
||||
if(PS_FMT & FMT_PAL)
|
||||
{
|
||||
c = sample_4p(sample_4a(uv));
|
||||
|
@ -395,33 +395,34 @@ float4 sample(float2 st, float q)
|
|||
{
|
||||
c = sample_4c(uv);
|
||||
}
|
||||
}
|
||||
|
||||
for (uint i = 0; i < 4; i++)
|
||||
[unroll]
|
||||
for (uint i = 0; i < 4; i++)
|
||||
{
|
||||
if((PS_FMT & ~FMT_PAL) == FMT_32)
|
||||
{
|
||||
if((PS_FMT & ~FMT_PAL) == FMT_32)
|
||||
{
|
||||
#if SHADER_MODEL <= 0x300
|
||||
if(PS_RT) c[i].a *= 128.0f / 255;
|
||||
#endif
|
||||
}
|
||||
else if((PS_FMT & ~FMT_PAL) == FMT_24)
|
||||
{
|
||||
c[i].a = !PS_AEM || any(c[i].rgb) ? TA.x : 0;
|
||||
}
|
||||
else if((PS_FMT & ~FMT_PAL) == FMT_16)
|
||||
{
|
||||
c[i].a = c[i].a >= 0.5 ? TA.y : !PS_AEM || any(c[i].rgb) ? TA.x : 0;
|
||||
}
|
||||
#if SHADER_MODEL <= 0x300
|
||||
if(PS_RT) c[i].a *= 128.0f / 255;
|
||||
#endif
|
||||
}
|
||||
else if((PS_FMT & ~FMT_PAL) == FMT_24)
|
||||
{
|
||||
c[i].a = !PS_AEM || any(c[i].rgb) ? TA.x : 0;
|
||||
}
|
||||
else if((PS_FMT & ~FMT_PAL) == FMT_16)
|
||||
{
|
||||
c[i].a = c[i].a >= 0.5 ? TA.y : !PS_AEM || any(c[i].rgb) ? TA.x : 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(PS_LTF)
|
||||
{
|
||||
t = lerp(lerp(c[0], c[1], dd.x), lerp(c[2], c[3], dd.x), dd.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
t = c[0];
|
||||
}
|
||||
if(PS_LTF)
|
||||
{
|
||||
t = lerp(lerp(c[0], c[1], dd.x), lerp(c[2], c[3], dd.x), dd.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
t = c[0];
|
||||
}
|
||||
|
||||
return t;
|
||||
|
|
Loading…
Reference in New Issue