Add "Screen Scaling Filter" option

This commit is contained in:
Luna 2014-08-08 20:51:15 +02:00
parent 97b8073818
commit 62a1023615
8 changed files with 46 additions and 5 deletions

View File

@ -390,6 +390,7 @@ static ConfigSetting graphicsSettings[] = {
ReportedConfigSetting("HardwareTransform", &g_Config.bHardwareTransform, true),
ReportedConfigSetting("SoftwareSkinning", &g_Config.bSoftwareSkinning, true),
ReportedConfigSetting("TextureFiltering", &g_Config.iTexFiltering, 1),
ReportedConfigSetting("BufferFiltering", &g_Config.iBufFilter, 1),
ReportedConfigSetting("InternalResolution", &g_Config.iInternalResolution, &DefaultInternalResolution),
ReportedConfigSetting("AndroidHwScale", &g_Config.iAndroidHwScale, &DefaultAndroidHwScale),
ReportedConfigSetting("FrameSkip", &g_Config.iFrameSkip, 0),

View File

@ -109,6 +109,7 @@ public:
int iRenderingMode; // 0 = non-buffered rendering 1 = buffered rendering 2 = Read Framebuffer to memory (CPU) 3 = Read Framebuffer to memory (GPU)
int iTexFiltering; // 1 = off , 2 = nearest , 3 = linear , 4 = linear(CG)
int iBufFilter; // 1 = linear, 2 = nearest
bool bPartialStretch;
bool bStretchToDisplay;
bool bSmallDisplay; // Useful on large tablets with touch controls to not overlap the image. Temporary setting - will be replaced by more comprehensive display size settings.

View File

@ -620,10 +620,8 @@ void FramebufferManager::DrawActiveTexture(GLuint texture, float x, float y, flo
program = draw2dprogram_;
}
// Always use linear filtering when stretching a buffer to the screen. Might want to make this
// an option in the future.
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, g_Config.iBufFilter == SCALE_NEAREST ? GL_NEAREST : GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, g_Config.iBufFilter == SCALE_NEAREST ? GL_NEAREST : GL_LINEAR);
shaderManager_->DirtyLastShader(); // dirty lastShader_

View File

@ -37,6 +37,11 @@ enum TextureFiltering {
LINEARFMV = 4,
};
enum BufferFilter {
SCALE_LINEAR = 1,
SCALE_NEAREST = 2,
};
enum FramebufferNotification {
NOTIFY_FB_CREATED,
NOTIFY_FB_UPDATED,

View File

@ -245,6 +245,10 @@ void GameSettingsScreen::CreateViews() {
PopupMultiChoice *texFilter = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexFiltering, gs->T("Texture Filter"), texFilters, 1, ARRAY_SIZE(texFilters), gs, screenManager()));
texFilter->SetDisabledPtr(&g_Config.bSoftwareRendering);
static const char *bufFilters[] = { "Linear", "Nearest", };
PopupMultiChoice *bufFilter = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iBufFilter, gs->T("Screen Scaling Filter"), bufFilters, 1, ARRAY_SIZE(bufFilters), gs, screenManager()));
bufFilter->SetDisabledPtr(&g_Config.bSoftwareRendering);
graphicsSettings->Add(new ItemHeader(gs->T("Hack Settings", "Hack Settings (these WILL cause glitches)")));
graphicsSettings->Add(new CheckBox(&g_Config.bTimerHack, gs->T("Timer Hack")));
CheckBox *alphaHack = graphicsSettings->Add(new CheckBox(&g_Config.bDisableAlphaTest, gs->T("Disable Alpha Test (PowerVR speedup)")));

View File

@ -468,7 +468,8 @@ namespace MainWindow
SUBMENU_RENDERING_MODE = 13,
SUBMENU_FRAME_SKIPPING = 14,
SUBMENU_TEXTURE_FILTERING = 15,
SUBMENU_TEXTURE_SCALING = 16,
SUBMENU_BUFFER_FILTER = 16,
SUBMENU_TEXTURE_SCALING = 17,
};
std::string GetMenuItemText(int menuID) {
@ -666,6 +667,9 @@ namespace MainWindow
TranslateMenuItem(ID_OPTIONS_NEARESTFILTERING);
TranslateMenuItem(ID_OPTIONS_LINEARFILTERING);
TranslateMenuItem(ID_OPTIONS_LINEARFILTERING_CG);
TranslateSubMenu("Screen Scaling Filter", MENU_OPTIONS, SUBMENU_BUFFER_FILTER);
TranslateMenuItem(ID_OPTIONS_BUFLINEARFILTER);
TranslateMenuItem(ID_OPTIONS_BUFNEARESTFILTER);
TranslateSubMenu("Texture Scaling", MENU_OPTIONS, SUBMENU_TEXTURE_SCALING);
TranslateMenuItem(ID_TEXTURESCALING_OFF);
// Skip texture scaling 2x-5x...
@ -700,6 +704,10 @@ namespace MainWindow
g_Config.iTexFiltering = type;
}
void setBufFilter(int type) {
g_Config.iBufFilter = type;
}
void setTexScalingType(int type) {
g_Config.iTexScalingType = type;
NativeMessageReceived("gpu clear cache", "");
@ -1524,6 +1532,9 @@ namespace MainWindow
case ID_OPTIONS_LINEARFILTERING: setTexFiltering(LINEAR); break;
case ID_OPTIONS_LINEARFILTERING_CG: setTexFiltering(LINEARFMV); break;
case ID_OPTIONS_BUFLINEARFILTER: setBufFilter(SCALE_LINEAR); break;
case ID_OPTIONS_BUFNEARESTFILTER: setBufFilter(SCALE_NEAREST); break;
case ID_OPTIONS_TOPMOST:
g_Config.bTopMost = !g_Config.bTopMost;
W32Util::MakeTopMost(hWnd, g_Config.bTopMost);
@ -1853,6 +1864,20 @@ namespace MainWindow
CheckMenuItem(menu, texfilteringitems[i], MF_BYCOMMAND | ((i + 1) == g_Config.iTexFiltering ? MF_CHECKED : MF_UNCHECKED));
}
static const int bufferfilteritems[] = {
ID_OPTIONS_BUFLINEARFILTER,
ID_OPTIONS_BUFNEARESTFILTER,
};
if (g_Config.iBufFilter < SCALE_LINEAR)
g_Config.iBufFilter = SCALE_LINEAR;
else if (g_Config.iBufFilter > SCALE_NEAREST)
g_Config.iBufFilter = SCALE_NEAREST;
for (int i = 0; i < ARRAY_SIZE(bufferfilteritems); i++) {
CheckMenuItem(menu, bufferfilteritems[i], MF_BYCOMMAND | ((i + 1) == g_Config.iBufFilter ? MF_CHECKED : MF_UNCHECKED));
}
static const int renderingmode[] = {
ID_OPTIONS_NONBUFFEREDRENDERING,
ID_OPTIONS_BUFFEREDRENDERING,

View File

@ -497,6 +497,11 @@ BEGIN
MENUITEM "Linear", ID_OPTIONS_LINEARFILTERING
MENUITEM "Linear on FMV", ID_OPTIONS_LINEARFILTERING_CG
END
POPUP "Screen Scaling Filter"
BEGIN
MENUITEM "Linear", ID_OPTIONS_BUFLINEARFILTER
MENUITEM "Nearest", ID_OPTIONS_BUFNEARESTFILTER
END
POPUP "Texture Scaling"
BEGIN
MENUITEM "Off", ID_TEXTURESCALING_OFF

View File

@ -313,6 +313,8 @@
#define IDC_GEDBG_TEXLEVELUP 40149
#define ID_DEBUG_LOADSYMFILE 40150
#define ID_DEBUG_SAVESYMFILE 40151
#define ID_OPTIONS_BUFLINEARFILTER 40152
#define ID_OPTIONS_BUFNEARESTFILTER 40153
// Dummy option to let the buffered rendering hotkey cycle through all the options.
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500