GSdx: more source cleanup and something interesting on F7

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1239 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gabest11 2009-05-22 23:23:38 +00:00
parent 82f0143d23
commit 8d119f3928
31 changed files with 156 additions and 151 deletions

View File

@ -85,11 +85,6 @@ EXPORT_C_(int32) GPUopen(HWND hWnd)
{
GPUclose();
GPURendererSettings rs;
int threads = 1;
int renderer = 1;
#ifdef _WINDOWS
AFX_MANAGE_STATE(AfxGetStaticModuleState());
@ -108,23 +103,15 @@ EXPORT_C_(int32) GPUopen(HWND hWnd)
return -1;
}
rs.m_filter = theApp.GetConfig("filter", 0);
rs.m_dither = theApp.GetConfig("dithering", 1);
rs.m_aspectratio = theApp.GetConfig("AspectRatio", 1);
rs.m_vsync = !!theApp.GetConfig("vsync", 0);
rs.m_scale.x = theApp.GetConfig("scale_x", 0);
rs.m_scale.y = theApp.GetConfig("scale_y", 0);
threads = theApp.GetConfig("swthreads", 1);
renderer = theApp.GetConfig("Renderer", 1);
int renderer = theApp.GetConfig("Renderer", 1);
switch(renderer)
{
default:
case 0: s_gpu = new GPURendererSW(rs, new GSDevice7(), threads); break;
case 1: s_gpu = new GPURendererSW(rs, new GSDevice9(), threads); break;
case 2: s_gpu = new GPURendererSW(rs, new GSDevice10(), threads); break;
// TODO: case 3: s_gpu = new GPURendererNull(rs, new GSDeviceNull(), threads); break;
case 0: s_gpu = new GPURendererSW(new GSDevice7()); break;
case 1: s_gpu = new GPURendererSW(new GSDevice9()); break;
case 2: s_gpu = new GPURendererSW(new GSDevice10()); break;
// TODO: case 3: s_gpu = new GPURendererNull(new GSDeviceNull()); break;
}
if(!s_gpu->Create(hWnd))

View File

@ -21,16 +21,17 @@
#include "StdAfx.h"
#include "GPULocalMemory.h"
#include "GSdx.h"
const GSVector4i GPULocalMemory::m_xxxa(0x00008000);
const GSVector4i GPULocalMemory::m_xxbx(0x00007c00);
const GSVector4i GPULocalMemory::m_xgxx(0x000003e0);
const GSVector4i GPULocalMemory::m_rxxx(0x0000001f);
GPULocalMemory::GPULocalMemory(const GSVector2i& scale)
GPULocalMemory::GPULocalMemory()
{
m_scale.x = min(max(scale.x, 0), 2);
m_scale.y = min(max(scale.y, 0), 2);
m_scale.x = min(max(theApp.GetConfig("scale_x", 0), 0), 2);
m_scale.y = min(max(theApp.GetConfig("scale_y", 0), 0), 2);
//

View File

@ -50,7 +50,7 @@ class GPULocalMemory
GSVector2i m_scale;
public:
GPULocalMemory(const GSVector2i& scale);
GPULocalMemory();
virtual ~GPULocalMemory();
GSVector2i GetScale() {return m_scale;}

View File

@ -21,18 +21,19 @@
#include "StdAfx.h"
#include "GPURenderer.h"
#include "GSdx.h"
map<HWND, GPURenderer*> GPURenderer::m_wnd2gpu;
GPURenderer::GPURenderer(const GPURendererSettings& rs)
: GPUState(rs.m_scale)
GPURenderer::GPURenderer(GSDevice* dev)
: m_dev(dev)
, m_hWnd(NULL)
, m_wndproc(NULL)
{
m_filter = rs.m_filter;
m_dither = rs.m_dither;
m_aspectratio = rs.m_aspectratio;
m_vsync = rs.m_vsync;
m_filter = theApp.GetConfig("filter", 0);
m_dither = theApp.GetConfig("dithering", 1);
m_aspectratio = theApp.GetConfig("AspectRatio", 1);
m_vsync = !!theApp.GetConfig("vsync", 0);
m_scale = m_mem.GetScale();
}

View File

@ -25,18 +25,15 @@
#include "GSVertexList.h"
#include "GSDevice.h"
struct GPURendererSettings
class GPURenderer : public GPUState
{
protected:
int m_filter;
int m_dither;
int m_aspectratio;
bool m_vsync;
GSVector2i m_scale;
};
class GPURenderer : public GPUState, protected GPURendererSettings
{
protected:
HWND m_hWnd;
WNDPROC m_wndproc;
static map<HWND, GPURenderer*> m_wnd2gpu;
@ -46,7 +43,10 @@ protected:
LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
public:
GPURenderer(const GPURendererSettings& rs);
GSDevice* m_dev;
public:
GPURenderer(GSDevice* dev);
virtual ~GPURenderer();
virtual bool Create(HWND hWnd);
@ -191,11 +191,8 @@ protected:
}
public:
GSDevice* m_dev;
public:
GPURendererT(const GPURendererSettings& rs)
: GPURenderer(rs)
GPURendererT(GSDevice* dev)
: GPURenderer(dev)
, m_count(0)
, m_maxcount(10000)
{
@ -291,7 +288,7 @@ public:
GetClientRect(m_hWnd, r);
m_dev->Present(r.fit(m_aspectratio));
m_dev->Present(r.fit(m_aspectratio), 0);
}
virtual bool MakeSnapshot(const string& path)

View File

@ -21,14 +21,13 @@
#include "StdAfx.h"
#include "GPURendererSW.h"
#include "GSdx.h"
GPURendererSW::GPURendererSW(const GPURendererSettings& rs, GSDevice* dev, int threads)
: GPURendererT(rs)
GPURendererSW::GPURendererSW(GSDevice* dev)
: GPURendererT(dev)
, m_texture(NULL)
{
m_dev = dev;
m_rl.Create<GPUDrawScanline>(this, threads);
m_rl.Create<GPUDrawScanline>(this, theApp.GetConfig("swthreads", 1));
m_fpDrawingKickHandlers[GPU_POLYGON] = (DrawingKickHandler)&GPURendererSW::DrawingKickTriangle;
m_fpDrawingKickHandlers[GPU_LINE] = (DrawingKickHandler)&GPURendererSW::DrawingKickLine;

View File

@ -44,6 +44,6 @@ protected:
GSTexture* GetOutput();
public:
GPURendererSW(const GPURendererSettings& rs, GSDevice* dev, int threads);
GPURendererSW(GSDevice* dev);
virtual ~GPURendererSW();
};

View File

@ -22,9 +22,8 @@
#include "stdafx.h"
#include "GPUState.h"
GPUState::GPUState(const GSVector2i& scale)
: m_mem(scale)
, s_n(0)
GPUState::GPUState()
: s_n(0)
{
memset(m_status, 0, sizeof(m_status));

View File

@ -119,7 +119,7 @@ public:
uint32 m_status[256];
public:
GPUState(const GSVector2i& scale);
GPUState();
virtual ~GPUState();
virtual void Reset();

View File

@ -100,10 +100,6 @@ static INT32 GSopen(void* dsp, char* title, int mt, int renderer)
{
GSclose();
GSRendererSettings rs;
int threads = 1;
#ifdef _WINDOWS
s_hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
@ -120,27 +116,17 @@ static INT32 GSopen(void* dsp, char* title, int mt, int renderer)
return -1;
}
rs.m_interlace = theApp.GetConfig("interlace", 0);
rs.m_aspectratio = theApp.GetConfig("aspectratio", 1);
rs.m_filter = theApp.GetConfig("filter", 1);
rs.m_vsync = !!theApp.GetConfig("vsync", 0);
rs.m_nativeres = !!theApp.GetConfig("nativeres", 0);
rs.m_aa1 = !!theApp.GetConfig("aa1", 0);
rs.m_blur = !!theApp.GetConfig("blur", 0);
threads = theApp.GetConfig("swthreads", 1);
switch(renderer)
{
default:
case 0: s_gs = new GSRendererHW9(s_basemem, !!mt, s_irq, rs); break;
case 1: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, rs, new GSDevice9(), threads); break;
case 2: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, rs, new GSDevice9()); break;
case 3: s_gs = new GSRendererHW10(s_basemem, !!mt, s_irq, rs); break;
case 4: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, rs, new GSDevice10(), threads); break;
case 5: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, rs, new GSDevice10()); break;
case 6: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, rs, new GSDeviceNull(), threads); break;
case 7: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, rs, new GSDeviceNull()); break;
case 0: s_gs = new GSRendererHW9(s_basemem, !!mt, s_irq); break;
case 1: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, new GSDevice9()); break;
case 2: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, new GSDevice9()); break;
case 3: s_gs = new GSRendererHW10(s_basemem, !!mt, s_irq); break;
case 4: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, new GSDevice10()); break;
case 5: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, new GSDevice10()); break;
case 6: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, new GSDeviceNull()); break;
case 7: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, new GSDeviceNull()); break;
}
if(!s_gs->Create(title))

