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:
gabest11 2011-12-16 19:13:58 +00:00
parent a2dd83b419
commit 4b77052d21
25 changed files with 275 additions and 228 deletions

View File

@ -86,7 +86,7 @@ void GPUDrawScanline::PrintStats()
m_ds_map.PrintStats();
}
#ifndef JIT_DRAW
#ifndef ENABLE_JIT_RASTERIZER
void GPUDrawScanline::SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan)
{

View File

@ -45,7 +45,7 @@ public:
void EndDraw(const GSRasterizerStats& stats, uint64 frame);
void PrintStats();
#ifndef JIT_DRAW
#ifndef ENABLE_JIT_RASTERIZER
void SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan);
void DrawScanline(int pixels, int left, int top, const GSVertexSW& scan);

View File

@ -366,7 +366,7 @@ CRC::Game CRC::Lookup(uint32 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);
if(i != m_map.end())

View File

@ -117,7 +117,7 @@ void GSDeviceSW::CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r)
class ShaderBase
{
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 c1 = c.uph8();
@ -128,17 +128,17 @@ protected:
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));
}
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 (...)
}
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);
}
@ -147,12 +147,12 @@ protected:
class ShaderCopy : public ShaderBase
{
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>();
}
void operator() (uint32* RESTRICT dst, uint32 c)
void operator() (uint32* RESTRICT dst, uint32 c) const
{
*dst = c;
}
@ -161,12 +161,12 @@ public:
class ShaderAlphaBlend : public ShaderBase
{
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>();
}
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>();
}
@ -175,12 +175,12 @@ public:
class ShaderAlpha2xBlend : public ShaderBase
{
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>();
}
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>();
}
@ -196,18 +196,18 @@ public:
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>();
}
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>();
}
};
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());

View File

@ -40,6 +40,8 @@ public:
GSDialog(UINT id);
virtual ~GSDialog() {}
int GetId() const {return m_id;}
INT_PTR DoModal();
string GetText(UINT id);

View File

