GSdx: cleaned up some obsolete code

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1331 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gabest11 2009-06-05 15:15:02 +00:00
parent 3f97423a30
commit 01d1573fdc
13 changed files with 64 additions and 338 deletions

View File

@ -571,106 +571,6 @@ GSLocalMemory::Offset4* GSLocalMemory::GetOffset4(const GIFRegFRAME& FRAME, cons
return o;
}
bool GSLocalMemory::FillRect(const GSVector4i& r, uint32 c, uint32 psm, uint32 bp, uint32 bw)
{
const psm_t& tbl = m_psm[psm];
writePixel wp = tbl.wp;
pixelAddress bn = tbl.bn;
int w = tbl.bs.x;
int h = tbl.bs.y;
int bpp = tbl.bpp;
switch(bpp)
{
case 32: break;
case 16: c = (c & 0xffff) * 0x00010001; break;
case 8: c = (c & 0xff) * 0x01010101; break;
case 4: c = (c & 0xf) * 0x11111111; break;
}
GSVector4i clip = r.ralign<GSVector4i::Inside>(tbl.bs);
for(int y = r.top; y < clip.top; y++)
{
for(int x = r.left; x < r.right; x++)
{
(this->*wp)(x, y, c, bp, bw);
}
}
for(int y = clip.bottom; y < r.bottom; y++)
{
for(int x = r.left; x < r.right; x++)
{
(this->*wp)(x, y, c, bp, bw);
}
}
if(r.x < clip.left || clip.right < r.z)
{
for(int y = clip.top; y < clip.bottom; y += h)
{
for(int ys = y, ye = y + h; ys < ye; ys++)
{
for(int x = r.left; x < clip.left; x++)
{
(this->*wp)(x, ys, c, bp, bw);
}
for(int x = clip.right; x < r.right; x++)
{
(this->*wp)(x, ys, c, bp, bw);
}
}
}
}
GSVector4i c128(c);
if(psm == PSM_PSMCT24 || psm == PSM_PSMZ24)
{
GSVector4i mask(0x00ffffff);
for(int y = clip.top; y < clip.bottom; y += h)
{
for(int x = clip.left; x < clip.right; x += w)
{
GSVector4i* p = (GSVector4i*)&m_vm8[bn(x, y, bp, bw) << 8];
for(int i = 0; i < 16; i += 4)
{
p[i + 0] = p[i + 0].blend8(c128, mask);
p[i + 1] = p[i + 1].blend8(c128, mask);
p[i + 2] = p[i + 2].blend8(c128, mask);
p[i + 3] = p[i + 3].blend8(c128, mask);
}
}
}
}
else
{
for(int y = clip.top; y < clip.bottom; y += h)
{
for(int x = clip.left; x < clip.right; x += w)
{
GSVector4i* p = (GSVector4i*)&m_vm8[bn(x, y, bp, bw) << 8];
for(int i = 0; i < 16; i += 4)
{
p[i + 0] = c128;
p[i + 1] = c128;
p[i + 2] = c128;
p[i + 3] = c128;
}
}
}
}
return true;
}
////////////////////
template<int psm, int bsx, int bsy, bool aligned>

View File

