mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +02:00
Merge pull request #5387 from IvanSavenko/xbrz_autoselect
Enable xbrz2 by default on mobile systems
This commit is contained in:
@@ -357,34 +357,23 @@ EUpscalingFilter ScreenHandler::loadUpscalingFilter() const
|
|||||||
return filter;
|
return filter;
|
||||||
|
|
||||||
// else - autoselect
|
// else - autoselect
|
||||||
#ifdef VCMI_MOBILE
|
|
||||||
// to help with performance - only if player explicitly enabled xbrz
|
|
||||||
return EUpscalingFilter::NONE;
|
|
||||||
#else
|
|
||||||
Point outputResolution = getRenderResolution();
|
Point outputResolution = getRenderResolution();
|
||||||
Point logicalResolution = getPreferredLogicalResolution();
|
Point logicalResolution = getPreferredLogicalResolution();
|
||||||
|
|
||||||
float scaleX = static_cast<float>(outputResolution.x) / logicalResolution.x;
|
float scaleX = static_cast<float>(outputResolution.x) / logicalResolution.x;
|
||||||
float scaleY = static_cast<float>(outputResolution.x) / logicalResolution.x;
|
float scaleY = static_cast<float>(outputResolution.x) / logicalResolution.x;
|
||||||
float scaling = std::min(scaleX, scaleY);
|
float scaling = std::min(scaleX, scaleY);
|
||||||
|
int systemMemoryMb = SDL_GetSystemRAM();
|
||||||
|
|
||||||
if (scaling <= 1.001f)
|
if (scaling <= 1.001f)
|
||||||
return EUpscalingFilter::NONE; // running at original resolution or even lower than that - no need for xbrz
|
return EUpscalingFilter::NONE; // running at original resolution or even lower than that - no need for xbrz
|
||||||
else
|
|
||||||
return EUpscalingFilter::XBRZ_2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
if (systemMemoryMb < 2048)
|
||||||
// Old version, most optimal, but rather performance-heavy
|
return EUpscalingFilter::NONE; // xbrz2 may use ~1.0 - 1.5 Gb of RAM and has notable CPU cost - avoid on low-spec hardware
|
||||||
if (scaling <= 1.001f)
|
|
||||||
return EUpscalingFilter::NONE; // running at original resolution or even lower than that - no need for xbrz
|
|
||||||
if (scaling <= 2.001f)
|
|
||||||
return EUpscalingFilter::XBRZ_2; // resolutions below 1200p (including 1080p / FullHD)
|
|
||||||
if (scaling <= 3.001f)
|
|
||||||
return EUpscalingFilter::XBRZ_3; // resolutions below 2400p (including 1440p and 2160p / 4K)
|
|
||||||
|
|
||||||
return EUpscalingFilter::XBRZ_4; // Only for massive displays, e.g. 8K
|
// Only using xbrz2 for autoselection.
|
||||||
#endif
|
// Higher options may have high system requirements and should be only selected explicitly by player
|
||||||
|
return EUpscalingFilter::XBRZ_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenHandler::selectUpscalingFilter()
|
void ScreenHandler::selectUpscalingFilter()
|
||||||
|
Reference in New Issue
Block a user