mirror of
https://github.com/PCSX2/gsdx-sourceforge.git
synced 2026-02-04 03:11:19 +01:00
This commit is contained in:
@@ -57,14 +57,12 @@ public:
|
||||
|
||||
CRect GetDisplayRect()
|
||||
{
|
||||
static int s_width[] = {256, 320, 512, 640, 384, 320, 320, 320};
|
||||
static int s_width[] = {256, 320, 512, 640, 368, 384, 512, 640};
|
||||
static int s_height[] = {240, 480};
|
||||
|
||||
// FIXME: mgs, tekken3
|
||||
|
||||
CRect r;
|
||||
|
||||
r.left = DAREA.X & ~7;
|
||||
r.left = DAREA.X & ~7; // FIXME
|
||||
r.top = DAREA.Y;
|
||||
r.right = r.left + s_width[(STATUS.WIDTH1 << 2) | STATUS.WIDTH0];
|
||||
r.bottom = r.top + (DVRANGE.Y2 - DVRANGE.Y1) * s_height[STATUS.HEIGHT] / 240;
|
||||
|
||||
@@ -33,7 +33,7 @@ GPURasterizer::GPURasterizer(GPUState* state, int id, int threads)
|
||||
{
|
||||
m_ds[i] = &GPURasterizer::DrawScanline;
|
||||
}
|
||||
|
||||
/*
|
||||
m_ds[0x00] = &GPURasterizer::DrawScanlineEx<0x00>;
|
||||
m_ds[0x01] = &GPURasterizer::DrawScanlineEx<0x01>;
|
||||
m_ds[0x02] = &GPURasterizer::DrawScanlineEx<0x02>;
|
||||
@@ -546,6 +546,7 @@ GPURasterizer::GPURasterizer(GPUState* state, int id, int threads)
|
||||
m_ds[0x1fd] = &GPURasterizer::DrawScanlineEx<0x1fd>;
|
||||
m_ds[0x1fe] = &GPURasterizer::DrawScanlineEx<0x1fe>;
|
||||
m_ds[0x1ff] = &GPURasterizer::DrawScanlineEx<0x1ff>;
|
||||
*/
|
||||
}
|
||||
|
||||
GPURasterizer::~GPURasterizer()
|
||||
@@ -580,6 +581,7 @@ int GPURasterizer::Draw(Vertex* vertices, int count, const void* texture)
|
||||
m_sel.tme = env.PRIM.TME;
|
||||
m_sel.tlu = env.STATUS.TP < 2;
|
||||
m_sel.twin = (env.TWIN.ai32 & 0xfffff) != 0;
|
||||
m_sel.dtd = env.STATUS.DTD;
|
||||
m_sel.ltf = 1; // TODO
|
||||
|
||||
m_dsf = m_ds[m_sel];
|
||||
@@ -1049,6 +1051,14 @@ void GPURasterizer::SetupScanline(const Vertex& dv)
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(align(16)) static WORD s_dither[4][16] =
|
||||
{
|
||||
{7, 0, 6, 1, 7, 0, 6, 1, 7, 0, 6, 1, 7, 0, 6, 1},
|
||||
{2, 5, 3, 4, 2, 5, 3, 4, 2, 5, 3, 4, 2, 5, 3, 4},
|
||||
{1, 6, 0, 7, 1, 6, 0, 7, 1, 6, 0, 7, 1, 6, 0, 7},
|
||||
{4, 3, 5, 2, 4, 3, 5, 2, 4, 3, 5, 2, 4, 3, 5, 2},
|
||||
};
|
||||
|
||||
void GPURasterizer::DrawScanline(int top, int left, int right, const Vertex& v)
|
||||
{
|
||||
GSVector4 ps0123 = GSVector4::ps0123();
|
||||
@@ -1091,6 +1101,13 @@ void GPURasterizer::DrawScanline(int top, int left, int right, const Vertex& v)
|
||||
b[1] += dc.zzzz() * ps4567;
|
||||
}
|
||||
|
||||
GSVector4i dither;
|
||||
|
||||
if(m_sel.dtd)
|
||||
{
|
||||
dither = GSVector4i::load<false>(&s_dither[top & 3][left & 3]);
|
||||
}
|
||||
|
||||
int steps = right - left;
|
||||
|
||||
m_slenv.steps += steps;
|
||||
@@ -1136,6 +1153,13 @@ void GPURasterizer::DrawScanline(int top, int left, int right, const Vertex& v)
|
||||
AlphaBlend(m_sel.abr, m_sel.tme, d, c);
|
||||
}
|
||||
|
||||
if(m_sel.dtd)
|
||||
{
|
||||
c[0] = c[0].addus8(dither);
|
||||
c[1] = c[1].addus8(dither);
|
||||
c[2] = c[2].addus8(dither);
|
||||
}
|
||||
|
||||
WriteFrame(fb, test, c, pixels);
|
||||
}
|
||||
while(0);
|
||||
@@ -1224,6 +1248,13 @@ void GPURasterizer::DrawScanlineEx(int top, int left, int right, const Vertex& v
|
||||
b[1] += dc.zzzz() * ps4567;
|
||||
}
|
||||
|
||||
GSVector4i dither;
|
||||
|
||||
if(m_sel.dtd)
|
||||
{
|
||||
dither = GSVector4i::load<false>(&s_dither[top & 3][left & 3]);
|
||||
}
|
||||
|
||||
int steps = right - left;
|
||||
|
||||
m_slenv.steps += steps;
|
||||
@@ -1269,6 +1300,13 @@ void GPURasterizer::DrawScanlineEx(int top, int left, int right, const Vertex& v
|
||||
AlphaBlend(abr, tme, d, c);
|
||||
}
|
||||
|
||||
if(m_sel.dtd)
|
||||
{
|
||||
c[0] = c[0].addus8(dither);
|
||||
c[1] = c[1].addus8(dither);
|
||||
c[2] = c[2].addus8(dither);
|
||||
}
|
||||
|
||||
WriteFrame(fb, test, c, pixels);
|
||||
}
|
||||
while(0);
|
||||
|
||||
@@ -49,8 +49,8 @@ private:
|
||||
DWORD tme:1; // 6
|
||||
DWORD tlu:1; // 7
|
||||
DWORD twin:1; // 8
|
||||
DWORD ltf:1; // 9
|
||||
// DWORD dtd:1; // 10
|
||||
DWORD dtd:1; // 9
|
||||
DWORD ltf:1; // 10
|
||||
// DWORD dte:1: // 11
|
||||
};
|
||||
|
||||
|
||||
@@ -69,16 +69,20 @@ protected:
|
||||
|
||||
if(m_env.STATUS.ISRGB24)
|
||||
{
|
||||
for(int i = r.top; i < r.bottom; i++)
|
||||
DWORD* dst = buff;
|
||||
|
||||
for(int i = r.top; i < r.bottom; i++, dst += 1024)
|
||||
{
|
||||
m_mem.Expand24(&m_mem.m_vm16[(i << 10) + r.left], &buff[i << 10], r.Width());
|
||||
m_mem.Expand24(&m_mem.m_vm16[(i << 10) + r.left], dst, r.Width());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i = r.top; i < r.bottom; i++)
|
||||
DWORD* dst = buff;
|
||||
|
||||
for(int i = r.top; i < r.bottom; i++, dst += 1024)
|
||||
{
|
||||
m_mem.Expand16(&m_mem.m_vm16[(i << 10) + r.left], &buff[i << 10], r.Width());
|
||||
m_mem.Expand16(&m_mem.m_vm16[(i << 10) + r.left], dst, r.Width());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ protected:
|
||||
|
||||
if(inc) s_n++;
|
||||
|
||||
if(s_n < 133) return;
|
||||
//if(s_n < 133) return;
|
||||
|
||||
int dir = 1;
|
||||
#ifdef DEBUG
|
||||
|
||||
@@ -568,6 +568,26 @@ public:
|
||||
return GSVector4i(_mm_add_epi32(m, v.m));
|
||||
}
|
||||
|
||||
GSVector4i adds8(const GSVector4i& v) const
|
||||
{
|
||||
return GSVector4i(_mm_adds_epi8(m, v.m));
|
||||
}
|
||||
|
||||
GSVector4i adds16(const GSVector4i& v) const
|
||||
{
|
||||
return GSVector4i(_mm_adds_epi16(m, v.m));
|
||||
}
|
||||
|
||||
GSVector4i addus8(const GSVector4i& v) const
|
||||
{
|
||||
return GSVector4i(_mm_adds_epu8(m, v.m));
|
||||
}
|
||||
|
||||
GSVector4i addus16(const GSVector4i& v) const
|
||||
{
|
||||
return GSVector4i(_mm_adds_epu16(m, v.m));
|
||||
}
|
||||
|
||||
GSVector4i sub8(const GSVector4i& v) const
|
||||
{
|
||||
return GSVector4i(_mm_sub_epi8(m, v.m));
|
||||
@@ -583,6 +603,26 @@ public:
|
||||
return GSVector4i(_mm_sub_epi32(m, v.m));
|
||||
}
|
||||
|
||||
GSVector4i subs8(const GSVector4i& v) const
|
||||
{
|
||||
return GSVector4i(_mm_subs_epi8(m, v.m));
|
||||
}
|
||||
|
||||
GSVector4i subs16(const GSVector4i& v) const
|
||||
{
|
||||
return GSVector4i(_mm_subs_epi16(m, v.m));
|
||||
}
|
||||
|
||||
GSVector4i subus8(const GSVector4i& v) const
|
||||
{
|
||||
return GSVector4i(_mm_subs_epu8(m, v.m));
|
||||
}
|
||||
|
||||
GSVector4i subus16(const GSVector4i& v) const
|
||||
{
|
||||
return GSVector4i(_mm_subs_epu16(m, v.m));
|
||||
}
|
||||
|
||||
GSVector4i mul16hs(const GSVector4i& v) const
|
||||
{
|
||||
return GSVector4i(_mm_mulhi_epi16(m, v.m));
|
||||
|
||||
Reference in New Issue
Block a user