Skip to content

Commit

Permalink
Always use a linear filter for video, unless forcing NEAREST filtering.
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Sep 13, 2020
1 parent c9693ee commit cea3500
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 18 deletions.
1 change: 1 addition & 0 deletions Core/Config.cpp
Expand Up @@ -821,6 +821,7 @@ static ConfigSetting graphicsSettings[] = {

ConfigSetting("ClearFramebuffersOnFirstUseHack", &g_Config.bClearFramebuffersOnFirstUseHack, false, true, true),


ConfigSetting(false),
};

Expand Down
1 change: 1 addition & 0 deletions Core/Config.h
Expand Up @@ -186,6 +186,7 @@ struct Config {
bool bFullScreenMulti;
int iInternalResolution; // 0 = Auto (native), 1 = 1x (480x272), 2 = 2x, 3 = 3x, 4 = 4x and so on.
int iAnisotropyLevel; // 0 - 5, powers of 2: 0 = 1x = no aniso
int iMipmapMode; // 0 = default, 1 = performance, 2 = quality
int bHighQualityDepth;
bool bReplaceTextures;
bool bSaveNewTextures;
Expand Down
6 changes: 3 additions & 3 deletions GPU/Common/TextureCacheCommon.cpp
Expand Up @@ -175,22 +175,22 @@ void TextureCacheCommon::GetSamplingParams(int &minFilt, int &magFilt, bool &sCl
lodBias = 0.0f;
}

if (!(magFilt & 1) && addr != 0 && g_Config.iTexFiltering == TEX_FILTER_LINEAR_VIDEO) {
if (!(magFilt & 1) && addr != 0 && g_Config.iTexFiltering != TEX_FILTER_FORCE_NEAREST) {
if (videos_.find(addr & 0x3FFFFFFF) != videos_.end()) {
magFilt |= 1;
minFilt |= 1;
}
}

// Filtering overrides
if (g_Config.iTexFiltering == TEX_FILTER_LINEAR) {
if (g_Config.iTexFiltering == TEX_FILTER_FORCE_LINEAR) {
// Only override to linear filtering if there's no alpha or color testing going on.
if ((!gstate.isColorTestEnabled() || IsColorTestTriviallyTrue()) &&
(!gstate.isAlphaTestEnabled() || IsAlphaTestTriviallyTrue())) {
magFilt |= 1;
minFilt |= 1;
}
} else if (g_Config.iTexFiltering == TEX_FILTER_NEAREST ||
} else if (g_Config.iTexFiltering == TEX_FILTER_FORCE_NEAREST ||
(gstate.isModeThrough() && g_Config.iInternalResolution != 1 &&
gstate.isColorTestEnabled() && !IsColorTestTriviallyTrue() && gstate.getColorTestRef() != 0)) {
// Force Nearest when override is on, or color test enabled and rendering resolution greater than 480x272
Expand Down
5 changes: 2 additions & 3 deletions GPU/Common/TextureCacheCommon.h
Expand Up @@ -30,9 +30,8 @@

enum TextureFiltering {
TEX_FILTER_AUTO = 1,
TEX_FILTER_NEAREST = 2,
TEX_FILTER_LINEAR = 3,
TEX_FILTER_LINEAR_VIDEO = 4,
TEX_FILTER_FORCE_NEAREST = 2,
TEX_FILTER_FORCE_LINEAR = 3,
};

enum FramebufferNotification {
Expand Down
4 changes: 2 additions & 2 deletions GPU/Software/Rasterizer.cpp
Expand Up @@ -1036,9 +1036,9 @@ static inline void CalculateSamplingParams(const float ds, const float dt, const
levelFrac = 0;
}

if (g_Config.iTexFiltering == TEX_FILTER_LINEAR) {
if (g_Config.iTexFiltering == TEX_FILTER_FORCE_LINEAR) {
filt = true;
} else if (g_Config.iTexFiltering == TEX_FILTER_NEAREST) {
} else if (g_Config.iTexFiltering == TEX_FILTER_FORCE_NEAREST) {
filt = false;
} else {
filt = detail > 0 ? gstate.isMinifyFilteringEnabled() : gstate.isMagnifyFilteringEnabled();
Expand Down
2 changes: 1 addition & 1 deletion UI/GameSettingsScreen.cpp
Expand Up @@ -512,7 +512,7 @@ void GameSettingsScreen::CreateViews() {
PopupMultiChoice *anisoFiltering = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iAnisotropyLevel, gr->T("Anisotropic Filtering"), anisoLevels, 0, ARRAY_SIZE(anisoLevels), gr->GetName(), screenManager()));
anisoFiltering->SetDisabledPtr(&g_Config.bSoftwareRendering);

static const char *texFilters[] = { "Auto", "Nearest", "Linear", "Linear on FMV", };
static const char *texFilters[] = { "Auto", "Nearest", "Linear" };
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexFiltering, gr->T("Texture Filter"), texFilters, 1, ARRAY_SIZE(texFilters), gr->GetName(), screenManager()));

static const char *bufFilters[] = { "Linear", "Nearest", };
Expand Down
11 changes: 4 additions & 7 deletions Windows/MainWindowMenu.cpp
Expand Up @@ -313,7 +313,6 @@ namespace MainWindow {
TranslateMenuItem(menu, ID_OPTIONS_TEXTUREFILTERING_AUTO);
TranslateMenuItem(menu, ID_OPTIONS_NEARESTFILTERING);
TranslateMenuItem(menu, ID_OPTIONS_LINEARFILTERING);
TranslateMenuItem(menu, ID_OPTIONS_LINEARFILTERING_CG);
TranslateMenuItem(menu, ID_OPTIONS_SCREENFILTER_MENU);
TranslateMenuItem(menu, ID_OPTIONS_BUFLINEARFILTER);
TranslateMenuItem(menu, ID_OPTIONS_BUFNEARESTFILTER);
Expand Down Expand Up @@ -979,9 +978,8 @@ namespace MainWindow {
break;

case ID_OPTIONS_TEXTUREFILTERING_AUTO: setTexFiltering(TEX_FILTER_AUTO); break;
case ID_OPTIONS_NEARESTFILTERING: setTexFiltering(TEX_FILTER_NEAREST); break;
case ID_OPTIONS_LINEARFILTERING: setTexFiltering(TEX_FILTER_LINEAR); break;
case ID_OPTIONS_LINEARFILTERING_CG: setTexFiltering(TEX_FILTER_LINEAR_VIDEO); break;
case ID_OPTIONS_NEARESTFILTERING: setTexFiltering(TEX_FILTER_FORCE_NEAREST); break;
case ID_OPTIONS_LINEARFILTERING: setTexFiltering(TEX_FILTER_FORCE_LINEAR); break;

case ID_OPTIONS_BUFLINEARFILTER: setBufFilter(SCALE_LINEAR); break;
case ID_OPTIONS_BUFNEARESTFILTER: setBufFilter(SCALE_NEAREST); break;
Expand Down Expand Up @@ -1221,12 +1219,11 @@ namespace MainWindow {
ID_OPTIONS_TEXTUREFILTERING_AUTO,
ID_OPTIONS_NEARESTFILTERING,
ID_OPTIONS_LINEARFILTERING,
ID_OPTIONS_LINEARFILTERING_CG,
};
if (g_Config.iTexFiltering < TEX_FILTER_AUTO)
g_Config.iTexFiltering = TEX_FILTER_AUTO;
else if (g_Config.iTexFiltering > TEX_FILTER_LINEAR_VIDEO)
g_Config.iTexFiltering = TEX_FILTER_LINEAR_VIDEO;
else if (g_Config.iTexFiltering > TEX_FILTER_FORCE_LINEAR)
g_Config.iTexFiltering = TEX_FILTER_FORCE_LINEAR;

for (int i = 0; i < ARRAY_SIZE(texfilteringitems); i++) {
CheckMenuItem(menu, texfilteringitems[i], MF_BYCOMMAND | ((i + 1) == g_Config.iTexFiltering ? MF_CHECKED : MF_UNCHECKED));
Expand Down
1 change: 0 additions & 1 deletion Windows/ppsspp.rc
Expand Up @@ -629,7 +629,6 @@ BEGIN
MENUITEM "Auto", ID_OPTIONS_TEXTUREFILTERING_AUTO
MENUITEM "Nearest", ID_OPTIONS_NEARESTFILTERING
MENUITEM "Linear", ID_OPTIONS_LINEARFILTERING
MENUITEM "Linear on FMV", ID_OPTIONS_LINEARFILTERING_CG
END
POPUP "Screen Scaling Filter", ID_OPTIONS_SCREENFILTER_MENU
BEGIN
Expand Down
1 change: 0 additions & 1 deletion Windows/resource.h
Expand Up @@ -242,7 +242,6 @@
#define ID_OPTIONS_TEXTUREFILTERING_AUTO 40067
#define ID_OPTIONS_NEARESTFILTERING 40068
#define ID_DISASM_DISASSEMBLETOFILE 40069
#define ID_OPTIONS_LINEARFILTERING_CG 40070
#define ID_DISASM_DISABLEBREAKPOINT 40071
#define ID_DISASM_THREAD_FORCERUN 40072
#define ID_DISASM_THREAD_KILL 40073
Expand Down

0 comments on commit cea3500

Please sign in to comment.