mirror of https://github.com/PCSX2/pcsx2.git
GSdx: there was a float-int conversion overflow in vertex trace, texture coord min/max could have been detected wrong, silent hill origins should look better now.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5097 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
67ef781116
commit
5d9a5b6ee6
|
@ -221,6 +221,7 @@ GSLocalMemory::GSLocalMemory()
|
||||||
m_psm[i].pgs = GSVector2i(64, 32);
|
m_psm[i].pgs = GSVector2i(64, 32);
|
||||||
for(int j = 0; j < 8; j++) m_psm[i].rowOffset[j] = rowOffset32;
|
for(int j = 0; j < 8; j++) m_psm[i].rowOffset[j] = rowOffset32;
|
||||||
m_psm[i].blockOffset = blockOffset32;
|
m_psm[i].blockOffset = blockOffset32;
|
||||||
|
m_psm[i].msk = 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_psm[PSM_PSMCT16].pa = &GSLocalMemory::PixelAddress16;
|
m_psm[PSM_PSMCT16].pa = &GSLocalMemory::PixelAddress16;
|
||||||
|
@ -440,6 +441,12 @@ GSLocalMemory::GSLocalMemory()
|
||||||
m_psm[PSM_PSMZ24].blockOffset = blockOffset32Z;
|
m_psm[PSM_PSMZ24].blockOffset = blockOffset32Z;
|
||||||
m_psm[PSM_PSMZ16].blockOffset = blockOffset16Z;
|
m_psm[PSM_PSMZ16].blockOffset = blockOffset16Z;
|
||||||
m_psm[PSM_PSMZ16S].blockOffset = blockOffset16SZ;
|
m_psm[PSM_PSMZ16S].blockOffset = blockOffset16SZ;
|
||||||
|
|
||||||
|
m_psm[PSM_PSMCT24].msk = 0x3f;
|
||||||
|
m_psm[PSM_PSMZ24].msk = 0x3f;
|
||||||
|
m_psm[PSM_PSMT8H].msk = 0xc0;
|
||||||
|
m_psm[PSM_PSMT4HL].msk = 0x40;
|
||||||
|
m_psm[PSM_PSMT4HH].msk = 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
GSLocalMemory::~GSLocalMemory()
|
GSLocalMemory::~GSLocalMemory()
|
||||||
|
|
|
@ -111,6 +111,7 @@ public:
|
||||||
GSVector2i bs, pgs;
|
GSVector2i bs, pgs;
|
||||||
int* rowOffset[8];
|
int* rowOffset[8];
|
||||||
short* blockOffset;
|
short* blockOffset;
|
||||||
|
uint8 msk;
|
||||||
};
|
};
|
||||||
|
|
||||||
static psm_t m_psm[64];
|
static psm_t m_psm[64];
|
||||||
|
|
|
@ -426,21 +426,9 @@ void GSRendererSW::Draw()
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
if(LOG)
|
|
||||||
{
|
|
||||||
fprintf(s_fp, "[%d] queue %05x %d (%d) %05x %d (%d) %05x %d %dx%d (%d %d %d) | %d %d %d\n",
|
|
||||||
sd->counter,
|
|
||||||
m_context->FRAME.Block(), m_context->FRAME.PSM, gd.sel.fwrite,
|
|
||||||
m_context->ZBUF.Block(), m_context->ZBUF.PSM, gd.sel.zwrite,
|
|
||||||
PRIM->TME ? m_context->TEX0.TBP0 : 0xfffff, m_context->TEX0.PSM, (int)m_context->TEX0.TW, (int)m_context->TEX0.TH, m_context->TEX0.CSM, m_context->TEX0.CPSM, m_context->TEX0.CSA,
|
|
||||||
PRIM->PRIM, sd->vertex_count, sd->index_count);
|
|
||||||
|
|
||||||
fflush(s_fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(s_dump)
|
if(s_dump)
|
||||||
{
|
{
|
||||||
Sync(3);
|
Sync(2);
|
||||||
|
|
||||||
uint64 frame = m_perfmon.GetFrame();
|
uint64 frame = m_perfmon.GetFrame();
|
||||||
|
|
||||||
|
@ -473,7 +461,7 @@ void GSRendererSW::Draw()
|
||||||
|
|
||||||
Queue(data);
|
Queue(data);
|
||||||
|
|
||||||
Sync(4);
|
Sync(3);
|
||||||
|
|
||||||
if(s_save && s_n >= s_saven)
|
if(s_save && s_n >= s_saven)
|
||||||
{
|
{
|
||||||
|
@ -514,13 +502,34 @@ void GSRendererSW::Queue(shared_ptr<GSRasterizerData>& item)
|
||||||
|
|
||||||
if(sd->m_syncpoint == SharedData::SyncSource)
|
if(sd->m_syncpoint == SharedData::SyncSource)
|
||||||
{
|
{
|
||||||
m_rl->Sync();
|
Sync(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update previously invalidated parts
|
// update previously invalidated parts
|
||||||
|
|
||||||
sd->UpdateSource();
|
sd->UpdateSource();
|
||||||
|
|
||||||
|
if(sd->m_syncpoint == SharedData::SyncTarget)
|
||||||
|
{
|
||||||
|
Sync(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LOG)
|
||||||
|
{
|
||||||
|
GSScanlineGlobalData& gd = ((SharedData*)item.get())->global;
|
||||||
|
|
||||||
|
fprintf(s_fp, "[%d] queue %05x %d (%d) %05x %d (%d) %05x %d %dx%d (%d %d %d) | %d %d %d\n",
|
||||||
|
sd->counter,
|
||||||
|
m_context->FRAME.Block(), m_context->FRAME.PSM, gd.sel.fwrite,
|
||||||
|
m_context->ZBUF.Block(), m_context->ZBUF.PSM, gd.sel.zwrite,
|
||||||
|
PRIM->TME ? m_context->TEX0.TBP0 : 0xfffff, m_context->TEX0.PSM, (int)m_context->TEX0.TW, (int)m_context->TEX0.TH, m_context->TEX0.CSM, m_context->TEX0.CPSM, m_context->TEX0.CSA,
|
||||||
|
PRIM->PRIM, sd->vertex_count, sd->index_count);
|
||||||
|
|
||||||
|
fflush(s_fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_rl->Queue(item);
|
||||||
|
|
||||||
// invalidate new parts rendered onto
|
// invalidate new parts rendered onto
|
||||||
|
|
||||||
if(sd->global.sel.fwrite)
|
if(sd->global.sel.fwrite)
|
||||||
|
@ -532,13 +541,6 @@ void GSRendererSW::Queue(shared_ptr<GSRasterizerData>& item)
|
||||||
{
|
{
|
||||||
m_tc->InvalidatePages(sd->m_zb_pages, sd->m_zpsm);
|
m_tc->InvalidatePages(sd->m_zb_pages, sd->m_zpsm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sd->m_syncpoint == SharedData::SyncTarget)
|
|
||||||
{
|
|
||||||
m_rl->Sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rl->Queue(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSRendererSW::Sync(int reason)
|
void GSRendererSW::Sync(int reason)
|
||||||
|
@ -597,7 +599,7 @@ void GSRendererSW::InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GS
|
||||||
{
|
{
|
||||||
if(m_fzb_pages[*p] | m_tex_pages[*p])
|
if(m_fzb_pages[*p] | m_tex_pages[*p])
|
||||||
{
|
{
|
||||||
Sync(5);
|
Sync(6);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1066,12 +1068,6 @@ bool GSRendererSW::GetScanlineGlobalData(SharedData* data)
|
||||||
|
|
||||||
static int s_counter = 0;
|
static int s_counter = 0;
|
||||||
|
|
||||||
if(0)
|
|
||||||
//if(context->TEX0.TH > context->TEX0.TW)
|
|
||||||
//if(s_n >= s_saven && s_n < s_saven + 3)
|
|
||||||
//if(context->TEX0.TBP0 >= 0x2b80 && context->TEX0.TBW == 2 && context->TEX0.PSM == PSM_PSMT4)
|
|
||||||
t->Save(format("c:/temp1/%08d_%05x_0.bmp", s_counter, context->TEX0.TBP0));
|
|
||||||
|
|
||||||
for(int i = 1, j = std::min<int>((int)context->TEX1.MXL, 6); i <= j; i++)
|
for(int i = 1, j = std::min<int>((int)context->TEX1.MXL, 6); i <= j; i++)
|
||||||
{
|
{
|
||||||
switch(i)
|
switch(i)
|
||||||
|
@ -1473,21 +1469,37 @@ void GSRendererSW::SharedData::UpdateSource()
|
||||||
|
|
||||||
global.sel.tfx = TFX_NONE;
|
global.sel.tfx = TFX_NONE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
if(m_parent->s_dump)
|
if(m_parent->s_dump)
|
||||||
|
{
|
||||||
|
uint64 frame = m_parent->m_perfmon.GetFrame();
|
||||||
|
|
||||||
|
string s;
|
||||||
|
|
||||||
|
if(m_parent->s_save && m_parent->s_n >= m_parent->s_saven)
|
||||||
{
|
{
|
||||||
uint64 frame = m_parent->m_perfmon.GetFrame();
|
for(size_t i = 0; m_tex[i].t != NULL; i++)
|
||||||
|
|
||||||
string s;
|
|
||||||
|
|
||||||
if(m_parent->s_save && m_parent->s_n >= m_parent->s_saven)
|
|
||||||
{
|
{
|
||||||
s = format("c:\\temp1\\_%05d_f%lld_tex%d_%05x_%d.bmp", m_parent->s_n - 2, frame, i, (int)m_parent->m_context->TEX0.TBP0, (int)m_parent->m_context->TEX0.PSM);
|
s = format("c:\\temp1\\_%05d_f%lld_tex%d_%05x_%d.bmp", m_parent->s_n - 2, frame, i, (int)m_parent->m_context->TEX0.TBP0, (int)m_parent->m_context->TEX0.PSM);
|
||||||
|
|
||||||
m_tex[i].t->Save(s);
|
m_tex[i].t->Save(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(global.clut != NULL)
|
||||||
|
{
|
||||||
|
GSTextureSW* t = new GSTextureSW(0, 256, 1);
|
||||||
|
|
||||||
|
t->Update(GSVector4i(0, 0, 256, 1), global.clut, sizeof(uint32) * 256);
|
||||||
|
|
||||||
|
s = format("c:\\temp1\\_%05d_f%lld_texp_%05x_%d.bmp", m_parent->s_n - 2, frame, (int)m_parent->m_context->TEX0.TBP0, (int)m_parent->m_context->TEX0.PSM);
|
||||||
|
|
||||||
|
t->Save(s);
|
||||||
|
|
||||||
|
delete t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2518,10 +2518,10 @@ void GSState::GetTextureMinMax(GSVector4i& r, const GIFRegTEX0& TEX0, const GIFR
|
||||||
|
|
||||||
if(linear)
|
if(linear)
|
||||||
{
|
{
|
||||||
st += GSVector4(-0x8000, 0x8000).xxyy();
|
st += GSVector4(-0.5f, 0.5f).xxyy();
|
||||||
}
|
}
|
||||||
|
|
||||||
GSVector4i uv = GSVector4i(st).sra32(16);
|
GSVector4i uv = GSVector4i(st);
|
||||||
|
|
||||||
GSVector4i u, v;
|
GSVector4i u, v;
|
||||||
|
|
||||||
|
|
|
@ -363,7 +363,7 @@ bool GSTextureCacheSW::Texture::Save(const string& fn, bool dds) const
|
||||||
{
|
{
|
||||||
for(int i = 0; i < w; i++)
|
for(int i = 0; i < w; i++)
|
||||||
{
|
{
|
||||||
((uint32*)m.bits)[i] = clut[((uint8*)src)[i]];
|
((uint32*)m.bits)[i] = clut[src[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -455,11 +455,11 @@ void GSVertexTrace::FindMinMax(const void* vertex, const uint32* index, int coun
|
||||||
{
|
{
|
||||||
if(fst)
|
if(fst)
|
||||||
{
|
{
|
||||||
s = GSVector4(1 << (16 - 4), 1).xxyy();
|
s = GSVector4(1.0f / 16, 1.0f).xxyy();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s = GSVector4(0x10000 << context->TEX0.TW, 0x10000 << context->TEX0.TH, 1, 1);
|
s = GSVector4(1 << context->TEX0.TW, 1 << context->TEX0.TH, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_min.t = tmin * s;
|
m_min.t = tmin * s;
|
||||||
|
|
|
@ -32,7 +32,7 @@ class GSState;
|
||||||
__aligned(class, 32) GSVertexTrace : public GSAlignedClass<32>
|
__aligned(class, 32) GSVertexTrace : public GSAlignedClass<32>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct Vertex {GSVector4i c; GSVector4 p, t;}; // t.xy * 0x10000
|
struct Vertex {GSVector4i c; GSVector4 p, t;};
|
||||||
struct VertexAlpha {int min, max; bool valid;};
|
struct VertexAlpha {int min, max; bool valid;};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue