Implement a simple SSAA function

Seems that 2x has the best effect for now but this is not the best way
of implementing AA function because it requires much greater video card
memory and memory bandwidth than other avaible methods like MSAA, CSAA
etc.
This commit is contained in:
J.P. Lee 2013-01-10 10:28:49 +08:00
parent c1f76b0475
commit eda8252d7d
6 changed files with 13 additions and 2 deletions

View file

@ -64,6 +64,7 @@ void CConfig::Load(const char *iniFileName)
graphics->Get("BufferedRendering", &bBufferedRendering, true);
graphics->Get("HardwareTransform", &bHardwareTransform, true);
graphics->Get("LinearFiltering", &bLinearFiltering, false);
graphics->Get("SSAA", &SSAntiAlaising, 0);
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
sound->Get("Enable", &bEnableSound, true);
@ -103,6 +104,7 @@ void CConfig::Save()
graphics->Set("BufferedRendering", bBufferedRendering);
graphics->Set("HardwareTransform", bHardwareTransform);
graphics->Set("LinearFiltering", bLinearFiltering);
graphics->Set("SSAA", SSAntiAlaising);
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
sound->Set("Enable", bEnableSound);

View file

@ -54,6 +54,7 @@ public:
bool bDrawWireframe;
bool bLinearFiltering;
int iWindowZoom; // for Windows
bool SSAntiAlaising; //for Windows, too
// Sound
bool bEnableSound;

View file

@ -72,8 +72,8 @@ DWORD TheThread(LPVOID x)
coreParameter.enableDebugging = true;
coreParameter.printfEmuLog = false;
coreParameter.headLess = false;
coreParameter.renderWidth = 480 * g_Config.iWindowZoom;
coreParameter.renderHeight = 272 * g_Config.iWindowZoom;
coreParameter.renderWidth = (480 * g_Config.iWindowZoom) * (g_Config.SSAntiAlaising + 1);
coreParameter.renderHeight = (272 * g_Config.iWindowZoom) * (g_Config.SSAntiAlaising + 1);
coreParameter.outputWidth = 480 * g_Config.iWindowZoom;
coreParameter.outputHeight = 272 * g_Config.iWindowZoom;
coreParameter.pixelWidth = 480 * g_Config.iWindowZoom;

View file

@ -499,6 +499,10 @@ namespace MainWindow
g_Config.bLinearFiltering = !g_Config.bLinearFiltering;
UpdateMenus();
break;
case ID_OPTIONS_SIMPLE2XSSAA:
g_Config.SSAntiAlaising = !g_Config.SSAntiAlaising;
UpdateMenus();
break;
case ID_OPTIONS_CONTROLS:
DialogManager::EnableAll(FALSE);
DialogBox(hInst, (LPCTSTR)IDD_CONTROLS, hWnd, (DLGPROC)Controls);
@ -642,6 +646,7 @@ namespace MainWindow
CHECKITEM(ID_OPTIONS_HARDWARETRANSFORM, g_Config.bHardwareTransform);
CHECKITEM(ID_OPTIONS_FASTMEMORY, g_Config.bFastMemory);
CHECKITEM(ID_OPTIONS_LINEARFILTERING, g_Config.bLinearFiltering);
CHECKITEM(ID_OPTIONS_SIMPLE2XSSAA, g_Config.SSAntiAlaising);
CHECKITEM(ID_EMULATION_RUNONLOAD, g_Config.bAutoRun);
UINT enable = !Core_IsStepping() ? MF_GRAYED : MF_ENABLED;
@ -663,6 +668,7 @@ namespace MainWindow
EnableMenuItem(menu,ID_EMULATION_STOP,!enable);
EnableMenuItem(menu,ID_OPTIONS_SETTINGS,enable);
EnableMenuItem(menu,ID_PLUGINS_CHOOSEPLUGINS,enable);
EnableMenuItem(menu,ID_OPTIONS_SIMPLE2XSSAA,enable);
const int zoomitems[4] = {
ID_OPTIONS_SCREEN1X,

View file

@ -255,6 +255,7 @@ BEGIN
MENUITEM "&Buffered Rendering\tF5", ID_OPTIONS_BUFFEREDRENDERING
MENUITEM "&Hardware Transform\tF6", ID_OPTIONS_HARDWARETRANSFORM
MENUITEM "&Linear Filtering", ID_OPTIONS_LINEARFILTERING
MENUITEM "Si&mple 2x SSAA", ID_OPTIONS_SIMPLE2XSSAA
MENUITEM SEPARATOR
MENUITEM "&Wireframe (experimental)", ID_OPTIONS_WIREFRAME
MENUITEM "&Display Raw Framebuffer", ID_OPTIONS_DISPLAYRAWFRAMEBUFFER

View file

@ -254,6 +254,7 @@
#define ID_OPTIONS_CONTROLS 40130
#define ID_EMULATION_RUNONLOAD 40131
#define ID_DEBUG_DUMPNEXTFRAME 40132
#define ID_OPTIONS_SIMPLE2XSSAA 40133
#define IDC_STATIC -1
// Next default values for new objects