View File

@ -70,7 +70,7 @@ bool GSDevice::Reset(int w, int h, bool fs)
return true;
}
void GSDevice::Present(const GSVector4i& r)
void GSDevice::Present(const GSVector4i& r, int shader)
{
GSVector4i cr;
@ -85,7 +85,9 @@ void GSDevice::Present(const GSVector4i& r)
if(m_current)
{
StretchRect(m_current, m_backbuffer, GSVector4(r));
static int s_shader[3] = {0, 5, 6}; // FIXME
StretchRect(m_current, m_backbuffer, GSVector4(r), s_shader[shader]);
}
Flip();
@ -145,9 +147,9 @@ GSTexture* GSDevice::CreateOffscreen(int w, int h, int format)
return Fetch(GSTexture::Offscreen, w, h, format);
}
void GSDevice::StretchRect(GSTexture* st, GSTexture* dt, const GSVector4& dr, bool linear)
void GSDevice::StretchRect(GSTexture* st, GSTexture* dt, const GSVector4& dr, int shader, bool linear)
{
StretchRect(st, GSVector4(0, 0, 1, 1), dt, dr, linear);
StretchRect(st, GSVector4(0, 0, 1, 1), dt, dr, shader, linear);
}
GSTexture* GSDevice::GetCurrent()

View File

@ -76,7 +76,7 @@ public:
virtual bool Reset(int w, int h, bool fs);
virtual bool IsLost() {return false;}
virtual void Present(const GSVector4i& r);
virtual void Present(const GSVector4i& r, int shader);
virtual void Flip() {};
virtual void BeginScene() {};
@ -94,8 +94,8 @@ public:
virtual GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format = 0) {return NULL;}
virtual void StretchRect(GSTexture* st, GSTexture* dt, const GSVector4& dr, bool linear = true);
virtual void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, bool linear = true) {}
virtual void StretchRect(GSTexture* st, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true);
virtual void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true) {}
GSTexture* GetCurrent();
virtual bool IsCurrentRGBA() {return true;}

View File

@ -228,13 +228,6 @@ bool GSDevice10::Create(HWND hWnd, bool vsync)
Reset(1, 1, true);
//
/*
if(!m_mergefx.Create(this))
{
return false;
}
*/
//
return true;
}
@ -409,9 +402,9 @@ GSTexture* GSDevice10::CopyOffscreen(GSTexture* src, const GSVector4& sr, int w,
return dst;
}
void GSDevice10::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, bool linear)
void GSDevice10::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader, bool linear)
{
StretchRect(st, sr, dt, dr, m_convert.ps[0], NULL, linear);
StretchRect(st, sr, dt, dr, m_convert.ps[shader], NULL, linear);
}
void GSDevice10::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, ID3D10PixelShader* ps, ID3D10Buffer* ps_cb, bool linear)

View File

@ -71,7 +71,7 @@ public: // TODO
CComPtr<ID3D10Buffer> vb;
CComPtr<ID3D10InputLayout> il;
CComPtr<ID3D10VertexShader> vs;
CComPtr<ID3D10PixelShader> ps[5];
CComPtr<ID3D10PixelShader> ps[7];
CComPtr<ID3D10SamplerState> ln;
CComPtr<ID3D10SamplerState> pt;
CComPtr<ID3D10DepthStencilState> dss;
@ -115,7 +115,7 @@ public:
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format = 0);
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, bool linear = true);
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true);
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, ID3D10PixelShader* ps, ID3D10Buffer* ps_cb, bool linear = true);
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, ID3D10PixelShader* ps, ID3D10Buffer* ps_cb, ID3D10BlendState* bs, bool linear = true);

View File

