From eda8252d7df0a3a787b90adec6e24415bcf699fb Mon Sep 17 00:00:00 2001 From: "J.P. Lee" Date: Thu, 10 Jan 2013 10:28:49 +0800 Subject: [PATCH] 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. --- Core/Config.cpp | 2 ++ Core/Config.h | 1 + Windows/EmuThread.cpp | 4 ++-- Windows/WndMainWindow.cpp | 6 ++++++ Windows/ppsspp.rc | 1 + Windows/resource.h | 1 + 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index bc68d1ba5f..23100cdc91 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -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); diff --git a/Core/Config.h b/Core/Config.h index 2bfbfe1ea7..4149e1ac1c 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -54,6 +54,7 @@ public: bool bDrawWireframe; bool bLinearFiltering; int iWindowZoom; // for Windows + bool SSAntiAlaising; //for Windows, too // Sound bool bEnableSound; diff --git a/Windows/EmuThread.cpp b/Windows/EmuThread.cpp index 40f939d2f3..9cd506f70c 100644 --- a/Windows/EmuThread.cpp +++ b/Windows/EmuThread.cpp @@ -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; diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 4bc19b3d87..57cbfbd78b 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -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, diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index ffc0b1ddc6..914dcd0eed 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -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 diff --git a/Windows/resource.h b/Windows/resource.h index cf8ec6c7be..8409c18986 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -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