GSdx: disabled blurring can be re-enabled in the settings or with the END key, the image shifting is corrected back to 1 pixel even if the internal rendering resolution is upscaled.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@840 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gabest11 2009-03-24 09:11:03 +00:00
parent e0d7e180ac
commit 0c90ff1eb6
7 changed files with 101 additions and 62 deletions

View File

@ -118,6 +118,7 @@ static INT32 GSopen(void* dsp, char* title, int mt, int renderer)
rs.m_vsync = !!AfxGetApp()->GetProfileInt(_T("Settings"), _T("vsync"), FALSE);
rs.m_nativeres = !!AfxGetApp()->GetProfileInt(_T("Settings"), _T("nativeres"), FALSE);
rs.m_aa1 = !!AfxGetApp()->GetProfileInt(_T("Settings"), _T("aa1"), FALSE);
rs.m_blur = !!AfxGetApp()->GetProfileInt(_T("Settings"), _T("blur"), FALSE);
int threads = AfxGetApp()->GetProfileInt(_T("Settings"), _T("swthreads"), 1);

View File

@ -478,8 +478,6 @@ void GSRasterizer::DrawTriangleSection(int top, int bottom, GSVertexSW& l, const
GSVertexSW scan = l + dscan * (lrmax - l.p).xxxx();
ASSERT(m_dsf.ssl);
m_dsf.ssl(right, left, top, scan);
}
}
@ -521,8 +519,6 @@ void GSRasterizer::DrawTriangleSection(int top, int bottom, GSVertexSW& l, const
GSVertexSW scan = l + dscan * (lrmax - l.p).xxxx();
ASSERT(m_dsf.ssl);
m_dsf.ssl(right, left, top, scan);
}
}

View File

