Consolildate Texture filtering option

This commit is contained in:
raven02 2013-06-30 14:48:50 +08:00
parent 39270b80a7
commit 5d275d7fe9
8 changed files with 51 additions and 33 deletions

View File

@ -98,9 +98,7 @@ void Config::Load(const char *iniFileName)
#endif
graphics->Get("BufferedRendering", &bBufferedRendering, true);
graphics->Get("HardwareTransform", &bHardwareTransform, true);
graphics->Get("NearestFiltering", &bNearestFiltering, false);
graphics->Get("LinearFiltering", &bLinearFiltering, false);
graphics->Get("LinearFilteringCG", &bLinearFilteringCG, false);
graphics->Get("TextureFiltering", &iTexFiltering, false);
graphics->Get("SSAA", &SSAntiAliasing, 0);
graphics->Get("VBO", &bUseVBO, false);
graphics->Get("FrameSkip", &iFrameSkip, 0);
@ -215,9 +213,7 @@ void Config::Save()
graphics->Set("ResolutionScale", iWindowZoom);
graphics->Set("BufferedRendering", bBufferedRendering);
graphics->Set("HardwareTransform", bHardwareTransform);
graphics->Set("NearestFiltering", bNearestFiltering);
graphics->Set("LinearFiltering", bLinearFiltering);
graphics->Set("LinearFilteringCG", bLinearFilteringCG);
graphics->Set("TextureFiltering", iTexFiltering);
graphics->Set("SSAA", SSAntiAliasing);
graphics->Set("VBO", bUseVBO);
graphics->Set("FrameSkip", iFrameSkip);

View File

@ -63,9 +63,7 @@ public:
bool bDisplayFramebuffer;
bool bHardwareTransform;
bool bBufferedRendering;
bool bNearestFiltering;
bool bLinearFiltering;
bool bLinearFilteringCG;
int iTexFiltering; // 1 = off , 2 = nearest , 3 = linear , 4 = linear(CG)
bool bUseVBO;
#ifdef BLACKBERRY
bool bPartialStretch;

View File

@ -246,7 +246,7 @@ void FramebufferManager::DrawPixels(const u8 *framebuf, int pixelFormat, int lin
}
glBindTexture(GL_TEXTURE_2D,drawPixelsTex_);
if (g_Config.bLinearFiltering || (g_Config.bLinearFilteringCG && g_iNumVideos))
if (g_Config.iTexFiltering == 3 || (g_Config.iTexFiltering == 4 && g_iNumVideos))
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}

View File

@ -511,12 +511,12 @@ void TextureCache::UpdateSamplingParams(TexCacheEntry &entry, bool force) {
}
}
if ((g_Config.bLinearFiltering || (g_Config.bLinearFilteringCG && g_iNumVideos)) && !gstate.isColorTestEnabled()) {
if ((g_Config.iTexFiltering == 3 || (g_Config.iTexFiltering == 4 && g_iNumVideos)) && !gstate.isColorTestEnabled()) {
magFilt |= 1;
minFilt |= 1;
}
if (g_Config.bNearestFiltering) {
if (g_Config.iTexFiltering == 2) {
magFilt &= ~1;
minFilt &= ~1;
}

View File

@ -58,9 +58,6 @@ void GameSettingsScreen::CreateViews() {
ViewGroup *graphicsSettings = new LinearLayout(ORIENT_VERTICAL);
graphicsSettingsScroll->Add(graphicsSettings);
tabHolder->AddTab("Graphics", graphicsSettingsScroll);
graphicsSettings->Add(new CheckBox(&g_Config.bNearestFiltering, gs->T("Force Nearest Filtering")));
graphicsSettings->Add(new CheckBox(&g_Config.bLinearFiltering, gs->T("Force Linear Filtering")));
graphicsSettings->Add(new CheckBox(&g_Config.bLinearFilteringCG, gs->T("Linear Filtering (CG)")));
graphicsSettings->Add(new CheckBox(&g_Config.bStretchToDisplay, gs->T("Stretch to Display")));
graphicsSettings->Add(new CheckBox(&g_Config.bBufferedRendering, gs->T("Buffered Rendering")));
graphicsSettings->Add(new CheckBox(&g_Config.bDisplayFramebuffer, gs->T("Display Raw Framebuffer")));

View File

@ -510,7 +510,6 @@ void PauseScreen::render() {
} else
g_Config.iFrameSkip = 0;
UICheckBox(GEN_ID, x, y += stride, gs->T("Linear Filtering"), ALIGN_TOPLEFT, &g_Config.bLinearFiltering);
ui_draw2d.DrawText(UBUNTU24, gs->T("Save State :"), 30, y += 40, 0xFFFFFFFF, ALIGN_LEFT);
HLinear hlinear4(x + 180 , y , 10);
if (UIButton(GEN_ID, hlinear4, 60, 0, "1", ALIGN_LEFT)) {
@ -857,14 +856,6 @@ void GraphicsScreenP2::render() {
int stride = 40;
int columnw = 400;
if ( UICheckBox(GEN_ID, x, y += stride, gs->T("Force Nearest Filtering"), ALIGN_TOPLEFT, &g_Config.bNearestFiltering) ) {
g_Config.bLinearFiltering = false; // disable linear filtering if someone turns on nearest
}
if ( UICheckBox(GEN_ID, x, y += stride, gs->T("Force Linear Filtering"), ALIGN_TOPLEFT, &g_Config.bLinearFiltering) ) {
g_Config.bNearestFiltering = false; // and vice versa
}
UICheckBox(GEN_ID, x, y += stride, gs->T("Linear Filtering (CG)"), ALIGN_TOPLEFT, &g_Config.bLinearFilteringCG);
bool AnisotropicFiltering = g_Config.iAnisotropyLevel != 0;
UICheckBox(GEN_ID, x, y += stride, gs->T("Anisotropic Filtering"), ALIGN_TOPLEFT, &AnisotropicFiltering);
if (AnisotropicFiltering) {
@ -888,9 +879,34 @@ void GraphicsScreenP2::render() {
} else
g_Config.iAnisotropyLevel = 0;
bool TexFiltering = g_Config.iTexFiltering > 1;
UICheckBox(GEN_ID, x, y += stride, gs->T("Texture Filtering"), ALIGN_TOPLEFT, &TexFiltering);
if (TexFiltering) {
if (g_Config.iTexFiltering <= 1)
g_Config.iTexFiltering = 2;
char showType[256];
std::string type;
switch (g_Config.iTexFiltering) {
case 2: type = "Nearest";break;
case 3: type = "Linear";break;
case 4: type = "Linear(CG)";break;
}
sprintf(showType, "%s %s", gs->T("Type :"), type.c_str());
ui_draw2d.DrawText(UBUNTU24, showType, x + 60, (y += stride) , 0xFFFFFFFF, ALIGN_LEFT);
HLinear hlinear1(x + 300, y, 20);
if (UIButton(GEN_ID, hlinear1, 120, 0, gs->T("Nearest"), ALIGN_LEFT))
g_Config.iTexFiltering = 2;
if (UIButton(GEN_ID, hlinear1, 120, 0, gs->T("Linear"), ALIGN_LEFT))
g_Config.iTexFiltering = 3;
if (UIButton(GEN_ID, hlinear1, 150, 0, gs->T("Linear(CG)"), ALIGN_LEFT))
g_Config.iTexFiltering = 4;
y += 20;
} else
g_Config.iTexFiltering = 0;
bool TexScaling = g_Config.iTexScalingLevel > 1;
UICheckBox(GEN_ID, x, y += stride, gs->T("xBRZ Texture Scaling"), ALIGN_TOPLEFT, &TexScaling);
UICheckBox(GEN_ID, x, y += stride, gs->T("Texture Scaling"), ALIGN_TOPLEFT, &TexScaling);
if (TexScaling) {
if (g_Config.iTexScalingLevel <= 1)
g_Config.iTexScalingLevel = 2;

View File

@ -203,13 +203,20 @@ namespace MainWindow
g_Config.iTexScalingLevel = num;
if(gpu) gpu->ClearCacheNextFrame();
}
void setTexFiltering(int num) {
g_Config.iTexFiltering = num;
}
void setTexScalingType(int num) {
g_Config.iTexScalingType = num;
if(gpu) gpu->ClearCacheNextFrame();
}
void setFpsLimit(int fps) {
g_Config.iFpsLimit = fps;
}
void enableCheats(bool cheats){
g_Config.bEnableCheats = cheats;
}
@ -738,15 +745,13 @@ namespace MainWindow
g_Config.bUseVBO = !g_Config.bUseVBO;
break;
case ID_OPTIONS_NEARESTFILTERING:
g_Config.bNearestFiltering = !g_Config.bNearestFiltering;
g_Config.bLinearFiltering = false;
setTexFiltering(2) ;
break;
case ID_OPTIONS_LINEARFILTERING:
g_Config.bNearestFiltering = false;
g_Config.bLinearFiltering = !g_Config.bLinearFiltering;
setTexFiltering(3) ;
break;
case ID_OPTIONS_LINEARFILTERING_CG:
g_Config.bLinearFilteringCG = !g_Config.bLinearFilteringCG;
setTexFiltering(4) ;
break;
case ID_OPTIONS_TOPMOST:
g_Config.bTopMost = !g_Config.bTopMost;
@ -903,9 +908,6 @@ namespace MainWindow
CHECKITEM(ID_OPTIONS_SHOWDEBUGSTATISTICS, g_Config.bShowDebugStats);
CHECKITEM(ID_OPTIONS_HARDWARETRANSFORM, g_Config.bHardwareTransform);
CHECKITEM(ID_OPTIONS_FASTMEMORY, g_Config.bFastMemory);
CHECKITEM(ID_OPTIONS_NEARESTFILTERING, g_Config.bNearestFiltering);
CHECKITEM(ID_OPTIONS_LINEARFILTERING, g_Config.bLinearFiltering);
CHECKITEM(ID_OPTIONS_LINEARFILTERING_CG, g_Config.bLinearFilteringCG);
CHECKITEM(ID_OPTIONS_SIMPLE2XSSAA, g_Config.SSAntiAliasing);
CHECKITEM(ID_OPTIONS_STRETCHDISPLAY, g_Config.bStretchToDisplay);
CHECKITEM(ID_EMULATION_RUNONLOAD, g_Config.bAutoRun);
@ -950,6 +952,15 @@ namespace MainWindow
CheckMenuItem(menu, texscalingtypeitems[i], MF_BYCOMMAND | ((i == g_Config.iTexScalingType) ? MF_CHECKED : MF_UNCHECKED));
}
static const int texfilteringitems[] = {
ID_OPTIONS_NEARESTFILTERING,
ID_OPTIONS_LINEARFILTERING,
ID_OPTIONS_LINEARFILTERING_CG,
};
for (int i = 0; i < 3; i++) {
CheckMenuItem(menu, texfilteringitems[i], MF_BYCOMMAND | ((i == g_Config.iTexFiltering-2) ? MF_CHECKED : MF_UNCHECKED));
}
UpdateCommands();
}

Binary file not shown.