@ -105,7 +105,7 @@ void GSDrawScanline::PrintStats()
m_ds_map.PrintStats();
}
#ifndef JIT_DRAW
#ifndef ENABLE_JIT_RASTERIZER
void GSDrawScanline::SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan)
{

View File

@ -56,7 +56,7 @@ public:
void DrawRect(const GSVector4i& r, const GSVertexSW& v);
#ifndef JIT_DRAW
#ifndef ENABLE_JIT_RASTERIZER
void SetupPrim(const GSVertexSW* vertices, const GSVertexSW& dscan);
void DrawScanline(int pixels, int left, int top, const GSVertexSW& scan);

View File

@ -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>
class GSCodeGeneratorFunctionMap : public GSFunctionMap<KEY, VALUE>
{
@ -215,8 +207,7 @@ public:
m_cgmap[key] = ret;
#if 0 // we can't legally distribute vtune libraries or headers
#ifdef _WINDOWS
#ifdef ENABLE_VTUNE
// vtune method registration
@ -254,7 +245,6 @@ public:
*/
}
#endif
#endif
delete cg;

View File

@ -36,7 +36,7 @@ GSRasterizer::GSRasterizer(IDrawScanline* ds)
m_myscanline = (uint8*)_aligned_malloc((2048 >> THREAD_HEIGHT) + 16, 64);
SetThreadId(0, 1);
Init(0, 1);
}
GSRasterizer::~GSRasterizer()
@ -53,6 +53,46 @@ bool GSRasterizer::IsOneOfMyScanlines(int scanline) const
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)
{
m_ds->BeginDraw(data->param);
@ -100,32 +140,6 @@ void GSRasterizer::Draw(const GSRasterizerData* data)
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)
{
stats = m_stats;
@ -250,8 +264,6 @@ void GSRasterizer::DrawLine(const GSVertexSW* v)
m_edge.count = e - m_edge.buff;
m_stats.pixels += m_edge.count;
Flush(v, GSVertexSW::zero());
}
}
@ -301,6 +313,8 @@ void GSRasterizer::DrawTriangle(const GSVertexSW* vertices)
GSVector4 tbmin = tbf.min(m_fscissor.ywyw());
GSVector4i tb = GSVector4i(tbmax.xzyw(tbmin));
if(m_threads > 1 && !IsOneOfMyScanlines(tb.x, tb.w)) return;
dv[0] = v[1] - v[0];
dv[1] = v[2] - v[0];
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);
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
{
GSVector4 x0 = v[0].p.xxxx();
if(tb.x < tb.z)
{
edge = v[0];
@ -378,17 +390,17 @@ void GSRasterizer::DrawTriangle(const GSVertexSW* vertices)
edge.p = edge.p.xxzw();
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)
{
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);
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(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();
while(1)
do
{
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 l = lrf.max(scissor);
GSVector4 r = lrf.min(scissor);
@ -438,17 +454,15 @@ void GSRasterizer::DrawTriangleSection(int top, int bottom, GSVertexSW& edge, co
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 * prestep);
AddScanline(e++, pixels, left, top, scan + dscan * (l - p0).xxxx());
}
}
if(++top >= bottom) break;
}
while(++top < bottom);
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_stats.pixels += count;
m_edge.count += count;
m_edge.count += e - &m_edge.buff[m_edge.count];
}
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 top = e->p.i16[2];
m_stats.pixels += pixels;
m_ds->DrawScanline(pixels, left, top, *e++);
}
while(e < ee);
@ -756,6 +768,8 @@ void GSRasterizer::Flush(const GSVertexSW* vertices, const GSVertexSW& dscan, bo
int left = e->p.i16[1];
int top = e->p.i16[2];
m_stats.pixels += pixels;
m_ds->DrawEdge(pixels, left, top, *e++);
}
while(e < ee);
@ -777,6 +791,8 @@ GSRasterizerMT::GSRasterizerMT(IDrawScanline* ds, volatile long& sync)
GSRasterizerMT::~GSRasterizerMT()
{
Init(0, 1);
Draw(NULL);
CloseThread();
@ -808,23 +824,9 @@ GSRasterizerList::GSRasterizerList()
GSRasterizerList::~GSRasterizerList()
{
for(size_t i = 0; i < size(); i++) delete (*this)[i];
}
void GSRasterizerList::Sync()
{
while(m_sync) _mm_pause();
m_stats.ticks = __rdtsc() - m_start;
for(int i = 0; i < m_threads; i++)
for(size_t i = 0; i < size(); i++)
{
GSRasterizerStats s;
(*this)[i]->GetStats(s);
m_stats.pixels += s.pixels;
m_stats.prims = std::max<int>(m_stats.prims, s.prims);
delete (*this)[i];
}
}
@ -845,14 +847,31 @@ void GSRasterizerList::Draw(const GSRasterizerData* data, int width, int height)
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)[0]->SetThreadId(0, m_threads);
(*this)[0]->Init(0, m_threads);
(*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)
{
stats = m_stats;
@ -863,5 +882,16 @@ void GSRasterizerList::PrintStats()
if(!empty())
{
front()->PrintStats();
/*
int index = 0;
for(std::vector<IRasterizer*>::iterator i = begin(); i != end(); i++)
{
printf("[Thread %d]\n", index++);
(*i)->PrintStats();
}
*/
}
}

View File

@ -27,9 +27,6 @@
#include "GSThread.h"
#include "GSAlignedClass.h"
//
#define JIT_DRAW
__aligned(class, 32) GSRasterizerData
{
public:
@ -65,7 +62,7 @@ public:
virtual void EndDraw(const GSRasterizerStats& stats, uint64 frame) = 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 DrawScanline(int pixels, int left, int top, const GSVertexSW& scan) {m_ds(pixels, left, top, scan);}
@ -90,8 +87,8 @@ class IRasterizer
public:
virtual ~IRasterizer() {}
virtual void Init(int id, int threads) = 0;
virtual void Draw(const GSRasterizerData* data) = 0;
virtual void SetThreadId(int id, int threads) = 0;
virtual void GetStats(GSRasterizerStats& stats) = 0;
virtual void PrintStats() = 0;
};
@ -116,11 +113,12 @@ protected:
void DrawTriangle(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);
__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 Flush(const GSVertexSW* vertices, const GSVertexSW& dscan, bool edge = false);
@ -130,8 +128,8 @@ public:
// IRasterizer
void Init(int id, int threads);
void Draw(const GSRasterizerData* data);
void SetThreadId(int id, int threads);
void GetStats(GSRasterizerStats& stats);
void PrintStats() {m_ds->PrintStats();}
};
@ -178,9 +176,8 @@ public:
}
}
void Sync();
void Draw(const GSRasterizerData* data, int width, int height);
void Sync();
void GetStats(GSRasterizerStats& stats);
void PrintStats();
};