@ -35,6 +35,7 @@ struct GSRendererSettings
bool m_vsync;
bool m_nativeres;
bool m_aa1;
bool m_blur;
};
class GSRendererBase : public GSState, protected GSRendererSettings
@ -90,6 +91,12 @@ protected:
m_aa1 = !m_aa1;
return true;
}
if(msg.wParam == VK_END)
{
m_blur = !m_blur;
return true;
}
}
return false;
@ -109,6 +116,7 @@ public:
m_vsync = rs.m_vsync;
m_nativeres = rs.m_nativeres;
m_aa1 = rs.m_aa1;
m_blur = rs.m_blur;
};
virtual bool Create(LPCTSTR title) = 0;
@ -148,60 +156,67 @@ protected:
}
}
if(!en[0] && !en[1])
{
return false;
}
// try to avoid fullscreen blur, could be nice on tv but on a monitor it's like double vision, hurts my eyes (persona 4, guitar hero)
//
// NOTE: probably the technique explained in graphtip.pdf (Antialiasing by Supersampling / 4. Reading Odd/Even Scan Lines Separately with the PCRTC then Blending)
if(en[0] && en[1] && PMODE->SLBG == 0 && PMODE->MMOD == 1 && PMODE->ALP == 0x80)
bool samesrc = en[0] && en[1] && DISPFB[0]->FBP == DISPFB[1]->FBP && DISPFB[0]->FBW == DISPFB[1]->FBW && DISPFB[0]->PSM == DISPFB[1]->PSM;
bool blurdetected = false;
if(samesrc && PMODE->SLBG == 0 && PMODE->MMOD == 1 && PMODE->ALP == 0x80)
{
if(DISPFB[0]->FBP == DISPFB[1]->FBP
&& DISPFB[0]->FBW == DISPFB[1]->FBW
&& DISPFB[0]->PSM == DISPFB[1]->PSM)
if(fr[0] == fr[1] + CRect(0, 1, 0, 0) && dr[0] == dr[1] + CRect(0, 0, 0, 1)
|| fr[1] == fr[0] + CRect(0, 1, 0, 0) && dr[1] == dr[0] + CRect(0, 0, 0, 1))
{
if(fr[0] == fr[1] + CRect(0, 1, 0, 0) && dr[0] == dr[1] + CRect(0, 0, 0, 1)
|| fr[1] == fr[0] + CRect(0, 1, 0, 0) && dr[1] == dr[0] + CRect(0, 0, 0, 1))
{
// persona 4:
//
// fr[0] = 0, 0, 640, 448 (y = 0, height = 448)
// fr[1] = 0, 1, 640, 448 (y = 1, height = 447)
// dr[0] = 159, 50, 779, 498 (y = 50, height = 448)
// dr[1] = 159, 50, 779, 497 (y = 50, height = 447)
//
// second image shifted up by 1 pixel and blended over itself
//
// god of war:
//
// fr[0] = 0 1 512 448
// fr[1] = 0 0 512 448
// dr[0] = 127 50 639 497
// dr[1] = 127 50 639 498
//
// same just the first image shifted
// persona 4:
//
// fr[0] = 0 0 640 448
// fr[1] = 0 1 640 448
// dr[0] = 159 50 779 498
// dr[1] = 159 50 779 497
//
// second image shifted up by 1 pixel and blended over itself
//
// god of war:
//
// fr[0] = 0 1 512 448
// fr[1] = 0 0 512 448
// dr[0] = 127 50 639 497
// dr[1] = 127 50 639 498
//
// same just the first image shifted
int top = min(fr[0].top, fr[1].top);
int bottom = max(dr[0].bottom, dr[1].bottom);
int top = min(fr[0].top, fr[1].top);
int bottom = max(dr[0].bottom, dr[1].bottom);
fr[0].top = top;
fr[1].top = top;
dr[0].bottom = bottom;
dr[1].bottom = bottom;
}
else if(dr[0] == dr[1] && (fr[0] == fr[1] + CPoint(0, 1) || fr[1] == fr[0] + CPoint(0, 1)))
{
// dq5:
//
// fr[0] = 0 1 512 445
// fr[1] = 0 0 512 444
// dr[0] = 127 50 639 494
// dr[1] = 127 50 639 494
fr[0].top = top;
fr[1].top = top;
dr[0].bottom = bottom;
dr[1].bottom = bottom;
int top = min(fr[0].top, fr[1].top);
int bottom = min(fr[0].bottom, fr[1].bottom);
blurdetected = true;
}
else if(dr[0] == dr[1] && (fr[0] == fr[1] + CPoint(0, 1) || fr[1] == fr[0] + CPoint(0, 1)))
{
// dq5:
//
// fr[0] = 0 1 512 445
// fr[1] = 0 0 512 444
// dr[0] = 127 50 639 494
// dr[1] = 127 50 639 494
fr[0].top = fr[1].top = top;
fr[0].bottom = fr[1].bottom = bottom;
}
int top = min(fr[0].top, fr[1].top);
int bottom = min(fr[0].bottom, fr[1].bottom);
fr[0].top = fr[1].top = top;
fr[0].bottom = fr[1].bottom = bottom;
blurdetected = true;
}
}
@ -209,15 +224,25 @@ protected:
CSize ds(0, 0);
Texture tex[2];
if(samesrc && fr[0].bottom == fr[1].bottom)
{
GetOutput(0, tex[0]);
tex[1] = tex[0]; // saves one texture fetch
}
else
{
if(en[0]) GetOutput(0, tex[0]);
if(en[1]) GetOutput(1, tex[1]);
}
GSVector4 src[2];
GSVector4 dst[2];
for(int i = 0; i < 2; i++)
{
if(!en[i] || !GetOutput(i, tex[i]))
{
continue;
}
if(!en[i] || !tex[i]) continue;
CRect r = fr[i];
@ -232,10 +257,20 @@ protected:
//
src[i].x = tex[i].m_scale.x * r.left / tex[i].GetWidth();
src[i].y = tex[i].m_scale.y * r.top / tex[i].GetHeight();
src[i].z = tex[i].m_scale.x * r.right / tex[i].GetWidth();
src[i].w = tex[i].m_scale.y * r.bottom / tex[i].GetHeight();
if(m_blur && blurdetected && i == 1)
{
src[i].x = tex[i].m_scale.x * r.left / tex[i].GetWidth();
src[i].y = (tex[i].m_scale.y * r.top + 1) / tex[i].GetHeight();
src[i].z = tex[i].m_scale.x * r.right / tex[i].GetWidth();
src[i].w = (tex[i].m_scale.y * r.bottom + 1) / tex[i].GetHeight();
}
else
{
src[i].x = tex[i].m_scale.x * r.left / tex[i].GetWidth();
src[i].y = tex[i].m_scale.y * r.top / tex[i].GetHeight();
src[i].z = tex[i].m_scale.x * r.right / tex[i].GetWidth();
src[i].w = tex[i].m_scale.y * r.bottom / tex[i].GetHeight();
}
GSVector2 o;

View File

@ -76,6 +76,7 @@ GSSettingsDlg::GSSettingsDlg(CWnd* pParent /*=NULL*/)
, m_logz(FALSE)
, m_fba(TRUE)
, m_aa1(FALSE)
, m_blur(FALSE)
{
}
@ -117,6 +118,7 @@ void GSSettingsDlg::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_CHECK5, m_logz);
DDX_Check(pDX, IDC_CHECK7, m_fba);
DDX_Check(pDX, IDC_CHECK8, m_aa1);
DDX_Check(pDX, IDC_CHECK9, m_blur);
}
BEGIN_MESSAGE_MAP(GSSettingsDlg, CDialog)
@ -223,6 +225,7 @@ BOOL GSSettingsDlg::OnInitDialog()
m_logz = !!pApp->GetProfileInt(_T("Settings"), _T("logz"), FALSE);
m_fba = !!pApp->GetProfileInt(_T("Settings"), _T("fba"), TRUE);
m_aa1 = !!pApp->GetProfileInt(_T("Settings"), _T("aa1"), FALSE);
m_blur = !!pApp->GetProfileInt(_T("Settings"), _T("blur"), FALSE);
m_resx.SetRange(512, 4096);
m_resy.SetRange(512, 4096);
@ -287,6 +290,7 @@ void GSSettingsDlg::OnOK()
pApp->WriteProfileInt(_T("Settings"), _T("logz"), m_logz);
pApp->WriteProfileInt(_T("Settings"), _T("fba"), m_fba);
pApp->WriteProfileInt(_T("Settings"), _T("aa1"), m_aa1);
pApp->WriteProfileInt(_T("Settings"), _T("blur"), m_blur);
pApp->WriteProfileInt(_T("Settings"), _T("resx"), m_resx.GetPos());
pApp->WriteProfileInt(_T("Settings"), _T("resy"), m_resy.GetPos());

View File

@ -61,6 +61,7 @@ public:
BOOL m_logz;
BOOL m_fba;
BOOL m_aa1;
BOOL m_blur;
protected:
virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);

View File

@ -82,13 +82,13 @@ IDB_LOGO10 BITMAP "res\\logo10.bmp"
// Dialog
//
IDD_CONFIG DIALOGEX 0, 0, 189, 245
IDD_CONFIG DIALOGEX 0, 0, 189, 256
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Settings..."
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP,7,7,175,44
CONTROL 2022,IDC_LOGO10,"Static",SS_BITMAP,7,7,175,44
CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP,7,15,175,44
LTEXT "Resolution:",IDC_STATIC,7,59,37,8
COMBOBOX IDC_COMBO3,71,57,111,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Renderer:",IDC_STATIC,7,74,34,8
@ -116,8 +116,9 @@ BEGIN
CONTROL "Alpha correction (FBA)",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,193,102,10
CONTROL "Edge anti-aliasing (AA1, sw-mode only)",IDC_CHECK8,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,206,141,10
DEFPUSHBUTTON "OK",IDOK,43,224,50,14
PUSHBUTTON "Cancel",IDCANCEL,96,224,50,14
CONTROL "Enable output merger blur effect",IDC_CHECK9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,219,121,10
DEFPUSHBUTTON "OK",IDOK,43,235,50,14
PUSHBUTTON "Cancel",IDCANCEL,96,235,50,14
END
IDD_CAPTURE DIALOGEX 0, 0, 279, 71
@ -181,7 +182,7 @@ BEGIN
VERTGUIDE, 80
VERTGUIDE, 182
TOPMARGIN, 7
BOTTOMMARGIN, 238
BOTTOMMARGIN, 249
END
IDD_CAPTURE, DIALOG

View File

@ -35,6 +35,7 @@
#define IDD_CAPTURE 2026
#define IDC_EDIT4 2027
#define IDD_GPUCONFIG 2027
#define IDC_CHECK9 2028
#define IDR_CONVERT9_FX 10000
#define IDR_TFX9_FX 10001
#define IDR_MERGE9_FX 10002
@ -50,7 +51,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 10009
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 2028
#define _APS_NEXT_CONTROL_VALUE 2029
#define _APS_NEXT_SYMED_VALUE 5000
#endif
#endif