@ -131,7 +131,7 @@ bool GSDevice7::Reset(int w, int h, bool fs)
return true;
}
void GSDevice7::Present(const GSVector4i& r)
void GSDevice7::Present(const GSVector4i& r, int shader)
{
HRESULT hr;

View File

@ -42,5 +42,5 @@ public:
bool Create(HWND hWnd, bool vsync);
bool Reset(int w, int h, bool fs);
void Present(const GSVector4i& r);
void Present(const GSVector4i& r, int shader);
};

View File

@ -507,9 +507,9 @@ GSTexture* GSDevice9::CopyOffscreen(GSTexture* src, const GSVector4& sr, int w,
return dst;
}
void GSDevice9::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, bool linear)
void GSDevice9::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader, bool linear)
{
StretchRect(st, sr, dt, dr, m_convert.ps[0], NULL, 0, linear);
StretchRect(st, sr, dt, dr, m_convert.ps[shader], NULL, 0, linear);
}
void GSDevice9::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, bool linear)

View File

@ -108,7 +108,7 @@ public: // TODO
{
CComPtr<IDirect3DVertexShader9> vs;
CComPtr<IDirect3DVertexDeclaration9> il;
CComPtr<IDirect3DPixelShader9> ps[5];
CComPtr<IDirect3DPixelShader9> ps[7];
Direct3DSamplerState9 ln;
Direct3DSamplerState9 pt;
Direct3DDepthStencilState9 dss;
@ -153,7 +153,7 @@ public:
virtual bool IsCurrentRGBA() {return false;}
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, bool linear = true);
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true);
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, bool linear = true);
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, Direct3DBlendState9* bs, bool linear = true);

View File

