GSdx: couple of fixes for the new palletized lookup mode

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1475 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gabest11 2009-07-07 10:57:04 +00:00
parent d9963bb54e
commit a7ce451167
3 changed files with 33 additions and 22 deletions

View File

@ -846,16 +846,16 @@ void GSDevice9::PSSetSamplerState(Direct3DSamplerState9* ss)
m_dev->SetSamplerState(0, D3DSAMP_ADDRESSU, ss->AddressU); m_dev->SetSamplerState(0, D3DSAMP_ADDRESSU, ss->AddressU);
m_dev->SetSamplerState(0, D3DSAMP_ADDRESSV, ss->AddressV); m_dev->SetSamplerState(0, D3DSAMP_ADDRESSV, ss->AddressV);
m_dev->SetSamplerState(1, D3DSAMP_ADDRESSU, ss->AddressU); m_dev->SetSamplerState(1, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
m_dev->SetSamplerState(1, D3DSAMP_ADDRESSV, ss->AddressV); m_dev->SetSamplerState(1, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
m_dev->SetSamplerState(2, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP); m_dev->SetSamplerState(2, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
m_dev->SetSamplerState(2, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP); m_dev->SetSamplerState(2, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
m_dev->SetSamplerState(3, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP); m_dev->SetSamplerState(3, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
m_dev->SetSamplerState(3, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP); m_dev->SetSamplerState(3, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
m_dev->SetSamplerState(0, D3DSAMP_MINFILTER, ss->FilterMin[0]); m_dev->SetSamplerState(0, D3DSAMP_MINFILTER, ss->FilterMin[0]);
m_dev->SetSamplerState(0, D3DSAMP_MAGFILTER, ss->FilterMag[0]); m_dev->SetSamplerState(0, D3DSAMP_MAGFILTER, ss->FilterMag[0]);
m_dev->SetSamplerState(1, D3DSAMP_MINFILTER, ss->FilterMin[1]); m_dev->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_POINT);
m_dev->SetSamplerState(1, D3DSAMP_MAGFILTER, ss->FilterMag[1]); m_dev->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
m_dev->SetSamplerState(2, D3DSAMP_MINFILTER, D3DTEXF_POINT); m_dev->SetSamplerState(2, D3DSAMP_MINFILTER, D3DTEXF_POINT);
m_dev->SetSamplerState(2, D3DSAMP_MAGFILTER, D3DTEXF_POINT); m_dev->SetSamplerState(2, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
m_dev->SetSamplerState(3, D3DSAMP_MINFILTER, D3DTEXF_POINT); m_dev->SetSamplerState(3, D3DSAMP_MINFILTER, D3DTEXF_POINT);

View File

@ -248,19 +248,19 @@ public:
switch(context->CLAMP.WMS) switch(context->CLAMP.WMS)
{ {
case 0: case CLAMP_REPEAT:
ps_ssel.tau = 1; ps_ssel.tau = 1;
break; break;
case 1: case CLAMP_CLAMP:
ps_ssel.tau = 0; ps_ssel.tau = 0;
break; break;
case 2: case CLAMP_REGION_CLAMP:
ps_cb.MinMax.x = ((float)(int)context->CLAMP.MINU) / (1 << context->TEX0.TW); ps_cb.MinMax.x = ((float)(int)context->CLAMP.MINU) / (1 << context->TEX0.TW);
ps_cb.MinMax.z = ((float)(int)context->CLAMP.MAXU) / (1 << context->TEX0.TW); ps_cb.MinMax.z = ((float)(int)context->CLAMP.MAXU) / (1 << context->TEX0.TW);
ps_cb.MinF_TA.x = ((float)(int)context->CLAMP.MINU + 0.5f) / (1 << context->TEX0.TW); ps_cb.MinF_TA.x = ((float)(int)context->CLAMP.MINU + 0.5f) / (1 << context->TEX0.TW);
ps_ssel.tau = 0; ps_ssel.tau = 0;
break; break;
case 3: case CLAMP_REGION_REPEAT:
ps_cb.MskFix.x = context->CLAMP.MINU; ps_cb.MskFix.x = context->CLAMP.MINU;
ps_cb.MskFix.z = context->CLAMP.MAXU; ps_cb.MskFix.z = context->CLAMP.MAXU;
ps_ssel.tau = 1; ps_ssel.tau = 1;
@ -271,19 +271,19 @@ public:
switch(context->CLAMP.WMT) switch(context->CLAMP.WMT)
{ {
case 0: case CLAMP_REPEAT:
ps_ssel.tav = 1; ps_ssel.tav = 1;
break; break;
case 1: case CLAMP_CLAMP:
ps_ssel.tav = 0; ps_ssel.tav = 0;
break; break;
case 2: case CLAMP_REGION_CLAMP:
ps_cb.MinMax.y = ((float)(int)context->CLAMP.MINV) / (1 << context->TEX0.TH); ps_cb.MinMax.y = ((float)(int)context->CLAMP.MINV) / (1 << context->TEX0.TH);
ps_cb.MinMax.w = ((float)(int)context->CLAMP.MAXV) / (1 << context->TEX0.TH); ps_cb.MinMax.w = ((float)(int)context->CLAMP.MAXV) / (1 << context->TEX0.TH);
ps_cb.MinF_TA.y = ((float)(int)context->CLAMP.MINV + 0.5f) / (1 << context->TEX0.TH); ps_cb.MinF_TA.y = ((float)(int)context->CLAMP.MINV + 0.5f) / (1 << context->TEX0.TH);
ps_ssel.tav = 0; ps_ssel.tav = 0;
break; break;
case 3: case CLAMP_REGION_REPEAT:
ps_cb.MskFix.y = context->CLAMP.MINV; ps_cb.MskFix.y = context->CLAMP.MINV;
ps_cb.MskFix.w = context->CLAMP.MAXV; ps_cb.MskFix.w = context->CLAMP.MAXV;
ps_ssel.tav = 1; ps_ssel.tav = 1;

View File

@ -307,7 +307,7 @@ float4 sample_4a(float4 uv)
float4x4 sample_4p(float4 u) float4x4 sample_4p(float4 u)
{ {
float4x4 c; float4x4 c;
c[0] = sample_p(u.x); c[0] = sample_p(u.x);
c[1] = sample_p(u.y); c[1] = sample_p(u.y);
c[2] = sample_p(u.z); c[2] = sample_p(u.z);
@ -316,29 +316,40 @@ float4x4 sample_4p(float4 u)
return c; return c;
} }
float4 sample(float2 tc, float w) float4 sample(float2 st, float q)
{ {
if(!PS_FST) if(!PS_FST)
{ {
tc /= w; st /= q;
} }
float4 t; float4 t;
/* /*
if(PS_FMT <= FMT_16 && PS_WMS < 2 && PS_WMT < 2) if(PS_FMT <= FMT_16 && PS_WMS < 2 && PS_WMT < 2)
{ {
t = sample_c(tc); t = sample_c(st);
} }
*/ */
if(PS_FMT <= FMT_16 && PS_WMS < 3 && PS_WMT < 3) if(PS_FMT <= FMT_16 && PS_WMS < 3 && PS_WMT < 3)
{ {
t = sample_c(clampuv(tc)); t = sample_c(clampuv(st));
} }
else else
{ {
float4 uv2 = tc.xyxy + HalfTexel; float4 uv;
float2 dd = frac(uv2.xy * WH.zw); float2 dd;
float4 uv = wrapuv(uv2);
if(PS_LTF)
{
uv = st.xyxy + HalfTexel;
dd = frac(uv.xy * WH.zw);
}
else
{
uv = st.xyxy;
}
uv = wrapuv(uv);
float4x4 c; float4x4 c;
@ -651,7 +662,7 @@ VS_OUTPUT vs_main(VS_INPUT input)
else if(VS_BPPZ == 2) // 16 else if(VS_BPPZ == 2) // 16
{ {
input.p.z = fmod(input.p.z, 0x10000); input.p.z = fmod(input.p.z, 0x10000);
} }
VS_OUTPUT output; VS_OUTPUT output;
@ -659,7 +670,7 @@ VS_OUTPUT vs_main(VS_INPUT input)
// example: ceil(afterseveralvertextransformations(y = 133)) => 134 => line 133 stays empty // example: ceil(afterseveralvertextransformations(y = 133)) => 134 => line 133 stays empty
// input granularity is 1/16 pixel, anything smaller than that won't step drawing up/left by one pixel // input granularity is 1/16 pixel, anything smaller than that won't step drawing up/left by one pixel
// example: 133.0625 (133 + 1/16) should start from line 134, ceil(133.0625 - 0.05) still above 133 // example: 133.0625 (133 + 1/16) should start from line 134, ceil(133.0625 - 0.05) still above 133
float4 p = input.p - float4(0.05f, 0.05f, 0, 0); float4 p = input.p - float4(0.05f, 0.05f, 0, 0);
output.p = p * VertexScale - VertexOffset; output.p = p * VertexScale - VertexOffset;