Commit a5ab7974 by Peng Huang Committed by Commit Bot

Turn on vulkan backend for android ndk level < 26

Fixes two issue for build Vulkan backend for android ndk level < 26, * Disable Vulkan validation layers for android ndk level < 26 * Share vulkan memory allocator implementation with chrome to avoid duplicated symbols link errors. * Only run vulkan backend test with Android P or newer Note: This change will break android-binary-size try bot, we need to update expected_static_initializer_count to 4 at [1] while rolling this change into chromium. [1] https://source.chromium.org/chromium/chromium/src/+/master:chrome/android/static_initializers.gni;l=19?q=expected_static_initializer_count&ss=chromium%2Fchromium%2Fsrc Bug: chromium:1170339 Change-Id: Idb9238d8f339724c4d8f9ac136305b95ff06fae4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2656980 Commit-Queue: Peng Huang <penghuang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent b4fd4628
......@@ -111,15 +111,11 @@ declare_args() {
(angle_use_x11 && !is_chromeos)) && !is_fuchsia &&
!angle_is_winuwp && !is_ggp && !is_win_arm64
# ANGLE Vulkan backend on Android requires API level 26, i.e. Oreo, due to
# Vulkan Validation Layers compatibility issues, see http://crrev/c/1405714.
# Otherwise, API level 24 would have been enough.
angle_enable_vulkan =
angle_has_build &&
((is_win && !angle_is_winuwp) ||
(is_linux && (angle_use_x11 || angle_use_vulkan_display) &&
!is_chromeos) || (is_android && ndk_api_level_at_least_26) ||
is_fuchsia || is_ggp || is_mac)
!is_chromeos) || is_android || is_fuchsia || is_ggp || is_mac)
# Disable null backend to save space for official build.
angle_enable_null = !is_official_build
......@@ -144,9 +140,12 @@ declare_args() {
# Disable the layers in ubsan builds because of really slow builds.
# TODO(anglebug.com/4082) enable validation layers on mac for swiftshader
# Vulkan Validation Layers require Android NDK API level 26, i.e. Oreo, due to
# Vulkan Validation Layers compatibility issues, see http://crrev/c/1405714.
angle_enable_vulkan_validation_layers =
angle_enable_vulkan && !is_ubsan && !is_tsan && !is_asan &&
(is_debug || dcheck_always_on) && !is_mac
(is_debug || dcheck_always_on) && !is_mac &&
(!is_android || ndk_api_level_at_least_26)
# Disable overlay by default
angle_enable_overlay = false
......
......@@ -72,6 +72,7 @@ struct SystemInfo
// Only available on Android
std::string machineManufacturer;
int androidSdkLevel = 0;
// Only available on macOS and Android
std::string machineModelName;
......
......@@ -11,6 +11,7 @@
#include <sys/system_properties.h>
#include <cstring>
#include <fstream>
#include <string>
#include "common/angleutils.h"
#include "common/debug.h"
......@@ -43,6 +44,11 @@ bool GetSystemInfo(SystemInfo *info)
isFullyPopulated =
GetAndroidSystemProperty("ro.product.model", &info->machineModelName) && isFullyPopulated;
std::string androidSdkLevel;
isFullyPopulated =
GetAndroidSystemProperty("ro.build.version.sdk", &androidSdkLevel) && isFullyPopulated;
info->androidSdkLevel = std::stoi(androidSdkLevel);
return GetSystemInfoVulkan(info) && isFullyPopulated;
}
......
......@@ -195,14 +195,13 @@ config("angle_vulkan_backend_config") {
angle_source_set("angle_vk_mem_alloc_wrapper") {
deps = [
"$angle_root/src/common/vulkan:angle_vulkan_headers",
"$angle_vulkan_memory_allocator_dir",
"$angle_vulkan_memory_allocator_dir:vulkan_memory_allocator_with_usage",
]
configs += [ "$angle_root:angle_no_cfi_unrelated_cast" ]
sources = [
"vk_mem_alloc_wrapper.cpp",
"vk_mem_alloc_wrapper.h",
]
defines = [ "VMA_IMPLEMENTATION" ]
if (is_clang) {
cflags_cc = [
"-Wno-extra-semi-stmt",
......
......@@ -110,6 +110,20 @@ bool IsAndroidDevice(const std::string &deviceName)
return false;
}
bool IsAndroid9OrNewer()
{
if (!IsAndroid())
{
return false;
}
SystemInfo *systemInfo = GetTestSystemInfo();
if (systemInfo->androidSdkLevel >= 28)
{
return true;
}
return false;
}
GPUDeviceInfo *GetActiveGPUDeviceInfo()
{
SystemInfo *systemInfo = GetTestSystemInfo();
......@@ -556,6 +570,10 @@ bool IsConfigAllowlisted(const SystemInfo &systemInfo, const PlatformParameters
{
return false;
}
if (!IsAndroid9OrNewer())
{
return false;
}
return true;
default:
return false;
......
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