@ -753,149 +753,6 @@ public:
//
__forceinline uint32 PixelAddressX(int PSM, int x, int y, uint32 bp, uint32 bw)
{
switch(PSM)
{
case PSM_PSMCT32: return PixelAddress32(x, y, bp, bw);
case PSM_PSMCT24: return PixelAddress32(x, y, bp, bw);
case PSM_PSMCT16: return PixelAddress16(x, y, bp, bw);
case PSM_PSMCT16S: return PixelAddress16S(x, y, bp, bw);
case PSM_PSMT8: return PixelAddress8(x, y, bp, bw);
case PSM_PSMT4: return PixelAddress4(x, y, bp, bw);
case PSM_PSMT8H: return PixelAddress32(x, y, bp, bw);
case PSM_PSMT4HL: return PixelAddress32(x, y, bp, bw);
case PSM_PSMT4HH: return PixelAddress32(x, y, bp, bw);
case PSM_PSMZ32: return PixelAddress32Z(x, y, bp, bw);
case PSM_PSMZ24: return PixelAddress32Z(x, y, bp, bw);
case PSM_PSMZ16: return PixelAddress16Z(x, y, bp, bw);
case PSM_PSMZ16S: return PixelAddress16SZ(x, y, bp, bw);
default: ASSERT(0); return PixelAddress32(x, y, bp, bw);
}
}
__forceinline uint32 ReadPixelX(int PSM, uint32 addr) const
{
switch(PSM)
{
case PSM_PSMCT32: return ReadPixel32(addr);
case PSM_PSMCT24: return ReadPixel24(addr);
case PSM_PSMCT16: return ReadPixel16(addr);
case PSM_PSMCT16S: return ReadPixel16(addr);
case PSM_PSMT8: return ReadPixel8(addr);
case PSM_PSMT4: return ReadPixel4(addr);
case PSM_PSMT8H: return ReadPixel8H(addr);
case PSM_PSMT4HL: return ReadPixel4HL(addr);
case PSM_PSMT4HH: return ReadPixel4HH(addr);
case PSM_PSMZ32: return ReadPixel32(addr);
case PSM_PSMZ24: return ReadPixel24(addr);
case PSM_PSMZ16: return ReadPixel16(addr);
case PSM_PSMZ16S: return ReadPixel16(addr);
default: ASSERT(0); return ReadPixel32(addr);
}
}
__forceinline uint32 ReadFrameX(int PSM, uint32 addr) const
{
switch(PSM)
{
case PSM_PSMCT32: return ReadPixel32(addr);
case PSM_PSMCT24: return ReadFrame24(addr);
case PSM_PSMCT16: return ReadFrame16(addr);
case PSM_PSMCT16S: return ReadFrame16(addr);
case PSM_PSMZ32: return ReadPixel32(addr);
case PSM_PSMZ24: return ReadFrame24(addr);
case PSM_PSMZ16: return ReadFrame16(addr);
case PSM_PSMZ16S: return ReadFrame16(addr);
default: ASSERT(0); return ReadPixel32(addr);
}
}
__forceinline uint32 ReadTexelX(int PSM, uint32 addr, const GIFRegTEXA& TEXA) const
{
switch(PSM)
{
case PSM_PSMCT32: return ReadTexel32(addr, TEXA);
case PSM_PSMCT24: return ReadTexel24(addr, TEXA);
case PSM_PSMCT16: return ReadTexel16(addr, TEXA);
case PSM_PSMCT16S: return ReadTexel16(addr, TEXA);
case PSM_PSMT8: return ReadTexel8(addr, TEXA);
case PSM_PSMT4: return ReadTexel4(addr, TEXA);
case PSM_PSMT8H: return ReadTexel8H(addr, TEXA);
case PSM_PSMT4HL: return ReadTexel4HL(addr, TEXA);
case PSM_PSMT4HH: return ReadTexel4HH(addr, TEXA);
case PSM_PSMZ32: return ReadTexel32(addr, TEXA);
case PSM_PSMZ24: return ReadTexel24(addr, TEXA);
case PSM_PSMZ16: return ReadTexel16(addr, TEXA);
case PSM_PSMZ16S: return ReadTexel16(addr, TEXA);
default: ASSERT(0); return ReadTexel32(addr, TEXA);
}
}
__forceinline uint32 ReadTexelX(int PSM, int x, int y, const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA) const
{
switch(PSM)
{
case PSM_PSMCT32: return ReadTexel32(x, y, TEX0, TEXA);
case PSM_PSMCT24: return ReadTexel24(x, y, TEX0, TEXA);
case PSM_PSMCT16: return ReadTexel16(x, y, TEX0, TEXA);
case PSM_PSMCT16S: return ReadTexel16(x, y, TEX0, TEXA);
case PSM_PSMT8: return ReadTexel8(x, y, TEX0, TEXA);
case PSM_PSMT4: return ReadTexel4(x, y, TEX0, TEXA);
case PSM_PSMT8H: return ReadTexel8H(x, y, TEX0, TEXA);
case PSM_PSMT4HL: return ReadTexel4HL(x, y, TEX0, TEXA);
case PSM_PSMT4HH: return ReadTexel4HH(x, y, TEX0, TEXA);
case PSM_PSMZ32: return ReadTexel32Z(x, y, TEX0, TEXA);
case PSM_PSMZ24: return ReadTexel24Z(x, y, TEX0, TEXA);
case PSM_PSMZ16: return ReadTexel16Z(x, y, TEX0, TEXA);
case PSM_PSMZ16S: return ReadTexel16Z(x, y, TEX0, TEXA);
default: ASSERT(0); return ReadTexel32(x, y, TEX0, TEXA);
}
}
__forceinline void WritePixelX(int PSM, uint32 addr, uint32 c)
{
switch(PSM)
{
case PSM_PSMCT32: WritePixel32(addr, c); break;
case PSM_PSMCT24: WritePixel24(addr, c); break;
case PSM_PSMCT16: WritePixel16(addr, c); break;
case PSM_PSMCT16S: WritePixel16(addr, c); break;
case PSM_PSMT8: WritePixel8(addr, c); break;
case PSM_PSMT4: WritePixel4(addr, c); break;
case PSM_PSMT8H: WritePixel8H(addr, c); break;
case PSM_PSMT4HL: WritePixel4HL(addr, c); break;
case PSM_PSMT4HH: WritePixel4HH(addr, c); break;
case PSM_PSMZ32: WritePixel32(addr, c); break;
case PSM_PSMZ24: WritePixel24(addr, c); break;
case PSM_PSMZ16: WritePixel16(addr, c); break;
case PSM_PSMZ16S: WritePixel16(addr, c); break;
default: ASSERT(0); WritePixel32(addr, c); break;
}
}
__forceinline void WriteFrameX(int PSM, uint32 addr, uint32 c)
{
switch(PSM)
{
case PSM_PSMCT32: WritePixel32(addr, c); break;
case PSM_PSMCT24: WritePixel24(addr, c); break;
case PSM_PSMCT16: WriteFrame16(addr, c); break;
case PSM_PSMCT16S: WriteFrame16(addr, c); break;
case PSM_PSMZ32: WritePixel32(addr, c); break;
case PSM_PSMZ24: WritePixel24(addr, c); break;
case PSM_PSMZ16: WriteFrame16(addr, c); break;
case PSM_PSMZ16S: WriteFrame16(addr, c); break;
default: ASSERT(0); WritePixel32(addr, c); break;
}
}
// FillRect
bool FillRect(const GSVector4i& r, uint32 c, uint32 psm, uint32 bp, uint32 bw);
//
template<int psm, int bsx, int bsy, bool aligned>
void WriteImageColumn(int l, int r, int y, int h, uint8* src, int srcpitch, const GIFRegBITBLTBUF& BITBLTBUF);

