Hash :
19671376
Author :
Date :
2023-07-28T13:37:38
Reland "Search for system libvulkan on CrOS" Currently, ANGLE searches in the "module" directory for libvulkan during init on CrOS. The library doesn't exist at this location (/opt/google/chrome/libvulkan.so), and we should instead just call dlopen(libvulkan.so) to search the system library paths. The original CL was reverted because it broke MSAN builds of ChromeOS-on-Linux (CrOS UI that runs on a generic Linux machine). The original CL caused these builds to use the Linux system Vulkan loader library which is most likely not built with MSAN. This caused MSAN violations when combined with an ANGLE built with MSAN [1]. The reland fixes this issue by only using the system libvulkan on real ChromeOS devices. [1] go/msan#false-positives Bug: b/292249282, chromium:1467779 Change-Id: Iafcd8d315a0baddcfbb847c3ad198f267887c8f8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4727448 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Brian Ho <hob@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
# Copyright 2020 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build_overrides/swiftshader.gni")
import("../../../gni/angle.gni")
if (angle_use_wayland) {
import("//build_overrides/wayland.gni")
}
declare_args() {
angle_use_custom_libvulkan = !is_android && !is_fuchsia && !is_ggp
# On real CrOS devices, we should use the system Vulkan loader. On the
# ChromeOS-for-Linux build, we should use the built libvulkan because the
# build is used for MSAN tests. Mixing the non-MSAN system libvulkan with the
# MSAN ANGLE build can result in false positives.
if (is_chromeos && is_chromeos_device) {
angle_use_custom_libvulkan = false
}
}
config("angle_libvulkan_config") {
if (angle_use_custom_libvulkan) {
defines = [ "ANGLE_USE_CUSTOM_LIBVULKAN" ]
}
}
angle_source_set("angle_libvulkan_loader") {
public_configs = [ ":angle_libvulkan_config" ]
sources = [
"libvulkan_loader.cpp",
"libvulkan_loader.h",
]
deps = [ "$angle_root:angle_common" ]
}
if (angle_enable_vulkan || angle_build_vulkan_system_info) {
config("angle_vulkan_headers_config") {
if (angle_shared_libvulkan) {
defines = [ "ANGLE_SHARED_LIBVULKAN=1" ]
}
if (angle_use_wayland) {
include_dirs = [ "$wayland_dir/src" ]
}
configs = [ "$angle_root:angle_vulkan_wayland_config" ]
}
angle_source_set("angle_vulkan_headers") {
sources = [
"vk_google_filtering_precision.h",
"vk_headers.h",
]
if (angle_shared_libvulkan) {
public_deps = [ "$angle_root/src/third_party/volk:volk" ]
} else {
public_deps = [ "$angle_vulkan_headers_dir:vulkan_headers" ]
}
public_configs = [ ":angle_vulkan_headers_config" ]
}
angle_source_set("angle_vulkan_icd") {
sources = [
"vulkan_icd.cpp",
"vulkan_icd.h",
]
defines =
[ "ANGLE_VK_MOCK_ICD_JSON=\"$angle_data_dir/VkICD_mock_icd.json\"" ]
# On Fuchsia use validation layer provided by the SDK.
if (!is_fuchsia) {
defines += [ "ANGLE_VK_LAYERS_DIR=\"$angle_data_dir\"" ]
}
data_deps = []
if (angle_enable_swiftshader) {
import("$swiftshader_dir/src/Vulkan/vulkan.gni")
_sws_icd = "./$swiftshader_icd_file_name"
if (is_win) {
_sws_icd = ".\\\\$swiftshader_icd_file_name"
} else if (is_fuchsia) {
_sws_icd = "/pkg/$swiftshader_icd_file_name"
}
defines += [ "ANGLE_VK_SWIFTSHADER_ICD_JSON=\"${_sws_icd}\"" ]
data_deps += [
"$swiftshader_dir/src/Vulkan:icd_file",
"$swiftshader_dir/src/Vulkan:swiftshader_libvulkan",
]
}
public_deps = [
":angle_vulkan_headers",
"$angle_root:angle_common",
]
configs += [ "$angle_root:angle_no_cfi_icall" ]
}
}
if (angle_enable_vulkan) {
group("angle_libvulkan") {
public_configs = [ ":angle_libvulkan_config" ]
data_deps = []
if (angle_use_custom_libvulkan) {
if (angle_shared_libvulkan) {
data_deps += [ "$angle_vulkan_loader_dir:libvulkan" ]
} else {
public_deps = [ "$angle_vulkan_loader_dir:libvulkan" ]
}
data_deps += [ "$angle_vulkan_tools_dir:VkICD_mock_icd" ]
}
}
group("angle_vulkan_entry_points") {
public_deps = [ ":angle_vulkan_headers" ]
if (is_fuchsia) {
public_deps += [
"$angle_root/src/common/fuchsia_egl",
"//third_party/fuchsia-sdk/sdk/pkg/vulkan",
]
if (!angle_use_vulkan_null_display) {
public_deps += [ "//third_party/fuchsia-sdk/sdk/pkg/vulkan_layers:VkLayer_image_pipe_swapchain" ]
}
} else if (!is_android && !is_ggp) {
if (angle_shared_libvulkan) {
data_deps = [ "$angle_vulkan_loader_dir:libvulkan" ]
} else {
deps = [ "$angle_vulkan_loader_dir:libvulkan" ]
}
}
}
angle_source_set("vulkan") {
public_deps = [
":angle_libvulkan",
":angle_vulkan_entry_points",
":angle_vulkan_icd",
]
}
if (angle_enable_vulkan_validation_layers) {
group("vulkan_validation_layers") {
data_deps = []
if (is_fuchsia) {
data_deps += [ "//third_party/fuchsia-sdk/sdk/pkg/vulkan_layers:VkLayer_khronos_validation" ]
} else {
data_deps +=
[ "$angle_vulkan_validation_layers_dir:vulkan_validation_layers" ]
if (!is_android) {
data_deps +=
[ "$angle_vulkan_validation_layers_dir:vulkan_gen_json_files" ]
}
}
}
}
}