@ -22,19 +22,19 @@
#include "StdAfx.h"
#include "GSRenderer.h"
GSRenderer::GSRenderer(uint8* base, bool mt, void (*irq)(), const GSRendererSettings& rs, bool psrr)
GSRenderer::GSRenderer(uint8* base, bool mt, void (*irq)(), GSDevice* dev, bool psrr)
: GSState(base, mt, irq)
, m_dev(NULL)
, m_osd(true)
, m_dev(dev)
, m_shader(0)
, m_psrr(psrr)
{
m_interlace = rs.m_interlace;
m_aspectratio = rs.m_aspectratio;
m_filter = rs.m_filter;
m_vsync = rs.m_vsync;
m_nativeres = rs.m_nativeres;
m_aa1 = rs.m_aa1;
m_blur = rs.m_blur;
m_interlace = theApp.GetConfig("interlace", 0);
m_aspectratio = theApp.GetConfig("aspectratio", 1);
m_filter = theApp.GetConfig("filter", 1);
m_vsync = !!theApp.GetConfig("vsync", 0);
m_nativeres = !!theApp.GetConfig("nativeres", 0);
m_aa1 = !!theApp.GetConfig("aa1", 0);
m_blur = !!theApp.GetConfig("blur", 0);
s_n = 0;
s_dump = !!theApp.GetConfig("dump", 0);
@ -328,7 +328,7 @@ void GSRenderer::VSync(int field)
m_wnd.GetClientRect(r);
m_dev->Present(r.fit(m_aspectratio));
m_dev->Present(r.fit(m_aspectratio), m_shader);
// snapshot
@ -406,8 +406,7 @@ void GSRenderer::KeyEvent(GSKeyEventData* e)
m_aspectratio = (m_aspectratio + 3 + step) % 3;
return;
case VK_F7:
m_wnd.SetWindowText(_T("PCSX2"));
m_osd = !m_osd;
m_shader = (m_shader + 3 + step) % 3;
return;
case VK_F12:
if(m_capture.IsCapturing()) m_capture.EndCapture();

View File

@ -28,8 +28,15 @@
#include "GSSettingsDlg.h"
#include "GSCapture.h"
struct GSRendererSettings
class GSRenderer : public GSState
{
GSCapture m_capture;
string m_snapshot;
int m_shader;
bool Merge(int field);
protected:
int m_interlace;
int m_aspectratio;
int m_filter;
@ -37,22 +44,13 @@ struct GSRendererSettings
bool m_nativeres;
bool m_aa1;
bool m_blur;
};
class GSRenderer : public GSState, protected GSRendererSettings
{
bool Merge(int field);
protected:
virtual void ResetDevice() {}
virtual GSTexture* GetOutput(int i) = 0;
public:
GSWnd m_wnd;
GSDevice* m_dev;
GSCapture m_capture;
string m_snapshot;
bool m_osd;
bool m_psrr;
int s_n;
@ -61,15 +59,13 @@ public:
bool s_savez;
public:
GSRenderer(uint8* base, bool mt, void (*irq)(), const GSRendererSettings& rs, bool psrr = true);
GSRenderer(uint8* base, bool mt, void (*irq)(), GSDevice* dev, bool psrr = true);
virtual ~GSRenderer();
virtual bool Create(const string& title);
virtual void VSync(int field);
virtual void KeyEvent(GSKeyEventData* e);
virtual bool MakeSnapshot(const string& path);
virtual void MinMaxUV(int w, int h, GSVector4i& r)
@ -221,8 +217,8 @@ protected:
virtual void Draw() = 0;
public:
GSRendererT(uint8* base, bool mt, void (*irq)(), const GSRendererSettings& rs, bool psrr = true)
: GSRenderer(base, mt, irq, rs, psrr)
GSRendererT(uint8* base, bool mt, void (*irq)(), GSDevice* dev, bool psrr = true)
: GSRenderer(base, mt, irq, dev, psrr)
, m_count(0)
, m_maxcount(0)
, m_vertices(NULL)

View File

@ -247,7 +247,7 @@ protected:
TEX0.TBW = DISPFB.FBW;
TEX0.PSM = DISPFB.PSM;
TRACE(_T("[%d] GetOutput %d %05x (%d)\n"), (int)m_perfmon.GetFrame(), i, (int)TEX0.TBP0, (int)TEX0.PSM);
// TRACE(_T("[%d] GetOutput %d %05x (%d)\n"), (int)m_perfmon.GetFrame(), i, (int)TEX0.TBP0, (int)TEX0.PSM);
GSTexture* t = NULL;
@ -665,9 +665,9 @@ protected:
}
public:
GSRendererHW(uint8* base, bool mt, void (*irq)(), const GSRendererSettings& rs, bool psrr)
: GSRendererT<Vertex>(base, mt, irq, rs, psrr)
, m_tc(NULL)
GSRendererHW(uint8* base, bool mt, void (*irq)(), GSDevice* dev, GSTextureCache* tc, bool psrr)
: GSRendererT<Vertex>(base, mt, irq, dev, psrr)
, m_tc(tc)
, m_width(1024)
, m_height(1024)
, m_skip(0)

View File

@ -24,12 +24,9 @@
#include "GSCrc.h"
#include "resource.h"
GSRendererHW10::GSRendererHW10(uint8* base, bool mt, void (*irq)(), const GSRendererSettings& rs)
: GSRendererHW<GSVertexHW10>(base, mt, irq, rs, true)
GSRendererHW10::GSRendererHW10(uint8* base, bool mt, void (*irq)())
: GSRendererHW<GSVertexHW10>(base, mt, irq, new GSDevice10(), new GSTextureCache10(this), true)
{
m_dev = new GSDevice10();
m_tc = new GSTextureCache10(this);
InitVertexKick<GSRendererHW10>();
}

View File

@ -44,7 +44,7 @@ protected:
void SetupDATE(GSTexture* rt, GSTexture* ds);
public:
GSRendererHW10(uint8* base, bool mt, void (*irq)(), const GSRendererSettings& rs);
GSRendererHW10(uint8* base, bool mt, void (*irq)());
bool Create(const string& title);

View File

@ -24,15 +24,12 @@
#include "GSCrc.h"
#include "resource.h"
GSRendererHW9::GSRendererHW9(uint8* base, bool mt, void (*irq)(), const GSRendererSettings& rs)
: GSRendererHW<GSVertexHW9>(base, mt, irq, rs, false)
GSRendererHW9::GSRendererHW9(uint8* base, bool mt, void (*irq)())
: GSRendererHW<GSVertexHW9>(base, mt, irq, new GSDevice9(), new GSTextureCache9(this), false)
{
m_fba.enabled = !!theApp.GetConfig("fba", 1);
m_logz = !!theApp.GetConfig("logz", 0);
m_dev = new GSDevice9();
m_tc = new GSTextureCache9(this);
InitVertexKick<GSRendererHW9>();
}

View File

@ -53,7 +53,7 @@ protected:
void UpdateFBA(GSTexture* rt);
public:
GSRendererHW9(uint8* base, bool mt, void (*irq)(), const GSRendererSettings& rs);
GSRendererHW9(uint8* base, bool mt, void (*irq)());
bool Create(const string& title);

View File

@ -37,11 +37,9 @@ protected:
}
public:
GSRendererNull(uint8* base, bool mt, void (*irq)(), const GSRendererSettings& rs, GSDevice* dev)
: GSRendererT<GSVertexNull>(base, mt, irq, rs)
GSRendererNull(uint8* base, bool mt, void (*irq)(), GSDevice* dev)
: GSRendererT<GSVertexNull>(base, mt, irq, dev)
{
m_dev = dev;
InitVertexKick<GSRendererNull>();
}

