GSdx: dq8 fix

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1448 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gabest11 2009-07-01 22:29:24 +00:00
parent 5a292d202d
commit c68802a334
5 changed files with 54 additions and 22 deletions

View File

@ -193,21 +193,19 @@ public:
GSTextureFX::PSConstantBuffer ps_cb;
ps_cb.FogColor_AREF = GSVector4((int)env.FOGCOL.FCR, (int)env.FOGCOL.FCG, (int)env.FOGCOL.FCB, (int)context->TEST.AREF) / 255;
ps_cb.FogColor_AREF = GSVector4((int)env.FOGCOL.FCR, (int)env.FOGCOL.FCG, (int)env.FOGCOL.FCB, 0) / 255;
if(ps_sel.atst == ATST_LESS || ps_sel.atst == ATST_GEQUAL)
switch(ps_sel.atst)
{
ps_cb.FogColor_AREF.a -= 1.0f / 255;
}
else if(ps_sel.atst == ATST_LEQUAL || ps_sel.atst == ATST_GREATER)
{
// example:
// ATST = ATST_GREATER, AREF = 127
// alpha = (int)127.0 => fail
// alpha = (int)127.5 => fail (!)
// alpha = (int)128.0 => pass
ps_cb.FogColor_AREF.a += 1.0f / 255;
case ATST_LESS:
ps_cb.FogColor_AREF.a = (float)((int)context->TEST.AREF - 1);
break;
case ATST_GREATER:
ps_cb.FogColor_AREF.a = (float)((int)context->TEST.AREF + 1);
break;
default:
ps_cb.FogColor_AREF.a = (float)(int)context->TEST.AREF;
break;
}
if(tex)
@ -307,6 +305,19 @@ public:
ps_sel.atst = iatst[ps_sel.atst];
switch(ps_sel.atst)
{
case ATST_LESS:
ps_cb.FogColor_AREF.a = (float)((int)context->TEST.AREF - 1);
break;
case ATST_GREATER:
ps_cb.FogColor_AREF.a = (float)((int)context->TEST.AREF + 1);
break;
default:
ps_cb.FogColor_AREF.a = (float)(int)context->TEST.AREF;
break;
}
m_tfx->UpdatePS(ps_sel, &ps_cb, ps_ssel);
bool z = om_dssel.zwe;

View File

@ -802,10 +802,11 @@ void GSTextureCache::SourceMap::Add(Source* s, const GIFRegTEX0& TEX0)
for(int i = 0; i < countof(m_pages); i++)
{
if(m_pages[i])
if(uint32 p = m_pages[i])
{
m_pages[i] = 0;
hash_map<Source*, bool>* m = &m_map[i << 5];
uint32 p = m_pages[i];
for(int j = 0; j < 32; j++)
{
@ -814,8 +815,6 @@ void GSTextureCache::SourceMap::Add(Source* s, const GIFRegTEX0& TEX0)
m[j][s] = true;
}
}
m_pages[i] = 0;
}
}
}

View File

@ -25,6 +25,7 @@
GSTextureCacheSW::GSTextureCacheSW(GSState* state)
: m_state(state)
{
memset(m_pages, 0, sizeof(m_pages));
}
GSTextureCacheSW::~GSTextureCacheSW()
@ -85,7 +86,25 @@ const GSTextureCacheSW::GSTexture* GSTextureCacheSW::Lookup(const GIFRegTEX0& TE
if(page < MAX_PAGES)
{
m_map[page][t] = true;
m_pages[page >> 5] |= 1 << (page & 31);
}
}
}
for(int i = 0; i < countof(m_pages); i++)
{
if(uint32 p = m_pages[i])
{
m_pages[i] = 0;
hash_map<GSTexture*, bool>* m = &m_map[i << 5];
for(int j = 0; j < 32; j++)
{
if(p & (1 << j))
{
m[j][t] = true;
}
}
}
}

View File

@ -48,6 +48,7 @@ protected:
GSState* m_state;
hash_map<GSTexture*, bool> m_textures;
hash_map<GSTexture*, bool> m_map[MAX_PAGES];
uint32 m_pages[16];
public:
GSTextureCacheSW(GSState* state);

View File

@ -299,25 +299,27 @@ void atst(float4 c)
{
if(PS_ATE == 1)
{
float a = trunc(c.a * 255);
if(PS_ATST == 0)
{
discard;
}
else if(PS_ATST == 2 || PS_ATST == 3) // l, le
{
clip(AREF - c.a);
clip(AREF - a);
}
else if(PS_ATST == 4) // e
{
clip(0.6f / 255 - abs(c.a - AREF)); // FIXME: 0.5f is too small
clip(0.5f - abs(a - AREF));
}
else if(PS_ATST == 5 || PS_ATST == 6) // ge, g
{
clip(c.a - AREF);
clip(a - AREF);
}
else if(PS_ATST == 7) // ne
{
clip(abs(c.a - AREF) - 0.4f / 255); // FIXME: 0.5f is too much
clip(abs(a - AREF) - 0.5f);
}
}
}