View File

@ -77,10 +77,10 @@ protected:
{
for(int j = m_count - 3; i < j; i += 4)
{
GSVector4 v0 = GSVector4(v[i + 0].m128[0]);
GSVector4 v1 = GSVector4(v[i + 1].m128[0]);
GSVector4 v2 = GSVector4(v[i + 2].m128[0]);
GSVector4 v3 = GSVector4(v[i + 3].m128[0]);
GSVector4 v0 = v[i + 0].vf[0];
GSVector4 v1 = v[i + 1].vf[0];
GSVector4 v2 = v[i + 2].vf[0];
GSVector4 v3 = v[i + 3].vf[0];
minv = minv.minv((v0.minv(v1)).minv(v2.minv(v3)));
maxv = maxv.maxv((v0.maxv(v1)).maxv(v2.maxv(v3)));
@ -88,7 +88,7 @@ protected:
for(int j = m_count; i < j; i++)
{
GSVector4 v0 = GSVector4(v[i + 0].m128[0]);
GSVector4 v0 = v[i + 0].vf[0];
minv = minv.minv(v0);
maxv = maxv.maxv(v0);

View File

@ -75,8 +75,8 @@ void GSRendererHW10::VertexKick(bool skip)
{
GSVertexHW10& dst = m_vl.AddTail();
dst.m128i[0] = m_v.m128i[0];
dst.m128i[1] = m_v.m128i[1];
dst.vi[0] = m_v.vi[0];
dst.vi[1] = m_v.vi[1];
if(tme && fst)
{
@ -513,7 +513,7 @@ void GSRendererHW10::SetupDATE(GSTexture* rt, GSTexture* ds)
for(int i = 0, j = m_count; i < j; i++)
{
GSVector4 p(GSVector4i(m_vertices[i].m128i[0]).uph16());
GSVector4 p(m_vertices[i].vi[0].uph16());
pmin = p.minv(pmin);
pmax = p.maxv(pmax);

View File

@ -968,25 +968,53 @@ void GSState::Write(uint8* mem, int len)
int w = m_env.TRXREG.RRW;
int h = m_env.TRXREG.RRH;
// TRACE(_T("Write len=%d DBP=%05x DBW=%d DPSM=%d DSAX=%d DSAY=%d RRW=%d RRH=%d\n"), len, m_env.BITBLTBUF.DBP, m_env.BITBLTBUF.DBW, m_env.BITBLTBUF.DPSM, m_env.TRXPOS.DSAX, m_env.TRXPOS.DSAY, m_env.TRXREG.RRW, m_env.TRXREG.RRH);
const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[m_env.BITBLTBUF.DPSM];
if(!m_tr.Update(w, h, GSLocalMemory::m_psm[m_env.BITBLTBUF.DPSM].trbpp, len))
// printf("Write len=%d DBP=%05x DBW=%d DPSM=%d DSAX=%d DSAY=%d RRW=%d RRH=%d\n", len, m_env.BITBLTBUF.DBP, m_env.BITBLTBUF.DBW, m_env.BITBLTBUF.DPSM, m_env.TRXPOS.DSAX, m_env.TRXPOS.DSAY, m_env.TRXREG.RRW, m_env.TRXREG.RRH);
if(!m_tr.Update(w, h, psm.trbpp, len))
{
return;
}
memcpy(&m_tr.buff[m_tr.end], mem, len);
m_tr.end += len;
if(PRIM->TME && (m_env.BITBLTBUF.DBP == m_context->TEX0.TBP0 || m_env.BITBLTBUF.DBP == m_context->TEX0.CBP)) // TODO: hmmmm
{
FlushPrim();
}
if(m_tr.end >= m_tr.total)
if(m_tr.end == 0 && len >= m_tr.total)
{
FlushWrite();
// received all data in one piece, no need to buffer it
// 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;
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);
}
else
{
// printf("%d += %d (%d)\n", m_tr.end, len, m_tr.total);
memcpy(&m_tr.buff[m_tr.end], mem, len);
m_tr.end += len;
if(m_tr.end >= m_tr.total)
{
FlushWrite();
}
}
m_mem.m_clut.Invalidate();
@ -1001,7 +1029,7 @@ void GSState::Read(uint8* mem, int len)
int w = m_env.TRXREG.RRW;
int h = m_env.TRXREG.RRH;
// TRACE(_T("Read len=%d SBP=%05x SBW=%d SPSM=%d SSAX=%d SSAY=%d RRW=%d RRH=%d\n"), len, (int)m_env.BITBLTBUF.SBP, (int)m_env.BITBLTBUF.SBW, (int)m_env.BITBLTBUF.SPSM, sx, sy, w, h);
// printf("Read len=%d SBP=%05x SBW=%d SPSM=%d SSAX=%d SSAY=%d RRW=%d RRH=%d\n", len, (int)m_env.BITBLTBUF.SBP, (int)m_env.BITBLTBUF.SBW, (int)m_env.BITBLTBUF.SPSM, sx, sy, w, h);
if(!m_tr.Update(w, h, GSLocalMemory::m_psm[m_env.BITBLTBUF.SPSM].trbpp, len))
{

View File

@ -22,11 +22,6 @@
#include "stdafx.h"
#include "GSTexture10.h"
GSTexture10::GSTexture10()
{
memset(&m_desc, 0, sizeof(m_desc));
}
GSTexture10::GSTexture10(ID3D10Texture2D* texture)
: m_texture(texture)
{
@ -36,10 +31,6 @@ GSTexture10::GSTexture10(ID3D10Texture2D* texture)
m_texture->GetDesc(&m_desc);
}
GSTexture10::~GSTexture10()
{
}
GSTexture10::operator bool()
{
return !!m_texture;
@ -174,11 +165,6 @@ bool GSTexture10::Save(const string& fn, bool dds)
return SUCCEEDED(D3DX10SaveTextureToFile(res, dds ? D3DX10_IFF_DDS : D3DX10_IFF_BMP, fn.c_str()));
}
ID3D10Texture2D* GSTexture10::operator->()
{
return m_texture;
}
GSTexture10::operator ID3D10Texture2D*()
{
return m_texture;

View File

@ -33,9 +33,7 @@ class GSTexture10 : public GSTexture
CComPtr<ID3D10DepthStencilView> m_dsv;
public:
GSTexture10();
explicit GSTexture10(ID3D10Texture2D* texture);
virtual ~GSTexture10();
operator bool();
@ -48,8 +46,6 @@ public:
void Unmap();
bool Save(const string& fn, bool dds = false);
ID3D10Texture2D* operator->(); // TODO: remove direct access
operator ID3D10Texture2D*();
operator ID3D10ShaderResourceView*();
operator ID3D10RenderTargetView*();

View File

@ -22,12 +22,6 @@
#include "stdafx.h"
#include "GSTexture7.h"
GSTexture7::GSTexture7()
: m_type(GSTexture::None)
{
memset(&m_desc, 0, sizeof(m_desc));
}
GSTexture7::GSTexture7(int type, IDirectDrawSurface7* system)
: m_type(type)
, m_system(system)
@ -51,10 +45,6 @@ GSTexture7::GSTexture7(int type, IDirectDrawSurface7* system, IDirectDrawSurface
video->GetSurfaceDesc(&m_desc);
}
GSTexture7::~GSTexture7()
{
}
GSTexture7::operator bool()
{
return !!m_system;

View File

@ -32,10 +32,8 @@ class GSTexture7 : public GSTexture
DDSURFACEDESC2 m_desc;
public:
GSTexture7();
explicit GSTexture7(int type, IDirectDrawSurface7* system);
GSTexture7(int type, IDirectDrawSurface7* system);
GSTexture7(int type, IDirectDrawSurface7* system, IDirectDrawSurface7* video);
virtual ~GSTexture7();
operator bool();

View File

@ -22,11 +22,6 @@
#include "stdafx.h"
#include "GSTexture9.h"
GSTexture9::GSTexture9()
{
memset(&m_desc, 0, sizeof(m_desc));
}
GSTexture9::GSTexture9(IDirect3DSurface9* surface)
{
m_surface = surface;
@ -49,6 +44,8 @@ GSTexture9::GSTexture9(IDirect3DTexture9* texture)
texture->GetDevice(&m_dev);
texture->GetLevelDesc(0, &m_desc);
texture->GetSurfaceLevel(0, &m_surface);
ASSERT(m_surface != NULL);
}
GSTexture9::~GSTexture9()
@ -86,11 +83,11 @@ int GSTexture9::GetFormat() const
bool GSTexture9::Update(const GSVector4i& r, const void* data, int pitch)
{
if(IDirect3DSurface9* surface = *this)
if(m_surface)
{
D3DLOCKED_RECT lr;
if(SUCCEEDED(surface->LockRect(&lr, r, 0)))
if(SUCCEEDED(m_surface->LockRect(&lr, r, 0)))
{
uint8* src = (uint8*)data;
uint8* dst = (uint8*)lr.pBits;
@ -105,7 +102,7 @@ bool GSTexture9::Update(const GSVector4i& r, const void* data, int pitch)
memcpy(dst, src, bytes);
}
surface->UnlockRect();
m_surface->UnlockRect();
return true;
}
@ -118,11 +115,11 @@ bool GSTexture9::Map(uint8** bits, int& pitch, const GSVector4i* r)
{
HRESULT hr;
if(IDirect3DSurface9* surface = *this)
if(m_surface)
{
D3DLOCKED_RECT lr;
if(SUCCEEDED(hr = surface->LockRect(&lr, (LPRECT)r, 0)))
if(SUCCEEDED(hr = m_surface->LockRect(&lr, (LPRECT)r, 0)))
{
*bits = (uint8*)lr.pBits;
pitch = (int)lr.Pitch;
@ -136,9 +133,9 @@ bool GSTexture9::Map(uint8** bits, int& pitch, const GSVector4i* r)
void GSTexture9::Unmap()
{
if(IDirect3DSurface9* surface = *this)
if(m_surface)
{
surface->UnlockRect();
m_surface->UnlockRect();
}
}
@ -196,29 +193,12 @@ bool GSTexture9::Save(const string& fn, bool dds)
return false;
}
IDirect3DTexture9* GSTexture9::operator->()
{
return m_texture;
}
GSTexture9::operator IDirect3DSurface9*()
{
if(m_texture && !m_surface)
{
m_texture->GetSurfaceLevel(0, &m_surface);
}
return m_surface;
}
GSTexture9::operator IDirect3DTexture9*()
{
if(m_surface && !m_texture)
{
m_surface->GetContainer(__uuidof(IDirect3DTexture9), (void**)&m_texture);
ASSERT(m_texture);
}
return m_texture;
}

View File

@ -31,7 +31,6 @@ class GSTexture9 : public GSTexture
D3DSURFACE_DESC m_desc;
public:
GSTexture9();
explicit GSTexture9(IDirect3DSurface9* surface);
explicit GSTexture9(IDirect3DTexture9* texture);
virtual ~GSTexture9();
@ -47,7 +46,7 @@ public:
void Unmap();
bool Save(const string& fn, bool dds = false);
IDirect3DTexture9* operator->(); // TODO: remove direct access
//IDirect3DTexture9* operator->(); // TODO: remove direct access
operator IDirect3DSurface9*();
operator IDirect3DTexture9*();

View File

@ -40,8 +40,8 @@ __declspec(align(16)) struct GSVertex
GIFRegFOG FOG;
};
struct {__m128i m128i[2];};
struct {__m128 m128[2];};
struct {GSVector4i vi[2];};
struct {GSVector4 vf[2];};
};
GIFRegUV UV;

View File

@ -35,14 +35,10 @@ __declspec(align(16)) union GSVertexHW9
GSVector4 p;
};
#if _M_SSE >= 0x200
struct {GSVector4i vi[2];};
struct {GSVector4 vf[2];};
struct {__m128i m128i[2];};
struct {__m128 m128[2];};
GSVertexHW9& operator = (GSVertexHW9& v) {m128i[0] = v.m128i[0]; m128i[1] = v.m128i[1]; return *this;}
#endif
GSVertexHW9& operator = (GSVertexHW9& v) {vi[0] = v.vi[0]; vi[1] = v.vi[1]; return *this;}
float GetQ() {return p.w;}
};
@ -76,14 +72,10 @@ __declspec(align(16)) union GSVertexHW10
};
};
#if _M_SSE >= 0x200
struct {GSVector4i vi[2];};
struct {GSVector4 vf[2];};
struct {__m128i m128i[2];};
struct {__m128 m128[2];};
GSVertexHW10& operator = (GSVertexHW10& v) {m128i[0] = v.m128i[0]; m128i[1] = v.m128i[1]; return *this;}
#endif
GSVertexHW10& operator = (GSVertexHW10& v) {vi[0] = v.vi[0]; vi[1] = v.vi[1]; return *this;}
float GetQ() {return q;}
};