View File

@ -45,7 +45,7 @@ void GSRendererDX11::VertexKick(bool skip)
dst = *(GSVertexHW11*)&m_v;
#ifdef USE_UPSCALE_HACKS
#ifdef ENABLE_UPSCALE_HACKS
if(tme && fst)
{

View File

@ -84,7 +84,7 @@ void GSRendererDX9::VertexKick(bool skip)
{
dst.t = m_v.GetUV();
#ifdef USE_UPSCALE_HACKS
#ifdef ENABLE_UPSCALE_HACKS
int Udiff = 0;
int Vdiff = 0;

View File

@ -756,7 +756,7 @@ protected:
void Draw()
{
#ifndef NO_CRC_HACKS
#ifndef DISABLE_CRC_HACKS
if(GSRendererT<Vertex>::IsBadFrame(m_skip, m_userhacks_skipdraw)) return;
#endif
@ -922,7 +922,7 @@ protected:
s_n++;
}
#ifdef HW_NO_TEXTURE_CACHE
#ifdef DISABLE_HW_TEXTURE_CACHE
m_tc->Read(rt, r);
#endif
}

View File

@ -782,25 +782,24 @@ void GSRendererSW::VertexKick(bool skip)
if(GSVertexSW* v = DrawingKick<prim>(skip, count))
{
GS_PRIM_CLASS primclass = GSUtil::GetPrimClass(prim);
if(!m_dump)
{
GSVector4 pmin, pmax;
switch(prim)
switch(primclass)
{
case GS_POINTLIST:
case GS_POINT_CLASS:
pmin = v[0].p;
pmax = v[0].p;
break;
case GS_LINELIST:
case GS_LINESTRIP:
case GS_SPRITE:
case GS_LINE_CLASS:
case GS_SPRITE_CLASS:
pmin = v[0].p.min(v[1].p);
pmax = v[0].p.max(v[1].p);
break;
case GS_TRIANGLELIST:
case GS_TRIANGLESTRIP:
case GS_TRIANGLEFAN:
case GS_TRIANGLE_CLASS:
pmin = v[0].p.min(v[1].p).min(v[2].p);
pmax = v[0].p.max(v[1].p).max(v[2].p);
break;
@ -810,21 +809,17 @@ if(!m_dump)
GSVector4 test = (pmax < scissor) | (pmin > scissor.zwxy());
switch(prim)
switch(primclass)
{
case GS_TRIANGLELIST:
case GS_TRIANGLESTRIP:
case GS_TRIANGLEFAN:
case GS_SPRITE:
case GS_TRIANGLE_CLASS:
case GS_SPRITE_CLASS:
test |= pmin.ceil() == pmax.ceil();
break;
}
switch(prim)
switch(primclass)
{
case GS_TRIANGLELIST:
case GS_TRIANGLESTRIP:
case GS_TRIANGLEFAN:
case GS_TRIANGLE_CLASS:
// 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();
test |= tmp == tmp.yxwz();
@ -836,42 +831,26 @@ if(!m_dump)
return;
}
}
switch(prim)
switch(primclass)
{
case GS_POINTLIST:
case GS_POINT_CLASS:
break;
case GS_LINELIST:
case GS_LINESTRIP:
case GS_LINE_CLASS:
if(PRIM->IIP == 0) {v[0].c = v[1].c;}
break;
case GS_TRIANGLELIST:
case GS_TRIANGLESTRIP:
case GS_TRIANGLEFAN:
case GS_TRIANGLE_CLASS:
if(PRIM->IIP == 0) {v[0].c = v[2].c; v[1].c = v[2].c;}
break;
case GS_SPRITE:
case GS_SPRITE_CLASS:
break;
}
if(m_count < 30 && m_count >= 3)
{
GSVertexSW* v = &m_vertices[m_count - 3];
int tl = 0;
int br = 0;
bool isquad = false;
switch(prim)
{
case GS_TRIANGLESTRIP:
case GS_TRIANGLEFAN:
case GS_TRIANGLELIST:
isquad = GSVertexSW::IsQuad(v, tl, br);
break;
}
if(isquad)
if(primclass == GS_TRIANGLE_CLASS && GSVertexSW::IsQuad(&m_vertices[m_count - 3], tl, br))
{
m_count -= 3;

View File

@ -256,7 +256,11 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
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("paltex", (int)IsDlgButtonChecked(m_hWnd, IDC_PALTEX));
theApp.SetConfig("vsync", (int)IsDlgButtonChecked(m_hWnd, IDC_VSYNC));

View File

@ -22,11 +22,6 @@
#include "stdafx.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_UV // Fixes / breaks various titles
@ -1119,7 +1114,16 @@ void GSState::FlushWrite()
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;
@ -1129,6 +1133,7 @@ void GSState::FlushWrite()
m_perfmon.Put(GSPerfMon::Swizzle, len);
/*
GSVector4i r;
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);
InvalidateVideoMem(m_env.BITBLTBUF, r);
*/
/*
static int n = 0;
string s;
@ -1174,12 +1180,6 @@ void GSState::Write(const uint8* mem, int len)
// 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;
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;
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
{
@ -3211,9 +3217,7 @@ bool GSC_JamesBondEverythingOrNothing(const GSFrameInfo& fi, int& skip)
return true;
}
//#define USE_DYNAMIC_CRC_HACK
#ifdef USE_DYNAMIC_CRC_HACK
#ifdef ENABLE_DYNAMIC_CRC_HACK
#define DYNA_DLL_PATH "c:/dev/pcsx2/trunk/tools/dynacrchack/DynaCrcHack.dll"

View File

@ -88,7 +88,7 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con
Target* dst = NULL;
#ifdef HW_NO_TEXTURE_CACHE
#ifdef DISABLE_HW_TEXTURE_CACHE
if( 0 )
#else
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 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 y = 1.0f;

View File

@ -127,14 +127,14 @@ protected:
// TODO: virtual void Write(Source* s, 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;
#endif
public:
GSTextureCache(GSRenderer* r);
virtual ~GSTextureCache();
#ifdef HW_NO_TEXTURE_CACHE
#ifdef DISABLE_HW_TEXTURE_CACHE
virtual void Read(Target* t, const GSVector4i& r) = 0;
#endif
void RemoveAll();

View File

@ -135,8 +135,10 @@ const GSTextureCacheSW::Texture* GSTextureCacheSW::Lookup(const GIFRegTEX0& TEX0
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 bw = o->bw;
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))
{
changed = true;
if(t->m_repeating)
{
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()

View File

@ -63,7 +63,7 @@ public:
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 RemoveAt(Texture* t);

View File

@ -1618,6 +1618,7 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="config.h" />
<ClInclude Include="GPU.h" />
<ClInclude Include="GPUDrawingEnvironment.h" />
<ClInclude Include="GPUDrawScanline.h" />

View File

@ -644,6 +644,9 @@
<ClInclude Include="GSDeviceSDL.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="config.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="res\logo10.bmp">

23
plugins/GSdx/config.h Normal file
View 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

View File

@ -25,6 +25,8 @@
#pragma once
#include "config.h"
#ifdef _WINDOWS
// The following macros define the minimum required platform. The minimum required platform
@ -91,29 +93,29 @@ using namespace std;
#ifdef _WINDOWS
#include <hash_map>
#include <hash_set>
#include <hash_map>
#include <hash_set>
using namespace stdext;
using namespace stdext;
#define vsnprintf _vsnprintf
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define snprintf _snprintf
#define DIRECTORY_SEPARATOR '\\'
#define DIRECTORY_SEPARATOR '\\'
#else
#define _BACKWARD_BACKWARD_WARNING_H
#define _BACKWARD_BACKWARD_WARNING_H
#define hash_map map
#define hash_set set
#define hash_map map
#define hash_set set
//#include <ext/hash_map>
//#include <ext/hash_set>
//#include <ext/hash_map>
//#include <ext/hash_set>
//using namespace __gnu_cxx;
//using namespace __gnu_cxx;
#define DIRECTORY_SEPARATOR '/'
#define DIRECTORY_SEPARATOR '/'
#endif
@ -276,61 +278,66 @@ typedef signed long long int64;
#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_free(void* p);
extern void* _aligned_malloc(size_t size, size_t alignment);
extern void _aligned_free(void* p);
#endif
#endif
// 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.
// 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.
__forceinline unsigned char _BitScanForward(unsigned long* const Index, const unsigned long Mask)
{
__asm__("bsfl %[Mask], %[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask));
return Mask ? 1 : 0;
}
__forceinline unsigned char _BitScanForward(unsigned long* const Index, const unsigned long Mask)
{
__asm__("bsfl %[Mask], %[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask));
return Mask ? 1 : 0;
}
__forceinline unsigned char _interlockedbittestandreset(volatile long* a, const long b)
{
unsigned char retval;
__asm__("lock; btrl %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
return retval;
}
__forceinline unsigned char _interlockedbittestandreset(volatile long* a, const long b)
{
unsigned char retval;
__asm__("lock; btrl %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
return retval;
}
__forceinline unsigned char _interlockedbittestandset(volatile long* a, const long b)
{
unsigned char retval;
__asm__("lock; btsl %[b], %[a]; setc %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
return retval;
}
__forceinline unsigned char _interlockedbittestandset(volatile long* a, const long b)
{
unsigned char retval;
__asm__("lock; btsl %[b], %[a]; setc %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
return retval;
}
#ifdef __GNUC__
#ifdef __GNUC__
__forceinline unsigned long long __rdtsc()
{
#if defined(__amd64__) || defined(__x86_64__)
unsigned long long low, high;
__asm__ __volatile__("rdtsc" : "=a"(low), "=d"(high));
return low | (high << 32);
#else
unsigned long long retval;
__asm__ __volatile__("rdtsc" : "=A"(retval));
return retval;
#endif
}
__forceinline unsigned long long __rdtsc()
{
#if defined(__amd64__) || defined(__x86_64__)
unsigned long long low, high;
__asm__ __volatile__("rdtsc" : "=a"(low), "=d"(high));
return low | (high << 32);
#else
unsigned long long retval;
__asm__ __volatile__("rdtsc" : "=A"(retval));
return retval;
#endif
}
#endif
#endif
#endif
extern void* vmalloc(size_t size, bool code);
extern void vmfree(void* ptr, size_t size);
#define USE_UPSCALE_HACKS // Hacks intended to fix upscaling / rendering glitches in HW renderers
//#define HW_NO_TEXTURE_CACHE // Slow but fixes a lot of bugs
//#define NO_CRC_HACKS // Disable all game specific hacks
#ifdef HW_NO_TEXTURE_CACHE
#define NO_CRC_HACKS
#endif
#ifdef _WINDOWS
#ifdef ENABLE_VTUNE
#include <JITProfiling.h>
#pragma comment(lib, "jitprofiling.lib")
#endif
#endif

View File

@ -14,7 +14,7 @@
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<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>
</ClCompile>
<Link>
@ -23,6 +23,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalLibraryDirectories>$(VTUNE_AMPLIFIER_XE_2011_DIR)lib32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>.\postBuild.cmd "$(TargetPath)" "$(TargetName)" $(TargetExt) $(PcsxSubsection)</Command>