mirror of
https://github.com/libretro/pcsx2.git
synced 2024-11-28 20:00:44 +00:00
GSdx: just saving minor changes.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4991 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
a2dd83b419
commit
4b77052d21
@ -86,7 +86,7 @@ void GPUDrawScanline::PrintStats()
|
|||||||
m_ds_map.PrintStats();
|
m_ds_map.PrintStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef JIT_DRAW
|
#ifndef ENABLE_JIT_RASTERIZER
|
||||||
|
|
||||||
void GPUDrawScanline::SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan)
|
void GPUDrawScanline::SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan)
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
void EndDraw(const GSRasterizerStats& stats, uint64 frame);
|
void EndDraw(const GSRasterizerStats& stats, uint64 frame);
|
||||||
void PrintStats();
|
void PrintStats();
|
||||||
|
|
||||||
#ifndef JIT_DRAW
|
#ifndef ENABLE_JIT_RASTERIZER
|
||||||
|
|
||||||
void SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan);
|
void SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan);
|
||||||
void DrawScanline(int pixels, int left, int top, const GSVertexSW& scan);
|
void DrawScanline(int pixels, int left, int top, const GSVertexSW& scan);
|
||||||
|
@ -366,7 +366,7 @@ CRC::Game CRC::Lookup(uint32 crc)
|
|||||||
// printf( "GSdx: excluding CRC hack for 0x%08x\n", m_games[i].crc );
|
// printf( "GSdx: excluding CRC hack for 0x%08x\n", m_games[i].crc );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef NO_CRC_HACKS
|
#ifndef DISABLE_CRC_HACKS
|
||||||
hash_map<uint32, Game*>::iterator i = m_map.find(crc);
|
hash_map<uint32, Game*>::iterator i = m_map.find(crc);
|
||||||
|
|
||||||
if(i != m_map.end())
|
if(i != m_map.end())
|
||||||
|
@ -117,7 +117,7 @@ void GSDeviceSW::CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r)
|
|||||||
class ShaderBase
|
class ShaderBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
GSVector4i Sample(const GSVector4i& c, const GSVector4i& uf, const GSVector4i& vf)
|
GSVector4i Sample(const GSVector4i& c, const GSVector4i& uf, const GSVector4i& vf) const
|
||||||
{
|
{
|
||||||
GSVector4i c0 = c.upl8();
|
GSVector4i c0 = c.upl8();
|
||||||
GSVector4i c1 = c.uph8();
|
GSVector4i c1 = c.uph8();
|
||||||
@ -128,17 +128,17 @@ protected:
|
|||||||
return c0;
|
return c0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GSVector4i Blend(const GSVector4i& c0, const GSVector4i& c1)
|
GSVector4i Blend(const GSVector4i& c0, const GSVector4i& c1) const
|
||||||
{
|
{
|
||||||
return c0.lerp16<0>(c1, c1.wwwwl().sll16(7));
|
return c0.lerp16<0>(c1, c1.wwwwl().sll16(7));
|
||||||
}
|
}
|
||||||
|
|
||||||
GSVector4i Blend2x(const GSVector4i& c0, const GSVector4i& c1)
|
GSVector4i Blend2x(const GSVector4i& c0, const GSVector4i& c1) const
|
||||||
{
|
{
|
||||||
return c0.lerp16<0>(c1, c1.wwwwl().sll16(1).pu16().uph8().sll16(7)); // .sll16(1).pu16() => 2x, then clamp (...)
|
return c0.lerp16<0>(c1, c1.wwwwl().sll16(1).pu16().uph8().sll16(7)); // .sll16(1).pu16() => 2x, then clamp (...)
|
||||||
}
|
}
|
||||||
|
|
||||||
GSVector4i Blend(const GSVector4i& c0, const GSVector4i& c1, const GSVector4i& f)
|
GSVector4i Blend(const GSVector4i& c0, const GSVector4i& c1, const GSVector4i& f) const
|
||||||
{
|
{
|
||||||
return c0.lerp16<0>(c1, f);
|
return c0.lerp16<0>(c1, f);
|
||||||
}
|
}
|
||||||
@ -147,12 +147,12 @@ protected:
|
|||||||
class ShaderCopy : public ShaderBase
|
class ShaderCopy : public ShaderBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void operator() (uint32* RESTRICT dst, const GSVector4i& c, const GSVector4i& uf, const GSVector4i& vf)
|
void operator() (uint32* RESTRICT dst, const GSVector4i& c, const GSVector4i& uf, const GSVector4i& vf) const
|
||||||
{
|
{
|
||||||
*dst = Sample(c, uf, vf).pu16().extract32<0>();
|
*dst = Sample(c, uf, vf).pu16().extract32<0>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator() (uint32* RESTRICT dst, uint32 c)
|
void operator() (uint32* RESTRICT dst, uint32 c) const
|
||||||
{
|
{
|
||||||
*dst = c;
|
*dst = c;
|
||||||
}
|
}
|
||||||
@ -161,12 +161,12 @@ public:
|
|||||||
class ShaderAlphaBlend : public ShaderBase
|
class ShaderAlphaBlend : public ShaderBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void operator() (uint32* RESTRICT dst, const GSVector4i& c, const GSVector4i& uf, const GSVector4i& vf)
|
void operator() (uint32* RESTRICT dst, const GSVector4i& c, const GSVector4i& uf, const GSVector4i& vf) const
|
||||||
{
|
{
|
||||||
*dst = Blend(Sample(c, uf, vf), GSVector4i(*dst).uph8()).pu16().extract32<0>();
|
*dst = Blend(Sample(c, uf, vf), GSVector4i(*dst).uph8()).pu16().extract32<0>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator() (uint32* RESTRICT dst, uint32 c)
|
void operator() (uint32* RESTRICT dst, uint32 c) const
|
||||||
{
|
{
|
||||||
*dst = Blend(GSVector4i(c), GSVector4i(*dst).uph8()).pu16().extract32<0>();
|
*dst = Blend(GSVector4i(c), GSVector4i(*dst).uph8()).pu16().extract32<0>();
|
||||||
}
|
}
|
||||||
@ -175,12 +175,12 @@ public:
|
|||||||
class ShaderAlpha2xBlend : public ShaderBase
|
class ShaderAlpha2xBlend : public ShaderBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void operator() (uint32* RESTRICT dst, const GSVector4i& c, const GSVector4i& uf, const GSVector4i& vf)
|
void operator() (uint32* RESTRICT dst, const GSVector4i& c, const GSVector4i& uf, const GSVector4i& vf) const
|
||||||
{
|
{
|
||||||
*dst = Blend2x(Sample(c, uf, vf), GSVector4i(*dst).uph8()).pu16().extract32<0>();
|
*dst = Blend2x(Sample(c, uf, vf), GSVector4i(*dst).uph8()).pu16().extract32<0>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator() (uint32* RESTRICT dst, uint32 c)
|
void operator() (uint32* RESTRICT dst, uint32 c) const
|
||||||
{
|
{
|
||||||
*dst = Blend2x(GSVector4i(c), GSVector4i(*dst).uph8()).pu16().extract32<0>();
|
*dst = Blend2x(GSVector4i(c), GSVector4i(*dst).uph8()).pu16().extract32<0>();
|
||||||
}
|
}
|
||||||
@ -196,18 +196,18 @@ public:
|
|||||||
m_f = GSVector4i((f << 16) | f).xxxx().srl16(1);
|
m_f = GSVector4i((f << 16) | f).xxxx().srl16(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator() (uint32* RESTRICT dst, const GSVector4i& c, const GSVector4i& uf, const GSVector4i& vf)
|
void operator() (uint32* RESTRICT dst, const GSVector4i& c, const GSVector4i& uf, const GSVector4i& vf) const
|
||||||
{
|
{
|
||||||
*dst = Blend(Sample(c, uf, vf), GSVector4i(*dst).uph8(), m_f).pu16().extract32<0>();
|
*dst = Blend(Sample(c, uf, vf), GSVector4i(*dst).uph8(), m_f).pu16().extract32<0>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator() (uint32* RESTRICT dst, uint32 c)
|
void operator() (uint32* RESTRICT dst, uint32 c) const
|
||||||
{
|
{
|
||||||
*dst = Blend(GSVector4i(c), GSVector4i(*dst).uph8(), m_f).pu16().extract32<0>();
|
*dst = Blend(GSVector4i(c), GSVector4i(*dst).uph8(), m_f).pu16().extract32<0>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class SHADER> static void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, SHADER shader, bool linear)
|
template<class SHADER> static void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, const SHADER& shader, bool linear)
|
||||||
{
|
{
|
||||||
GSVector4i r(dr.ceil());
|
GSVector4i r(dr.ceil());
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@ public:
|
|||||||
GSDialog(UINT id);
|
GSDialog(UINT id);
|
||||||
virtual ~GSDialog() {}
|
virtual ~GSDialog() {}
|
||||||
|
|
||||||
|
int GetId() const {return m_id;}
|
||||||
|
|
||||||
INT_PTR DoModal();
|
INT_PTR DoModal();
|
||||||
|
|
||||||
string GetText(UINT id);
|
string GetText(UINT id);
|
||||||
|
@ -105,7 +105,7 @@ void GSDrawScanline::PrintStats()
|
|||||||
m_ds_map.PrintStats();
|
m_ds_map.PrintStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef JIT_DRAW
|
#ifndef ENABLE_JIT_RASTERIZER
|
||||||
|
|
||||||
void GSDrawScanline::SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan)
|
void GSDrawScanline::SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan)
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
void DrawRect(const GSVector4i& r, const GSVertexSW& v);
|
void DrawRect(const GSVector4i& r, const GSVertexSW& v);
|
||||||
|
|
||||||
#ifndef JIT_DRAW
|
#ifndef ENABLE_JIT_RASTERIZER
|
||||||
|
|
||||||
void SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan);
|
void SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan);
|
||||||
void DrawScanline(int pixels, int left, int top, const GSVertexSW& scan);
|
void DrawScanline(int pixels, int left, int top, const GSVertexSW& scan);
|
||||||
|
@ -168,14 +168,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0 // we can't legally distribute vtune libraries or headers
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
|
|
||||||
#include "vtune/JITProfiling.h"
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class CG, class KEY, class VALUE>
|
template<class CG, class KEY, class VALUE>
|
||||||
class GSCodeGeneratorFunctionMap : public GSFunctionMap<KEY, VALUE>
|
class GSCodeGeneratorFunctionMap : public GSFunctionMap<KEY, VALUE>
|
||||||
{
|
{
|
||||||
@ -215,8 +207,7 @@ public:
|
|||||||
|
|
||||||
m_cgmap[key] = ret;
|
m_cgmap[key] = ret;
|
||||||
|
|
||||||
#if 0 // we can't legally distribute vtune libraries or headers
|
#ifdef ENABLE_VTUNE
|
||||||
#ifdef _WINDOWS
|
|
||||||
|
|
||||||
// vtune method registration
|
// vtune method registration
|
||||||
|
|
||||||
@ -254,7 +245,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete cg;
|
delete cg;
|
||||||
|
@ -36,7 +36,7 @@ GSRasterizer::GSRasterizer(IDrawScanline* ds)
|
|||||||
|
|
||||||
m_myscanline = (uint8*)_aligned_malloc((2048 >> THREAD_HEIGHT) + 16, 64);
|
m_myscanline = (uint8*)_aligned_malloc((2048 >> THREAD_HEIGHT) + 16, 64);
|
||||||
|
|
||||||
SetThreadId(0, 1);
|
Init(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
GSRasterizer::~GSRasterizer()
|
GSRasterizer::~GSRasterizer()
|
||||||
@ -53,6 +53,46 @@ bool GSRasterizer::IsOneOfMyScanlines(int scanline) const
|
|||||||
return m_myscanline[scanline >> THREAD_HEIGHT] != 0;
|
return m_myscanline[scanline >> THREAD_HEIGHT] != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GSRasterizer::IsOneOfMyScanlines(int top, int bottom) const
|
||||||
|
{
|
||||||
|
top >>= THREAD_HEIGHT;
|
||||||
|
bottom >>= THREAD_HEIGHT;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if(m_myscanline[top]) return true;
|
||||||
|
}
|
||||||
|
while(top++ < bottom);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GSRasterizer::Init(int id, int threads)
|
||||||
|
{
|
||||||
|
if(m_id != id || m_threads != threads)
|
||||||
|
{
|
||||||
|
m_id = id;
|
||||||
|
m_threads = threads;
|
||||||
|
|
||||||
|
if(threads > 1)
|
||||||
|
{
|
||||||
|
int row = 0;
|
||||||
|
|
||||||
|
while(row < (2048 >> THREAD_HEIGHT))
|
||||||
|
{
|
||||||
|
for(int i = 0; i < threads; i++, row++)
|
||||||
|
{
|
||||||
|
m_myscanline[row] = i == id ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset(m_myscanline, 1, 2048 >> THREAD_HEIGHT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GSRasterizer::Draw(const GSRasterizerData* data)
|
void GSRasterizer::Draw(const GSRasterizerData* data)
|
||||||
{
|
{
|
||||||
m_ds->BeginDraw(data->param);
|
m_ds->BeginDraw(data->param);
|
||||||
@ -100,32 +140,6 @@ void GSRasterizer::Draw(const GSRasterizerData* data)
|
|||||||
m_ds->EndDraw(m_stats, data->frame);
|
m_ds->EndDraw(m_stats, data->frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSRasterizer::SetThreadId(int id, int threads)
|
|
||||||
{
|
|
||||||
if(m_id != id || m_threads != threads)
|
|
||||||
{
|
|
||||||
m_id = id;
|
|
||||||
m_threads = threads;
|
|
||||||
|
|
||||||
if(threads > 1)
|
|
||||||
{
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
while(row < (2048 >> THREAD_HEIGHT))
|
|
||||||
{
|
|
||||||
for(int i = 0; i < threads; i++, row++)
|
|
||||||
{
|
|
||||||
m_myscanline[row] = i == id ? 1 : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
memset(m_myscanline, 1, 2048 >> THREAD_HEIGHT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GSRasterizer::GetStats(GSRasterizerStats& stats)
|
void GSRasterizer::GetStats(GSRasterizerStats& stats)
|
||||||
{
|
{
|
||||||
stats = m_stats;
|
stats = m_stats;
|
||||||
@ -250,8 +264,6 @@ void GSRasterizer::DrawLine(const GSVertexSW* v)
|
|||||||
|
|
||||||
m_edge.count = e - m_edge.buff;
|
m_edge.count = e - m_edge.buff;
|
||||||
|
|
||||||
m_stats.pixels += m_edge.count;
|
|
||||||
|
|
||||||
Flush(v, GSVertexSW::zero());
|
Flush(v, GSVertexSW::zero());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,6 +313,8 @@ void GSRasterizer::DrawTriangle(const GSVertexSW* vertices)
|
|||||||
GSVector4 tbmin = tbf.min(m_fscissor.ywyw());
|
GSVector4 tbmin = tbf.min(m_fscissor.ywyw());
|
||||||
GSVector4i tb = GSVector4i(tbmax.xzyw(tbmin));
|
GSVector4i tb = GSVector4i(tbmax.xzyw(tbmin));
|
||||||
|
|
||||||
|
if(m_threads > 1 && !IsOneOfMyScanlines(tb.x, tb.w)) return;
|
||||||
|
|
||||||
dv[0] = v[1] - v[0];
|
dv[0] = v[1] - v[0];
|
||||||
dv[1] = v[2] - v[0];
|
dv[1] = v[2] - v[0];
|
||||||
dv[2] = v[2] - v[1];
|
dv[2] = v[2] - v[1];
|
||||||
@ -364,13 +378,11 @@ void GSRasterizer::DrawTriangle(const GSVertexSW* vertices)
|
|||||||
edge.p = edge.p.insert<0, 1>(v[j].p);
|
edge.p = edge.p.insert<0, 1>(v[j].p);
|
||||||
dedge.p = ddx[2 - (j << 1)].yzzw(dedge.p);
|
dedge.p = ddx[2 - (j << 1)].yzzw(dedge.p);
|
||||||
|
|
||||||
DrawTriangleSection(tb.x, tb.w, edge, dedge, dscan, v[1 - j].p.xxxx(), v[1 - j].p.yyyy());
|
DrawTriangleSection(tb.x, tb.w, edge, dedge, dscan, v[1 - j].p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GSVector4 x0 = v[0].p.xxxx();
|
|
||||||
|
|
||||||
if(tb.x < tb.z)
|
if(tb.x < tb.z)
|
||||||
{
|
{
|
||||||
edge = v[0];
|
edge = v[0];
|
||||||
@ -378,17 +390,17 @@ void GSRasterizer::DrawTriangle(const GSVertexSW* vertices)
|
|||||||
edge.p = edge.p.xxzw();
|
edge.p = edge.p.xxzw();
|
||||||
dedge.p = ddx[j].xyzw(dedge.p);
|
dedge.p = ddx[j].xyzw(dedge.p);
|
||||||
|
|
||||||
DrawTriangleSection(tb.x, tb.z, edge, dedge, dscan, x0, v[0].p.yyyy());
|
DrawTriangleSection(tb.x, tb.z, edge, dedge, dscan, v[0].p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tb.y < tb.w)
|
if(tb.y < tb.w)
|
||||||
{
|
{
|
||||||
edge = v[1];
|
edge = v[1];
|
||||||
|
|
||||||
edge.p = (x0 + ddx[j] * dv[0].p.yyyy()).xyzw(edge.p);
|
edge.p = (v[0].p.xxxx() + ddx[j] * dv[0].p.yyyy()).xyzw(edge.p);
|
||||||
dedge.p = ddx[2 - (j << 1)].yzzw(dedge.p);
|
dedge.p = ddx[2 - (j << 1)].yzzw(dedge.p);
|
||||||
|
|
||||||
DrawTriangleSection(tb.y, tb.w, edge, dedge, dscan, v[1].p.xxxx(), v[1].p.yyyy());
|
DrawTriangleSection(tb.y, tb.w, edge, dedge, dscan, v[1].p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,7 +423,7 @@ void GSRasterizer::DrawTriangle(const GSVertexSW* vertices)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSRasterizer::DrawTriangleSection(int top, int bottom, GSVertexSW& edge, const GSVertexSW& dedge, const GSVertexSW& dscan, const GSVector4& x0, const GSVector4& y0)
|
void GSRasterizer::DrawTriangleSection(int top, int bottom, GSVertexSW& edge, const GSVertexSW& dedge, const GSVertexSW& dscan, const GSVector4& p0)
|
||||||
{
|
{
|
||||||
ASSERT(top < bottom);
|
ASSERT(top < bottom);
|
||||||
ASSERT(edge.p.x <= edge.p.y);
|
ASSERT(edge.p.x <= edge.p.y);
|
||||||
@ -420,12 +432,16 @@ void GSRasterizer::DrawTriangleSection(int top, int bottom, GSVertexSW& edge, co
|
|||||||
|
|
||||||
GSVector4 scissor = m_fscissor.xzxz();
|
GSVector4 scissor = m_fscissor.xzxz();
|
||||||
|
|
||||||
while(1)
|
do
|
||||||
{
|
{
|
||||||
if(IsOneOfMyScanlines(top))
|
if(IsOneOfMyScanlines(top))
|
||||||
{
|
{
|
||||||
GSVertexSW scan = edge + dedge * (GSVector4(top) - y0);
|
GSVector4 dy = GSVector4(top) - p0.yyyy();
|
||||||
|
|
||||||
|
GSVertexSW scan;
|
||||||
|
|
||||||
|
scan.p = edge.p + dedge.p * dy;
|
||||||
|
|
||||||
GSVector4 lrf = scan.p.ceil();
|
GSVector4 lrf = scan.p.ceil();
|
||||||
GSVector4 l = lrf.max(scissor);
|
GSVector4 l = lrf.max(scissor);
|
||||||
GSVector4 r = lrf.min(scissor);
|
GSVector4 r = lrf.min(scissor);
|
||||||
@ -438,17 +454,15 @@ void GSRasterizer::DrawTriangleSection(int top, int bottom, GSVertexSW& edge, co
|
|||||||
|
|
||||||
if(pixels > 0)
|
if(pixels > 0)
|
||||||
{
|
{
|
||||||
m_stats.pixels += pixels;
|
scan.t = edge.t + dedge.t * dy;
|
||||||
|
scan.c = edge.c + dedge.c * dy;
|
||||||
|
|
||||||
GSVector4 prestep = l.xxxx() - x0;
|
AddScanline(e++, pixels, left, top, scan + dscan * (l - p0).xxxx());
|
||||||
|
|
||||||
AddScanline(e++, pixels, left, top, scan + dscan * prestep);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(++top >= bottom) break;
|
|
||||||
}
|
}
|
||||||
|
while(++top < bottom);
|
||||||
|
|
||||||
m_edge.count += e - &m_edge.buff[m_edge.count];
|
m_edge.count += e - &m_edge.buff[m_edge.count];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,11 +721,7 @@ void GSRasterizer::DrawEdge(const GSVertexSW& v0, const GSVertexSW& v1, const GS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = e - &m_edge.buff[m_edge.count];
|
m_edge.count += e - &m_edge.buff[m_edge.count];
|
||||||
|
|
||||||
m_stats.pixels += count;
|
|
||||||
|
|
||||||
m_edge.count += count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSRasterizer::AddScanline(GSVertexSW* e, int pixels, int left, int top, const GSVertexSW& scan)
|
void GSRasterizer::AddScanline(GSVertexSW* e, int pixels, int left, int top, const GSVertexSW& scan)
|
||||||
@ -744,6 +754,8 @@ void GSRasterizer::Flush(const GSVertexSW* vertices, const GSVertexSW& dscan, bo
|
|||||||
int left = e->p.i16[1];
|
int left = e->p.i16[1];
|
||||||
int top = e->p.i16[2];
|
int top = e->p.i16[2];
|
||||||
|
|
||||||
|
m_stats.pixels += pixels;
|
||||||
|
|
||||||
m_ds->DrawScanline(pixels, left, top, *e++);
|
m_ds->DrawScanline(pixels, left, top, *e++);
|
||||||
}
|
}
|
||||||
while(e < ee);
|
while(e < ee);
|
||||||
@ -756,6 +768,8 @@ void GSRasterizer::Flush(const GSVertexSW* vertices, const GSVertexSW& dscan, bo
|
|||||||
int left = e->p.i16[1];
|
int left = e->p.i16[1];
|
||||||
int top = e->p.i16[2];
|
int top = e->p.i16[2];
|
||||||
|
|
||||||
|
m_stats.pixels += pixels;
|
||||||
|
|
||||||
m_ds->DrawEdge(pixels, left, top, *e++);
|
m_ds->DrawEdge(pixels, left, top, *e++);
|
||||||
}
|
}
|
||||||
while(e < ee);
|
while(e < ee);
|
||||||
@ -777,6 +791,8 @@ GSRasterizerMT::GSRasterizerMT(IDrawScanline* ds, volatile long& sync)
|
|||||||
|
|
||||||
GSRasterizerMT::~GSRasterizerMT()
|
GSRasterizerMT::~GSRasterizerMT()
|
||||||
{
|
{
|
||||||
|
Init(0, 1);
|
||||||
|
|
||||||
Draw(NULL);
|
Draw(NULL);
|
||||||
|
|
||||||
CloseThread();
|
CloseThread();
|
||||||
@ -808,23 +824,9 @@ GSRasterizerList::GSRasterizerList()
|
|||||||
|
|
||||||
GSRasterizerList::~GSRasterizerList()
|
GSRasterizerList::~GSRasterizerList()
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < size(); i++) delete (*this)[i];
|
for(size_t i = 0; i < size(); i++)
|
||||||
}
|
|
||||||
|
|
||||||
void GSRasterizerList::Sync()
|
|
||||||
{
|
|
||||||
while(m_sync) _mm_pause();
|
|
||||||
|
|
||||||
m_stats.ticks = __rdtsc() - m_start;
|
|
||||||
|
|
||||||
for(int i = 0; i < m_threads; i++)
|
|
||||||
{
|
{
|
||||||
GSRasterizerStats s;
|
delete (*this)[i];
|
||||||
|
|
||||||
(*this)[i]->GetStats(s);
|
|
||||||
|
|
||||||
m_stats.pixels += s.pixels;
|
|
||||||
m_stats.prims = std::max<int>(m_stats.prims, s.prims);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -845,14 +847,31 @@ void GSRasterizerList::Draw(const GSRasterizerData* data, int width, int height)
|
|||||||
|
|
||||||
for(int i = 1; i < m_threads; i++)
|
for(int i = 1; i < m_threads; i++)
|
||||||
{
|
{
|
||||||
(*this)[i]->SetThreadId(i, m_threads);
|
(*this)[i]->Init(i, m_threads);
|
||||||
(*this)[i]->Draw(data);
|
(*this)[i]->Draw(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
(*this)[0]->SetThreadId(0, m_threads);
|
(*this)[0]->Init(0, m_threads);
|
||||||
(*this)[0]->Draw(data);
|
(*this)[0]->Draw(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GSRasterizerList::Sync()
|
||||||
|
{
|
||||||
|
while(m_sync) _mm_pause();
|
||||||
|
|
||||||
|
m_stats.ticks = __rdtsc() - m_start;
|
||||||
|
|
||||||
|
for(int i = 0; i < m_threads; i++)
|
||||||
|
{
|
||||||
|
GSRasterizerStats s;
|
||||||
|
|
||||||
|
(*this)[i]->GetStats(s);
|
||||||
|
|
||||||
|
m_stats.pixels += s.pixels;
|
||||||
|
m_stats.prims = std::max<int>(m_stats.prims, s.prims);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GSRasterizerList::GetStats(GSRasterizerStats& stats)
|
void GSRasterizerList::GetStats(GSRasterizerStats& stats)
|
||||||
{
|
{
|
||||||
stats = m_stats;
|
stats = m_stats;
|
||||||
@ -863,5 +882,16 @@ void GSRasterizerList::PrintStats()
|
|||||||
if(!empty())
|
if(!empty())
|
||||||
{
|
{
|
||||||
front()->PrintStats();
|
front()->PrintStats();
|
||||||
|
|
||||||
|
/*
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
for(std::vector<IRasterizer*>::iterator i = begin(); i != end(); i++)
|
||||||
|
{
|
||||||
|
printf("[Thread %d]\n", index++);
|
||||||
|
|
||||||
|
(*i)->PrintStats();
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,6 @@
|
|||||||
#include "GSThread.h"
|
#include "GSThread.h"
|
||||||
#include "GSAlignedClass.h"
|
#include "GSAlignedClass.h"
|
||||||
|
|
||||||
//
|
|
||||||
#define JIT_DRAW
|
|
||||||
|
|
||||||
__aligned(class, 32) GSRasterizerData
|
__aligned(class, 32) GSRasterizerData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -65,7 +62,7 @@ public:
|
|||||||
virtual void EndDraw(const GSRasterizerStats& stats, uint64 frame) = 0;
|
virtual void EndDraw(const GSRasterizerStats& stats, uint64 frame) = 0;
|
||||||
virtual void PrintStats() = 0;
|
virtual void PrintStats() = 0;
|
||||||
|
|
||||||
#ifdef JIT_DRAW
|
#ifdef ENABLE_JIT_RASTERIZER
|
||||||
|
|
||||||
__forceinline void SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan) {m_sp(vertices, dscan);}
|
__forceinline void SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan) {m_sp(vertices, dscan);}
|
||||||
__forceinline void DrawScanline(int pixels, int left, int top, const GSVertexSW& scan) {m_ds(pixels, left, top, scan);}
|
__forceinline void DrawScanline(int pixels, int left, int top, const GSVertexSW& scan) {m_ds(pixels, left, top, scan);}
|
||||||
@ -90,8 +87,8 @@ class IRasterizer
|
|||||||
public:
|
public:
|
||||||
virtual ~IRasterizer() {}
|
virtual ~IRasterizer() {}
|
||||||
|
|
||||||
|
virtual void Init(int id, int threads) = 0;
|
||||||
virtual void Draw(const GSRasterizerData* data) = 0;
|
virtual void Draw(const GSRasterizerData* data) = 0;
|
||||||
virtual void SetThreadId(int id, int threads) = 0;
|
|
||||||
virtual void GetStats(GSRasterizerStats& stats) = 0;
|
virtual void GetStats(GSRasterizerStats& stats) = 0;
|
||||||
virtual void PrintStats() = 0;
|
virtual void PrintStats() = 0;
|
||||||
};
|
};
|
||||||
@ -116,11 +113,12 @@ protected:
|
|||||||
void DrawTriangle(const GSVertexSW* v);
|
void DrawTriangle(const GSVertexSW* v);
|
||||||
void DrawSprite(const GSVertexSW* v);
|
void DrawSprite(const GSVertexSW* v);
|
||||||
|
|
||||||
__forceinline void DrawTriangleSection(int top, int bottom, GSVertexSW& edge, const GSVertexSW& dedge, const GSVertexSW& dscan, const GSVector4& x0, const GSVector4& y0);
|
__forceinline void DrawTriangleSection(int top, int bottom, GSVertexSW& edge, const GSVertexSW& dedge, const GSVertexSW& dscan, const GSVector4& p0);
|
||||||
|
|
||||||
void DrawEdge(const GSVertexSW& v0, const GSVertexSW& v1, const GSVertexSW& dv, int orientation, int side);
|
void DrawEdge(const GSVertexSW& v0, const GSVertexSW& v1, const GSVertexSW& dv, int orientation, int side);
|
||||||
|
|
||||||
__forceinline bool IsOneOfMyScanlines(int scanline) const;
|
__forceinline bool IsOneOfMyScanlines(int scanline) const;
|
||||||
|
__forceinline bool IsOneOfMyScanlines(int top, int bottom) const;
|
||||||
__forceinline void AddScanline(GSVertexSW* e, int pixels, int left, int top, const GSVertexSW& scan);
|
__forceinline void AddScanline(GSVertexSW* e, int pixels, int left, int top, const GSVertexSW& scan);
|
||||||
__forceinline void Flush(const GSVertexSW* vertices, const GSVertexSW& dscan, bool edge = false);
|
__forceinline void Flush(const GSVertexSW* vertices, const GSVertexSW& dscan, bool edge = false);
|
||||||
|
|
||||||
@ -130,8 +128,8 @@ public:
|
|||||||
|
|
||||||
// IRasterizer
|
// IRasterizer
|
||||||
|
|
||||||
|
void Init(int id, int threads);
|
||||||
void Draw(const GSRasterizerData* data);
|
void Draw(const GSRasterizerData* data);
|
||||||
void SetThreadId(int id, int threads);
|
|
||||||
void GetStats(GSRasterizerStats& stats);
|
void GetStats(GSRasterizerStats& stats);
|
||||||
void PrintStats() {m_ds->PrintStats();}
|
void PrintStats() {m_ds->PrintStats();}
|
||||||
};
|
};
|
||||||
@ -178,9 +176,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sync();
|
|
||||||
|
|
||||||
void Draw(const GSRasterizerData* data, int width, int height);
|
void Draw(const GSRasterizerData* data, int width, int height);
|
||||||
|
void Sync();
|
||||||
void GetStats(GSRasterizerStats& stats);
|
void GetStats(GSRasterizerStats& stats);
|
||||||
void PrintStats();
|
void PrintStats();
|
||||||
};
|
};
|
||||||
|
@ -45,7 +45,7 @@ void GSRendererDX11::VertexKick(bool skip)
|
|||||||
|
|
||||||
dst = *(GSVertexHW11*)&m_v;
|
dst = *(GSVertexHW11*)&m_v;
|
||||||
|
|
||||||
#ifdef USE_UPSCALE_HACKS
|
#ifdef ENABLE_UPSCALE_HACKS
|
||||||
|
|
||||||
if(tme && fst)
|
if(tme && fst)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ void GSRendererDX9::VertexKick(bool skip)
|
|||||||
{
|
{
|
||||||
dst.t = m_v.GetUV();
|
dst.t = m_v.GetUV();
|
||||||
|
|
||||||
#ifdef USE_UPSCALE_HACKS
|
#ifdef ENABLE_UPSCALE_HACKS
|
||||||
|
|
||||||
int Udiff = 0;
|
int Udiff = 0;
|
||||||
int Vdiff = 0;
|
int Vdiff = 0;
|
||||||
|
@ -756,7 +756,7 @@ protected:
|
|||||||
|
|
||||||
void Draw()
|
void Draw()
|
||||||
{
|
{
|
||||||
#ifndef NO_CRC_HACKS
|
#ifndef DISABLE_CRC_HACKS
|
||||||
if(GSRendererT<Vertex>::IsBadFrame(m_skip, m_userhacks_skipdraw)) return;
|
if(GSRendererT<Vertex>::IsBadFrame(m_skip, m_userhacks_skipdraw)) return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -922,7 +922,7 @@ protected:
|
|||||||
|
|
||||||
s_n++;
|
s_n++;
|
||||||
}
|
}
|
||||||
#ifdef HW_NO_TEXTURE_CACHE
|
#ifdef DISABLE_HW_TEXTURE_CACHE
|
||||||
m_tc->Read(rt, r);
|
m_tc->Read(rt, r);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -782,25 +782,24 @@ void GSRendererSW::VertexKick(bool skip)
|
|||||||
|
|
||||||
if(GSVertexSW* v = DrawingKick<prim>(skip, count))
|
if(GSVertexSW* v = DrawingKick<prim>(skip, count))
|
||||||
{
|
{
|
||||||
|
GS_PRIM_CLASS primclass = GSUtil::GetPrimClass(prim);
|
||||||
|
|
||||||
if(!m_dump)
|
if(!m_dump)
|
||||||
{
|
{
|
||||||
GSVector4 pmin, pmax;
|
GSVector4 pmin, pmax;
|
||||||
|
|
||||||
switch(prim)
|
switch(primclass)
|
||||||
{
|
{
|
||||||
case GS_POINTLIST:
|
case GS_POINT_CLASS:
|
||||||
pmin = v[0].p;
|
pmin = v[0].p;
|
||||||
pmax = v[0].p;
|
pmax = v[0].p;
|
||||||
break;
|
break;
|
||||||
case GS_LINELIST:
|
case GS_LINE_CLASS:
|
||||||
case GS_LINESTRIP:
|
case GS_SPRITE_CLASS:
|
||||||
case GS_SPRITE:
|
|
||||||
pmin = v[0].p.min(v[1].p);
|
pmin = v[0].p.min(v[1].p);
|
||||||
pmax = v[0].p.max(v[1].p);
|
pmax = v[0].p.max(v[1].p);
|
||||||
break;
|
break;
|
||||||
case GS_TRIANGLELIST:
|
case GS_TRIANGLE_CLASS:
|
||||||
case GS_TRIANGLESTRIP:
|
|
||||||
case GS_TRIANGLEFAN:
|
|
||||||
pmin = v[0].p.min(v[1].p).min(v[2].p);
|
pmin = v[0].p.min(v[1].p).min(v[2].p);
|
||||||
pmax = v[0].p.max(v[1].p).max(v[2].p);
|
pmax = v[0].p.max(v[1].p).max(v[2].p);
|
||||||
break;
|
break;
|
||||||
@ -810,21 +809,17 @@ if(!m_dump)
|
|||||||
|
|
||||||
GSVector4 test = (pmax < scissor) | (pmin > scissor.zwxy());
|
GSVector4 test = (pmax < scissor) | (pmin > scissor.zwxy());
|
||||||
|
|
||||||
switch(prim)
|
switch(primclass)
|
||||||
{
|
{
|
||||||
case GS_TRIANGLELIST:
|
case GS_TRIANGLE_CLASS:
|
||||||
case GS_TRIANGLESTRIP:
|
case GS_SPRITE_CLASS:
|
||||||
case GS_TRIANGLEFAN:
|
|
||||||
case GS_SPRITE:
|
|
||||||
test |= pmin.ceil() == pmax.ceil();
|
test |= pmin.ceil() == pmax.ceil();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(prim)
|
switch(primclass)
|
||||||
{
|
{
|
||||||
case GS_TRIANGLELIST:
|
case GS_TRIANGLE_CLASS:
|
||||||
case GS_TRIANGLESTRIP:
|
|
||||||
case GS_TRIANGLEFAN:
|
|
||||||
// are in line or just two of them are the same (cross product == 0)
|
// are in line or just two of them are the same (cross product == 0)
|
||||||
GSVector4 tmp = (v[1].p - v[0].p) * (v[2].p - v[0].p).yxwz();
|
GSVector4 tmp = (v[1].p - v[0].p) * (v[2].p - v[0].p).yxwz();
|
||||||
test |= tmp == tmp.yxwz();
|
test |= tmp == tmp.yxwz();
|
||||||
@ -836,42 +831,26 @@ if(!m_dump)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch(prim)
|
switch(primclass)
|
||||||
{
|
{
|
||||||
case GS_POINTLIST:
|
case GS_POINT_CLASS:
|
||||||
break;
|
break;
|
||||||
case GS_LINELIST:
|
case GS_LINE_CLASS:
|
||||||
case GS_LINESTRIP:
|
|
||||||
if(PRIM->IIP == 0) {v[0].c = v[1].c;}
|
if(PRIM->IIP == 0) {v[0].c = v[1].c;}
|
||||||
break;
|
break;
|
||||||
case GS_TRIANGLELIST:
|
case GS_TRIANGLE_CLASS:
|
||||||
case GS_TRIANGLESTRIP:
|
|
||||||
case GS_TRIANGLEFAN:
|
|
||||||
if(PRIM->IIP == 0) {v[0].c = v[2].c; v[1].c = v[2].c;}
|
if(PRIM->IIP == 0) {v[0].c = v[2].c; v[1].c = v[2].c;}
|
||||||
break;
|
break;
|
||||||
case GS_SPRITE:
|
case GS_SPRITE_CLASS:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_count < 30 && m_count >= 3)
|
if(m_count < 30 && m_count >= 3)
|
||||||
{
|
{
|
||||||
GSVertexSW* v = &m_vertices[m_count - 3];
|
|
||||||
|
|
||||||
int tl = 0;
|
int tl = 0;
|
||||||
int br = 0;
|
int br = 0;
|
||||||
|
|
||||||
bool isquad = false;
|
if(primclass == GS_TRIANGLE_CLASS && GSVertexSW::IsQuad(&m_vertices[m_count - 3], tl, br))
|
||||||
|
|
||||||
switch(prim)
|
|
||||||
{
|
|
||||||
case GS_TRIANGLESTRIP:
|
|
||||||
case GS_TRIANGLEFAN:
|
|
||||||
case GS_TRIANGLELIST:
|
|
||||||
isquad = GSVertexSW::IsQuad(v, tl, br);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isquad)
|
|
||||||
{
|
{
|
||||||
m_count -= 3;
|
m_count -= 3;
|
||||||
|
|
||||||
|
@ -256,7 +256,11 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
|
|||||||
theApp.SetConfig("upscale_multiplier", 1);
|
theApp.SetConfig("upscale_multiplier", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
theApp.SetConfig("windowed", (int)IsDlgButtonChecked(m_hWnd, IDC_WINDOWED));
|
if(GetId() == IDD_CONFIG) // TODO: other options may not be present in IDD_CONFIG2 as well
|
||||||
|
{
|
||||||
|
theApp.SetConfig("windowed", (int)IsDlgButtonChecked(m_hWnd, IDC_WINDOWED));
|
||||||
|
}
|
||||||
|
|
||||||
theApp.SetConfig("filter", (int)IsDlgButtonChecked(m_hWnd, IDC_FILTER));
|
theApp.SetConfig("filter", (int)IsDlgButtonChecked(m_hWnd, IDC_FILTER));
|
||||||
theApp.SetConfig("paltex", (int)IsDlgButtonChecked(m_hWnd, IDC_PALTEX));
|
theApp.SetConfig("paltex", (int)IsDlgButtonChecked(m_hWnd, IDC_PALTEX));
|
||||||
theApp.SetConfig("vsync", (int)IsDlgButtonChecked(m_hWnd, IDC_VSYNC));
|
theApp.SetConfig("vsync", (int)IsDlgButtonChecked(m_hWnd, IDC_VSYNC));
|
||||||
|
@ -22,11 +22,6 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "GSState.h"
|
#include "GSState.h"
|
||||||
|
|
||||||
//#define DISABLE_BITMASKING
|
|
||||||
//#define DISABLE_COLCLAMP
|
|
||||||
//#define DISABLE_DATE
|
|
||||||
//see stdafx.h for #define HW_NO_TEXTURE_CACHE and #define NO_CRC_HACKS
|
|
||||||
|
|
||||||
//#define Offset_ST // Fixes Persona3 mini map alignment which is off even in software rendering
|
//#define Offset_ST // Fixes Persona3 mini map alignment which is off even in software rendering
|
||||||
//#define Offset_UV // Fixes / breaks various titles
|
//#define Offset_UV // Fixes / breaks various titles
|
||||||
|
|
||||||
@ -1119,7 +1114,16 @@ void GSState::FlushWrite()
|
|||||||
|
|
||||||
if(len <= 0) return;
|
if(len <= 0) return;
|
||||||
|
|
||||||
int y = m_tr.y;
|
GSVector4i r;
|
||||||
|
|
||||||
|
r.left = m_env.TRXPOS.DSAX;
|
||||||
|
r.top = m_env.TRXPOS.DSAY;
|
||||||
|
r.right = r.left + m_env.TRXREG.RRW;
|
||||||
|
r.bottom = r.top + m_env.TRXREG.RRH;
|
||||||
|
|
||||||
|
InvalidateVideoMem(m_env.BITBLTBUF, r);
|
||||||
|
|
||||||
|
//int y = m_tr.y;
|
||||||
|
|
||||||
GSLocalMemory::writeImage wi = GSLocalMemory::m_psm[m_env.BITBLTBUF.DPSM].wi;
|
GSLocalMemory::writeImage wi = GSLocalMemory::m_psm[m_env.BITBLTBUF.DPSM].wi;
|
||||||
|
|
||||||
@ -1129,6 +1133,7 @@ void GSState::FlushWrite()
|
|||||||
|
|
||||||
m_perfmon.Put(GSPerfMon::Swizzle, len);
|
m_perfmon.Put(GSPerfMon::Swizzle, len);
|
||||||
|
|
||||||
|
/*
|
||||||
GSVector4i r;
|
GSVector4i r;
|
||||||
|
|
||||||
r.left = m_env.TRXPOS.DSAX;
|
r.left = m_env.TRXPOS.DSAX;
|
||||||
@ -1137,6 +1142,7 @@ void GSState::FlushWrite()
|
|||||||
r.bottom = std::min<int>(r.top + m_env.TRXREG.RRH, m_tr.x == r.left ? m_tr.y : m_tr.y + 1);
|
r.bottom = std::min<int>(r.top + m_env.TRXREG.RRH, m_tr.x == r.left ? m_tr.y : m_tr.y + 1);
|
||||||
|
|
||||||
InvalidateVideoMem(m_env.BITBLTBUF, r);
|
InvalidateVideoMem(m_env.BITBLTBUF, r);
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
static int n = 0;
|
static int n = 0;
|
||||||
string s;
|
string s;
|
||||||
@ -1174,12 +1180,6 @@ void GSState::Write(const uint8* mem, int len)
|
|||||||
|
|
||||||
// printf("%d >= %d\n", len, m_tr.total);
|
// printf("%d >= %d\n", len, m_tr.total);
|
||||||
|
|
||||||
(m_mem.*psm.wi)(m_tr.x, m_tr.y, mem, m_tr.total, m_env.BITBLTBUF, m_env.TRXPOS, m_env.TRXREG);
|
|
||||||
|
|
||||||
m_tr.start = m_tr.end = m_tr.total;
|
|
||||||
|
|
||||||
m_perfmon.Put(GSPerfMon::Swizzle, len);
|
|
||||||
|
|
||||||
GSVector4i r;
|
GSVector4i r;
|
||||||
|
|
||||||
r.left = m_env.TRXPOS.DSAX;
|
r.left = m_env.TRXPOS.DSAX;
|
||||||
@ -1188,6 +1188,12 @@ void GSState::Write(const uint8* mem, int len)
|
|||||||
r.bottom = r.top + m_env.TRXREG.RRH;
|
r.bottom = r.top + m_env.TRXREG.RRH;
|
||||||
|
|
||||||
InvalidateVideoMem(m_env.BITBLTBUF, r);
|
InvalidateVideoMem(m_env.BITBLTBUF, r);
|
||||||
|
|
||||||
|
(m_mem.*psm.wi)(m_tr.x, m_tr.y, mem, m_tr.total, m_env.BITBLTBUF, m_env.TRXPOS, m_env.TRXREG);
|
||||||
|
|
||||||
|
m_tr.start = m_tr.end = m_tr.total;
|
||||||
|
|
||||||
|
m_perfmon.Put(GSPerfMon::Swizzle, len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3211,9 +3217,7 @@ bool GSC_JamesBondEverythingOrNothing(const GSFrameInfo& fi, int& skip)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_DYNAMIC_CRC_HACK
|
||||||
//#define USE_DYNAMIC_CRC_HACK
|
|
||||||
#ifdef USE_DYNAMIC_CRC_HACK
|
|
||||||
|
|
||||||
#define DYNA_DLL_PATH "c:/dev/pcsx2/trunk/tools/dynacrchack/DynaCrcHack.dll"
|
#define DYNA_DLL_PATH "c:/dev/pcsx2/trunk/tools/dynacrchack/DynaCrcHack.dll"
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con
|
|||||||
|
|
||||||
Target* dst = NULL;
|
Target* dst = NULL;
|
||||||
|
|
||||||
#ifdef HW_NO_TEXTURE_CACHE
|
#ifdef DISABLE_HW_TEXTURE_CACHE
|
||||||
if( 0 )
|
if( 0 )
|
||||||
#else
|
#else
|
||||||
if(src == NULL)
|
if(src == NULL)
|
||||||
@ -191,7 +191,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int
|
|||||||
if(multiplier > 1) // it's limited to a maximum of 4 on reading the config
|
if(multiplier > 1) // it's limited to a maximum of 4 on reading the config
|
||||||
{
|
{
|
||||||
|
|
||||||
#if 0 //#ifdef USE_UPSCALE_HACKS //not happy with this yet..
|
#if 0 //#ifdef ENABLE_UPSCALE_HACKS //not happy with this yet..
|
||||||
|
|
||||||
float x = 1.0f;
|
float x = 1.0f;
|
||||||
float y = 1.0f;
|
float y = 1.0f;
|
||||||
|
@ -127,14 +127,14 @@ protected:
|
|||||||
|
|
||||||
// TODO: virtual void Write(Source* s, const GSVector4i& r) = 0;
|
// TODO: virtual void Write(Source* s, const GSVector4i& r) = 0;
|
||||||
// TODO: virtual void Write(Target* t, const GSVector4i& r) = 0;
|
// TODO: virtual void Write(Target* t, const GSVector4i& r) = 0;
|
||||||
#ifndef HW_NO_TEXTURE_CACHE
|
#ifndef DISABLE_HW_TEXTURE_CACHE
|
||||||
virtual void Read(Target* t, const GSVector4i& r) = 0;
|
virtual void Read(Target* t, const GSVector4i& r) = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GSTextureCache(GSRenderer* r);
|
GSTextureCache(GSRenderer* r);
|
||||||
virtual ~GSTextureCache();
|
virtual ~GSTextureCache();
|
||||||
#ifdef HW_NO_TEXTURE_CACHE
|
#ifdef DISABLE_HW_TEXTURE_CACHE
|
||||||
virtual void Read(Target* t, const GSVector4i& r) = 0;
|
virtual void Read(Target* t, const GSVector4i& r) = 0;
|
||||||
#endif
|
#endif
|
||||||
void RemoveAll();
|
void RemoveAll();
|
||||||
|
@ -135,8 +135,10 @@ const GSTextureCacheSW::Texture* GSTextureCacheSW::Lookup(const GIFRegTEX0& TEX0
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSTextureCacheSW::InvalidateVideoMem(const GSOffset* o, const GSVector4i& rect)
|
bool GSTextureCacheSW::InvalidateVideoMem(const GSOffset* o, const GSVector4i& rect)
|
||||||
{
|
{
|
||||||
|
bool changed = false;
|
||||||
|
|
||||||
uint32 bp = o->bp;
|
uint32 bp = o->bp;
|
||||||
uint32 bw = o->bw;
|
uint32 bw = o->bw;
|
||||||
uint32 psm = o->psm;
|
uint32 psm = o->psm;
|
||||||
@ -163,6 +165,8 @@ void GSTextureCacheSW::InvalidateVideoMem(const GSOffset* o, const GSVector4i& r
|
|||||||
|
|
||||||
if(GSUtil::HasSharedBits(psm, t->m_TEX0.PSM))
|
if(GSUtil::HasSharedBits(psm, t->m_TEX0.PSM))
|
||||||
{
|
{
|
||||||
|
changed = true;
|
||||||
|
|
||||||
if(t->m_repeating)
|
if(t->m_repeating)
|
||||||
{
|
{
|
||||||
list<GSVector2i>& l = t->m_p2t[page];
|
list<GSVector2i>& l = t->m_p2t[page];
|
||||||
@ -183,6 +187,8 @@ void GSTextureCacheSW::InvalidateVideoMem(const GSOffset* o, const GSVector4i& r
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSTextureCacheSW::RemoveAll()
|
void GSTextureCacheSW::RemoveAll()
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
|
|
||||||
const Texture* Lookup(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, const GSVector4i& r, uint32 tw0 = 0);
|
const Texture* Lookup(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, const GSVector4i& r, uint32 tw0 = 0);
|
||||||
|
|
||||||
void InvalidateVideoMem(const GSOffset* o, const GSVector4i& r);
|
bool InvalidateVideoMem(const GSOffset* o, const GSVector4i& r);
|
||||||
|
|
||||||
void RemoveAll();
|
void RemoveAll();
|
||||||
void RemoveAt(Texture* t);
|
void RemoveAt(Texture* t);
|
||||||
|
@ -1618,6 +1618,7 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="config.h" />
|
||||||
<ClInclude Include="GPU.h" />
|
<ClInclude Include="GPU.h" />
|
||||||
<ClInclude Include="GPUDrawingEnvironment.h" />
|
<ClInclude Include="GPUDrawingEnvironment.h" />
|
||||||
<ClInclude Include="GPUDrawScanline.h" />
|
<ClInclude Include="GPUDrawScanline.h" />
|
||||||
|
@ -644,6 +644,9 @@
|
|||||||
<ClInclude Include="GSDeviceSDL.h">
|
<ClInclude Include="GSDeviceSDL.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="config.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="res\logo10.bmp">
|
<None Include="res\logo10.bmp">
|
||||||
|
23
plugins/GSdx/config.h
Normal file
23
plugins/GSdx/config.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
//#define ENABLE_VTUNE
|
||||||
|
|
||||||
|
#define ENABLE_JIT_RASTERIZER
|
||||||
|
|
||||||
|
//#define ENABLE_DYNAMIC_CRC_HACK
|
||||||
|
|
||||||
|
#define ENABLE_UPSCALE_HACKS // Hacks intended to fix upscaling / rendering glitches in HW renderers
|
||||||
|
|
||||||
|
//#define DISABLE_HW_TEXTURE_CACHE // Slow but fixes a lot of bugs
|
||||||
|
|
||||||
|
//#define DISABLE_CRC_HACKS // Disable all game specific hacks
|
||||||
|
|
||||||
|
#if defined(DISABLE_HW_TEXTURE_CACHE) && !defined(DISABLE_CRC_HACKS)
|
||||||
|
#define DISABLE_CRC_HACKS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#define DISABLE_BITMASKING
|
||||||
|
|
||||||
|
//#define DISABLE_COLCLAMP
|
||||||
|
|
||||||
|
//#define DISABLE_DATE
|
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
|
|
||||||
// The following macros define the minimum required platform. The minimum required platform
|
// The following macros define the minimum required platform. The minimum required platform
|
||||||
@ -91,29 +93,29 @@ using namespace std;
|
|||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
|
|
||||||
#include <hash_map>
|
#include <hash_map>
|
||||||
#include <hash_set>
|
#include <hash_set>
|
||||||
|
|
||||||
using namespace stdext;
|
using namespace stdext;
|
||||||
|
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
|
|
||||||
#define DIRECTORY_SEPARATOR '\\'
|
#define DIRECTORY_SEPARATOR '\\'
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define _BACKWARD_BACKWARD_WARNING_H
|
#define _BACKWARD_BACKWARD_WARNING_H
|
||||||
|
|
||||||
#define hash_map map
|
#define hash_map map
|
||||||
#define hash_set set
|
#define hash_set set
|
||||||
|
|
||||||
//#include <ext/hash_map>
|
//#include <ext/hash_map>
|
||||||
//#include <ext/hash_set>
|
//#include <ext/hash_set>
|
||||||
|
|
||||||
//using namespace __gnu_cxx;
|
//using namespace __gnu_cxx;
|
||||||
|
|
||||||
#define DIRECTORY_SEPARATOR '/'
|
#define DIRECTORY_SEPARATOR '/'
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -276,61 +278,66 @@ typedef signed long long int64;
|
|||||||
|
|
||||||
#if !defined(_MSC_VER)
|
#if !defined(_MSC_VER)
|
||||||
|
|
||||||
#if !defined(HAVE_ALIGNED_MALLOC)
|
#if !defined(HAVE_ALIGNED_MALLOC)
|
||||||
|
|
||||||
extern void* _aligned_malloc(size_t size, size_t alignment);
|
extern void* _aligned_malloc(size_t size, size_t alignment);
|
||||||
extern void _aligned_free(void* p);
|
extern void _aligned_free(void* p);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/mingw32/intrin_x86.h?view=markup
|
// http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/mingw32/intrin_x86.h?view=markup
|
||||||
// - the other intrin_x86.h of pcsx2 is not up to date, its _interlockedbittestandreset simply does not work.
|
// - the other intrin_x86.h of pcsx2 is not up to date, its _interlockedbittestandreset simply does not work.
|
||||||
|
|
||||||
__forceinline unsigned char _BitScanForward(unsigned long* const Index, const unsigned long Mask)
|
__forceinline unsigned char _BitScanForward(unsigned long* const Index, const unsigned long Mask)
|
||||||
{
|
{
|
||||||
__asm__("bsfl %[Mask], %[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask));
|
__asm__("bsfl %[Mask], %[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask));
|
||||||
return Mask ? 1 : 0;
|
return Mask ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline unsigned char _interlockedbittestandreset(volatile long* a, const long b)
|
__forceinline unsigned char _interlockedbittestandreset(volatile long* a, const long b)
|
||||||
{
|
{
|
||||||
unsigned char retval;
|
unsigned char retval;
|
||||||
__asm__("lock; btrl %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
|
__asm__("lock; btrl %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline unsigned char _interlockedbittestandset(volatile long* a, const long b)
|
__forceinline unsigned char _interlockedbittestandset(volatile long* a, const long b)
|
||||||
{
|
{
|
||||||
unsigned char retval;
|
unsigned char retval;
|
||||||
__asm__("lock; btsl %[b], %[a]; setc %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
|
__asm__("lock; btsl %[b], %[a]; setc %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
|
||||||
__forceinline unsigned long long __rdtsc()
|
__forceinline unsigned long long __rdtsc()
|
||||||
{
|
{
|
||||||
#if defined(__amd64__) || defined(__x86_64__)
|
#if defined(__amd64__) || defined(__x86_64__)
|
||||||
unsigned long long low, high;
|
unsigned long long low, high;
|
||||||
__asm__ __volatile__("rdtsc" : "=a"(low), "=d"(high));
|
__asm__ __volatile__("rdtsc" : "=a"(low), "=d"(high));
|
||||||
return low | (high << 32);
|
return low | (high << 32);
|
||||||
#else
|
#else
|
||||||
unsigned long long retval;
|
unsigned long long retval;
|
||||||
__asm__ __volatile__("rdtsc" : "=A"(retval));
|
__asm__ __volatile__("rdtsc" : "=A"(retval));
|
||||||
return retval;
|
return retval;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void* vmalloc(size_t size, bool code);
|
extern void* vmalloc(size_t size, bool code);
|
||||||
extern void vmfree(void* ptr, size_t size);
|
extern void vmfree(void* ptr, size_t size);
|
||||||
|
|
||||||
#define USE_UPSCALE_HACKS // Hacks intended to fix upscaling / rendering glitches in HW renderers
|
#ifdef _WINDOWS
|
||||||
//#define HW_NO_TEXTURE_CACHE // Slow but fixes a lot of bugs
|
|
||||||
//#define NO_CRC_HACKS // Disable all game specific hacks
|
#ifdef ENABLE_VTUNE
|
||||||
#ifdef HW_NO_TEXTURE_CACHE
|
|
||||||
#define NO_CRC_HACKS
|
#include <JITProfiling.h>
|
||||||
#endif
|
|
||||||
|
#pragma comment(lib, "jitprofiling.lib")
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<DisableSpecificWarnings>4996;4995;4324;4100;4101;4201;4556;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4996;4995;4324;4100;4101;4201;4556;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
<AdditionalIncludeDirectories>$(DXSDK_DIR)include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(DXSDK_DIR)include;$(VTUNE_AMPLIFIER_XE_2011_DIR)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
@ -23,6 +23,7 @@
|
|||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||||
|
<AdditionalLibraryDirectories>$(VTUNE_AMPLIFIER_XE_2011_DIR)lib32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>.\postBuild.cmd "$(TargetPath)" "$(TargetName)" $(TargetExt) $(PcsxSubsection)</Command>
|
<Command>.\postBuild.cmd "$(TargetPath)" "$(TargetName)" $(TargetExt) $(PcsxSubsection)</Command>
|
||||||
|
Loading…
Reference in New Issue
Block a user