Commit c8676d4b by Xinghua Cao Committed by Commit Bot

Unlimit texture size on relatively new linux

If limit texture size to a small number, application may need to reshape texture, lead to more discontinuous memory access and performance loss. Bug: angleproject:4086 Change-Id: I502a90535c2e3d13738e23827f4712a77987585e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1934048Reviewed-by: 's avatarXinghua Cao <xinghua.cao@intel.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
parent 015cb808
......@@ -16,6 +16,10 @@
# include <sys/system_properties.h>
#endif
#if defined(ANGLE_PLATFORM_LINUX)
# include <sys/utsname.h>
#endif
namespace rx
{
// Intel
......@@ -202,4 +206,50 @@ OSVersion GetMacOSVersion()
}
#endif
#if defined(ANGLE_PLATFORM_LINUX)
bool ParseLinuxOSVersion(const char *version, int *major, int *minor, int *patch)
{
errno = 0; // reset global error flag.
char *next;
*major = static_cast<int>(strtol(version, &next, 10));
if (next == nullptr || *next != '.' || errno != 0)
{
return false;
}
*minor = static_cast<int>(strtol(next + 1, &next, 10));
if (next == nullptr || *next != '.' || errno != 0)
{
return false;
}
*patch = static_cast<int>(strtol(next + 1, &next, 10));
if (errno != 0)
{
return false;
}
return true;
}
#endif
OSVersion GetLinuxOSVersion()
{
#if defined(ANGLE_PLATFORM_LINUX)
struct utsname uname_info;
if (uname(&uname_info) != 0)
{
return OSVersion(0, 0, 0);
}
int majorVersion = 0, minorVersion = 0, patchVersion = 0;
if (ParseLinuxOSVersion(uname_info.release, &majorVersion, &minorVersion, &patchVersion))
{
return OSVersion(majorVersion, minorVersion, patchVersion);
}
#endif
return OSVersion(0, 0, 0);
}
} // namespace rx
......@@ -163,6 +163,8 @@ bool operator>=(const OSVersion &a, const OSVersion &b);
OSVersion GetMacOSVersion();
OSVersion GetLinuxOSVersion();
inline bool IsAndroid()
{
#if defined(ANGLE_PLATFORM_ANDROID)
......
......@@ -1590,10 +1590,11 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
ANGLE_FEATURE_CONDITION(features, disableWorkerContexts,
(IsWindows() && (isIntel || isAMD)) || (IsLinux() && isNvidia));
bool limitMaxTextureSize = isIntel && IsLinux() && GetLinuxOSVersion() < OSVersion(5, 0, 0);
ANGLE_FEATURE_CONDITION(features, limitMaxTextureSizeTo4096,
IsAndroid() || (isIntel && IsLinux()));
IsAndroid() || limitMaxTextureSize);
ANGLE_FEATURE_CONDITION(features, limitMaxMSAASamplesTo4, IsAndroid());
ANGLE_FEATURE_CONDITION(features, limitMax3dArrayTextureSizeTo1024, isIntel && IsLinux());
ANGLE_FEATURE_CONDITION(features, limitMax3dArrayTextureSizeTo1024, limitMaxTextureSize);
ANGLE_FEATURE_CONDITION(features, allowClearForRobustResourceInit, IsApple());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment