added ssaa and efb scale as separate configurations:

efb scale :
auto fractional: the original scaling way, will grant a 1:1 pixel mapping between efb and screen giving the best image quality even in non standard resolutions
at the cost of glitches in some games.
auto integral: automatic but only int values for the scale, no glitches but only the correct pixel scaling when using some resolutions.
the rest are the fixed scales.
enjoy.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5639 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado 2010-06-09 15:33:01 +00:00
parent b3046be7ad
commit 9d792d4673
8 changed files with 270 additions and 220 deletions

View File

@ -74,6 +74,8 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Settings", "FreeLook", &bFreeLook, 0);
iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0);
iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0);
iniFile.Get("Settings", "EFBScale", &iEFBScale, 0);
iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false);
iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0);
@ -132,6 +134,8 @@ void VideoConfig::GameIniLoad(const char *ini_file)
if (iniFile.Exists("Video", "MSAA"))
iniFile.Get("Video", "MSAA", &iMultisampleMode);
if (iniFile.Exists("Video", "EFBScale"))
iniFile.Get("Video", "EFBScale", &iEFBScale, 0);
if (iniFile.Exists("Video", "DstAlphaPass"))
iniFile.Get("Video", "DstAlphaPass", &bDstAlphaPass);
if (iniFile.Exists("Video", "UseXFB"))
@ -178,6 +182,7 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions);
iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors);
iniFile.Set("Settings", "MSAA", iMultisampleMode);
iniFile.Set("Settings", "EFBScale", iEFBScale);
iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable);
iniFile.Set("Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter);
iniFile.Set("Settings", "Wireframe", bWireFrame);

View File

@ -80,6 +80,7 @@ struct VideoConfig
// Enhancements
int iMultisampleMode;
int iEFBScale;
bool bForceFiltering;
int iMaxAnisotropy;
std::string sPostProcessingShader;

View File

@ -148,15 +148,9 @@ void Enumerate()
bool isNvidia = a.ident.VendorId == VENDOR_NVIDIA;
// Add SuperSamples modes
a.aa_levels.push_back(AALevel("1x EFB - SSAA NONE", D3DMULTISAMPLE_NONE, 0));
a.aa_levels.push_back(AALevel("1x EFB - 4x SSAA", D3DMULTISAMPLE_NONE, 0));
a.aa_levels.push_back(AALevel("1x EFB - 9x SSAA", D3DMULTISAMPLE_NONE, 0));
a.aa_levels.push_back(AALevel("2x EFB - SSAA NONE", D3DMULTISAMPLE_NONE, 0));
a.aa_levels.push_back(AALevel("2x EFB - 4x SSAA", D3DMULTISAMPLE_NONE, 0));
a.aa_levels.push_back(AALevel("2x EFB - 9x SSAA", D3DMULTISAMPLE_NONE, 0));
a.aa_levels.push_back(AALevel("3x EFB - SSAA NONE", D3DMULTISAMPLE_NONE, 0));
a.aa_levels.push_back(AALevel("3x EFB - 4x SSAA", D3DMULTISAMPLE_NONE, 0));
a.aa_levels.push_back(AALevel("3x EFB - 9x SSAA", D3DMULTISAMPLE_NONE, 0));
a.aa_levels.push_back(AALevel("NONE", D3DMULTISAMPLE_NONE, 0));
a.aa_levels.push_back(AALevel("4x SSAA", D3DMULTISAMPLE_NONE, 0));
a.aa_levels.push_back(AALevel("9x SSAA", D3DMULTISAMPLE_NONE, 0));
//Add multisample modes
//disable them will they are not implemnted
/*

View File

@ -58,13 +58,23 @@ struct TabDirect3D : public W32Util::Tab
swprintf_s( tempstr, _T("%hs"), adapter.aa_levels[i].name );
ComboBox_AddString(GetDlgItem(hDlg, IDC_ANTIALIASMODE), tempstr);
}
ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_ANTIALIASMODE), g_Config.iMultisampleMode);
if (adapter.aa_levels.size() == 1)
{
ComboBox_Enable(GetDlgItem(hDlg, IDC_ANTIALIASMODE), FALSE);
}
swprintf_s( tempstr, _T("%hs"), "Auto (Fractional)" );
ComboBox_AddString(GetDlgItem(hDlg, IDC_EFBSCALE), tempstr);
swprintf_s( tempstr, _T("%hs"), "Auto (Integral)" );
ComboBox_AddString(GetDlgItem(hDlg, IDC_EFBSCALE), tempstr);
swprintf_s( tempstr, _T("%hs"), "1x" );
ComboBox_AddString(GetDlgItem(hDlg, IDC_EFBSCALE), tempstr);
swprintf_s( tempstr, _T("%hs"), "2x" );
ComboBox_AddString(GetDlgItem(hDlg, IDC_EFBSCALE), tempstr);
swprintf_s( tempstr, _T("%hs"), "3x" );
ComboBox_AddString(GetDlgItem(hDlg, IDC_EFBSCALE), tempstr);
ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_EFBSCALE), g_Config.iEFBScale);
for (int i = 0; i < 4; i++)
{
ComboBox_AddString(GetDlgItem(hDlg, IDC_ASPECTRATIO), aspect_ratio_names[i]);
@ -150,6 +160,7 @@ struct TabDirect3D : public W32Util::Tab
{
g_Config.iAdapter = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_ADAPTER));
g_Config.iMultisampleMode = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_ANTIALIASMODE));
g_Config.iEFBScale = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_EFBSCALE));
g_Config.bVSync = Button_GetCheck(GetDlgItem(hDlg, IDC_VSYNC)) ? true : false;
if(Button_GetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_SAFE)))
{

View File

@ -69,8 +69,8 @@ static int s_XFB_height;
static float xScale;
static float yScale;
static int EFBxScale;
static int EFByScale;
static float EFBxScale;
static float EFByScale;
static int s_recordWidth;
static int s_recordHeight;
@ -80,6 +80,7 @@ static bool s_AVIDumping;
static u32 s_blendMode;
static u32 s_LastAA;
static u32 s_LastEFBScale;
static bool IS_AMD;
static bool XFBWrited;
@ -287,11 +288,27 @@ bool Renderer::Init()
yScale = (float)(dst_rect.bottom - dst_rect.top) / (float)s_XFB_height;
}
s_LastAA = (g_ActiveConfig.iMultisampleMode > 3)?0:g_ActiveConfig.iMultisampleMode;
s_LastAA = g_ActiveConfig.iMultisampleMode;
s_LastEFBScale = g_ActiveConfig.iEFBScale;
float SupersampleCoeficient = s_LastAA + 1;
switch(s_LastEFBScale)
{
case 0:
EFBxScale = xScale;
EFByScale = yScale;
break;
case 1:
EFBxScale = ceilf(xScale);
EFByScale = ceilf(yScale);
break;
default:
EFBxScale = g_ActiveConfig.iEFBScale - 1;
EFByScale = EFBxScale;
break;
};
float SupersampleCoeficient = (s_LastAA % 3) + 1;
EFBxScale = (s_LastAA / 3) + 1 * SupersampleCoeficient;
EFByScale = EFBxScale;
EFBxScale *= SupersampleCoeficient;
EFByScale *= SupersampleCoeficient;
s_target_width = EFB_WIDTH * EFBxScale;
s_target_height = EFB_HEIGHT * EFByScale;
@ -1177,9 +1194,11 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
}
u32 newAA = g_ActiveConfig.iMultisampleMode;
if(newAA != s_LastAA || xfbchanged || WindowResized)
u32 newEFBScale = g_ActiveConfig.iEFBScale;
if(newAA != s_LastAA || newEFBScale != s_LastEFBScale || xfbchanged || WindowResized)
{
s_LastAA = newAA;
s_LastEFBScale = newEFBScale;
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
@ -1193,9 +1212,25 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
yScale = (float)(dst_rect.bottom - dst_rect.top) / (float)s_XFB_height;
}
float SupersampleCoeficient = (s_LastAA % 3) + 1;
EFBxScale = (s_LastAA / 3) + 1 * SupersampleCoeficient;
EFByScale = EFBxScale;
float SupersampleCoeficient = s_LastAA + 1;
switch(s_LastEFBScale)
{
case 0:
EFBxScale = xScale;
EFByScale = yScale;
break;
case 1:
EFBxScale = ceilf(xScale);
EFByScale = ceilf(yScale);
break;
default:
EFBxScale = g_ActiveConfig.iEFBScale - 1;
EFByScale = EFBxScale;
break;
};
EFBxScale *= SupersampleCoeficient;
EFByScale *= SupersampleCoeficient;
s_target_width = EFB_WIDTH * EFBxScale;
s_target_height = EFB_HEIGHT * EFByScale;
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());

View File

@ -362,7 +362,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
int tex_w = (abs(source_rect.GetWidth()) >> bScaleByHalf);
int tex_h = (abs(source_rect.GetHeight()) >> bScaleByHalf);
//compensate the texture grow if supersampling is enabled to conserve memory usage
float SuperSampleCompensation = (g_ActiveConfig.iMultisampleMode % 3) + 1;
float SuperSampleCompensation = g_ActiveConfig.iMultisampleMode + 1;
SuperSampleCompensation = 1.0f / SuperSampleCompensation;
float xScale = Renderer::GetTargetScaleX();
float yScale = Renderer::GetTargetScaleY();

View File

@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by resource.rc
// Used by Resource.rc
//
#define IDD_ABOUT 102
#define IDD_SETTINGS 103
@ -8,6 +8,8 @@
#define IDD_ADVANCED 105
#define IDC_ADAPTER 1001
#define IDC_ANTIALIASMODE 1002
#define IDC_ANTIALIASMODE2 1003
#define IDC_EFBSCALE 1003
#define IDC_VSYNC 1006
#define IDC_WIDESCREEN_HACK 1010
#define IDC_SAFE_TEXTURE_CACHE 1011

View File

@ -40,14 +40,14 @@ IDD_SETTINGS DIALOGEX 0, 0, 244, 183
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_SYSMENU
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "&Graphics card:",IDC_STATIC,9,9,49,8
COMBOBOX IDC_ADAPTER,68,7,162,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "&V-Sync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,25,36,8
LTEXT "&Graphics card:",IDC_STATIC,7,7,49,8
COMBOBOX IDC_ADAPTER,61,7,176,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "&V-Sync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,61,25,36,8
CONTROL "&Widescreen Hack",IDC_WIDESCREEN_HACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,25,67,10
LTEXT "&Aspect Ratio:",IDC_STATIC,9,40,48,8
COMBOBOX IDC_ASPECTRATIO,68,39,89,57,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Scale - AA mode:",IDC_STATIC,9,59,59,8
COMBOBOX IDC_ANTIALIASMODE,68,59,162,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "&Aspect Ratio:",IDC_STATIC,7,40,48,8
COMBOBOX IDC_ASPECTRATIO,61,39,89,57,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "SSAA mode:",IDC_STATIC,7,61,46,8
COMBOBOX IDC_ANTIALIASMODE,61,59,48,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "&Enable CPU->EFB access ",IDC_EFB_ACCESS_ENABLE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,80,94,11
GROUPBOX "Safe Texture Cache Mode",IDC_STATIC,109,94,125,27
CONTROL "&Safe Texture Cache",IDC_SAFE_TEXTURE_CACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,104,80,11
@ -55,6 +55,8 @@ BEGIN
CONTROL "Normal",IDC_SAFE_TEXTURE_CACHE_NORMAL,"Button",BS_AUTORADIOBUTTON,154,105,38,10
CONTROL "Fast",IDC_SAFE_TEXTURE_CACHE_FAST,"Button",BS_AUTORADIOBUTTON,198,105,30,10
CONTROL "",IDC_DXCHK,"RichEdit20W",ES_MULTILINE | ES_READONLY | WS_BORDER | WS_TABSTOP,30,126,186,50
COMBOBOX IDC_EFBSCALE,161,59,76,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "EFB Scale:",IDC_STATIC,127,61,34,8
END
IDD_ADVANCED DIALOGEX 0, 0, 244, 200
@ -120,7 +122,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 237
VERTGUIDE, 7
VERTGUIDE, 68
VERTGUIDE, 61
VERTGUIDE, 109
VERTGUIDE, 161
TOPMARGIN, 7