View File

@ -24,16 +24,14 @@
const GSVector4 g_pos_scale(1.0f / 16, 1.0f / 16, 1.0f, 128.0f);
GSRendererSW::GSRendererSW(uint8* base, bool mt, void (*irq)(), const GSRendererSettings& rs, GSDevice* dev, int threads)
: GSRendererT(base, mt, irq, rs)
GSRendererSW::GSRendererSW(uint8* base, bool mt, void (*irq)(), GSDevice* dev)
: GSRendererT(base, mt, irq, dev)
{
m_dev = dev;
m_tc = new GSTextureCacheSW(this);
memset(m_texture, 0, sizeof(m_texture));
m_rl.Create<GSDrawScanline>(this, threads);
m_rl.Create<GSDrawScanline>(this, theApp.GetConfig("swthreads", 1));
InitVertexKick<GSRendererSW>();
}

View File

@ -50,7 +50,7 @@ protected:
void GetScanlineParam(GSScanlineParam& p, GS_PRIM_CLASS primclass);
public:
GSRendererSW(uint8* base, bool mt, void (*irq)(), const GSRendererSettings& rs, GSDevice* dev, int threads);
GSRendererSW(uint8* base, bool mt, void (*irq)(), GSDevice* dev);
virtual ~GSRendererSW();
template<uint32 prim, uint32 tme, uint32 fst>

View File

@ -120,7 +120,7 @@ bool GSUtil::CheckDirectX()
}
else
{
int res = AfxMessageBox(_T("Please update DirectX!\n\nWould you like to open the download page in your browser?"), MB_YESNO);
int res = AfxMessageBox(_T("You need to update directx, would you like to do it now?"), MB_YESNO);
if(res == IDYES)
{

View File

@ -65,3 +65,31 @@ float4 ps_main4(PS_INPUT input) : SV_Target0
return fmod(c * 255 + 0.5f, 256) / 255;
}
float4 ps_crt(PS_INPUT input, uint i)
{
float4 mask[4] =
{
float4(1, 0, 0, 0),
float4(0, 1, 0, 0),
float4(0, 0, 1, 0),
float4(1, 1, 1, 0)
};
return Texture.Sample(Sampler, input.t) * saturate(mask[i] + 0.25f);
}
float4 ps_main5(PS_INPUT input) : SV_Target0 // triangular
{
uint4 p = (uint4)input.p;
// return ps_crt(input, ((p.x + (p.y & 1) * 3) >> 1) % 3);
return ps_crt(input, ((p.x + ((p.y >> 1) & 1) * 3) >> 1) % 3);
}
float4 ps_main6(PS_INPUT input) : SV_Target0 // diagonal
{
uint4 p = (uint4)input.p;
return ps_crt(input, (p.x + (p.y % 3)) % 3);
}

View File

@ -53,3 +53,30 @@ float4 ps_main4() : COLOR
return 1;
}
float4 ps_crt(float2 t, int i)
{
float4 mask[4] =
{
float4(1, 0, 0, 0),
float4(0, 1, 0, 0),
float4(0, 0, 1, 0),
float4(1, 1, 1, 0)
};
return tex2D(Texture, t) * saturate(mask[i] + 0.5f);
}
float4 ps_main5(float2 t : TEXCOORD0, float4 vPos : VPOS) : COLOR // triangular
{
int4 p = (int4)vPos;
// return ps_crt(t, ((p.x + (p.y % 2) * 3) / 2) % 3);
return ps_crt(t, ((p.x + ((p.y / 2) % 2) * 3) / 2) % 3);
}
float4 ps_main6(float2 t : TEXCOORD0, float4 vPos : VPOS) : COLOR // diagonal
{
int4 p = (int4)vPos;
return ps_crt(t, (p.x + (p.y % 3)) % 3);
}