Hash :
229fc83d
Author :
Date :
2019-01-21T18:09:15
Vulkan: Port renderer to Fuchsia (reland) Add DisplayVk and WindowSurfaceVk subclasses for Fuchsia to the vulkan renderer, as well as an implementation of OSWindow that renders fullscreen for the test suite. Disallow use of the vulkan loader from third_party as Fuchsia uses a fork of the loader and has not sent those changes upstream yet. Add a small wayland-inspired library libfuchsia-egl to provide a type "struct fuchsia_egl_window" to use as EGLNativeWindowType. This type combines a zx_handle_t to an image pipe channel and a surface size. Image pipes can only be used once to create a VkSurfaceKHR. This means we have to recreate the pipe in tests that call eglCreateWindowSurface more than once with a single OSWindow, or the second call will fail. Add a resetNativeWindow() method to accomplish this. Reland disabling -Wextra-semi. BUG=angleproject:2475 TEST=angle_end2end_tests on Fuchsia Change-Id: Ie91715bcd760c6c04d4b8a02a91daa71e32ee30c Reviewed-on: https://chromium-review.googlesource.com/c/1467603 Commit-Queue: Michael Spang <spang@chromium.org> Reviewed-by: Jamie Madill <jmadill@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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
# Copyright 2018 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.
# BUILD settings for Vulkan Loader
# Loader repo is at
# https://github.com/KhronosGroup/Vulkan-Loader
import("../../gni/angle.gni")
import("$angle_root/third_party/vulkan-headers/vulkan_headers_script_deps.gni")
# Fuchsia has non-upstream changes to the vulkan loader, so we don't want
# to build it from upstream sources.
assert(!is_fuchsia)
if (!is_android) {
vulkan_undefine_configs = []
}
if (is_win) {
vulkan_undefine_configs += [
"//build/config/win:nominmax",
"//build/config/win:unicode",
]
}
vulkan_gen_dir = "$target_gen_dir/angle/vulkan"
raw_vulkan_gen_dir = rebase_path(vulkan_gen_dir, root_build_dir)
# Vulkan helper scripts
# ---------------------
helper_script_and_deps = [
[
"vulkan_gen_dispatch_table_helper_h",
"vk_dispatch_table_helper.h",
"dispatch_table_helper_generator.py",
],
[
"vulkan_gen_enum_string_helper",
"vk_enum_string_helper.h",
"helper_file_generator.py",
],
[
"vulkan_gen_extension_helper",
"vk_extension_helper.h",
"helper_file_generator.py",
],
[
"vulkan_gen_layer_dispatch_table_h",
"vk_layer_dispatch_table.h",
"loader_extension_generator.py",
],
[
"vulkan_gen_loader_extensions_c",
"vk_loader_extensions.c",
"loader_extension_generator.py",
],
[
"vulkan_gen_loader_extensions_h",
"vk_loader_extensions.h",
"loader_extension_generator.py",
],
[
"vulkan_gen_object_types_h",
"vk_object_types.h",
"helper_file_generator.py",
],
[
"vulkan_gen_safe_struct_cpp",
"vk_safe_struct.cpp",
"helper_file_generator.py",
],
[
"vulkan_gen_safe_struct_h",
"vk_safe_struct.h",
"helper_file_generator.py",
],
[
"vulkan_gen_typemap_helper",
"vk_typemap_helper.h",
"helper_file_generator.py",
],
]
# Python scripts needed for codegen, copy them to a temp dir
# so that all dependencies are together. The reg.py script from
# the headers repo is required input to loader_genvk.py.
copy("python_gen_deps") {
sources = vulkan_registry_script_files + [
"src/scripts/common_codegen.py",
"src/scripts/dispatch_table_helper_generator.py",
"src/scripts/helper_file_generator.py",
"src/scripts/loader_extension_generator.py",
"src/scripts/loader_genvk.py",
]
outputs = [
"$vulkan_gen_dir/{{source_file_part}}",
]
}
foreach(script_and_dep, helper_script_and_deps) {
target_name = script_and_dep[0]
file = script_and_dep[1]
dep = script_and_dep[2]
target("action", target_name) {
public_deps = [
":python_gen_deps",
]
script = "$vulkan_gen_dir/loader_genvk.py"
inputs = [
"$vulkan_gen_dir/$dep",
"$vulkan_gen_dir/common_codegen.py",
]
outputs = [
"$vulkan_gen_dir/$file",
]
args = [
"-o",
raw_vulkan_gen_dir,
"-registry",
"$raw_vulkan_gen_dir/vk.xml",
"-scripts",
raw_vulkan_gen_dir,
"$file",
"-quiet",
]
}
}
config("vulkan_generated_files_config") {
include_dirs = [ vulkan_gen_dir ]
}
group("vulkan_generate_helper_files") {
public_deps = [
"$angle_root/third_party/vulkan-headers:vulkan_headers",
]
public_configs = [ ":vulkan_generated_files_config" ]
foreach(script_and_dep, helper_script_and_deps) {
target_name = script_and_dep[0]
public_deps += [ ":$target_name" ]
}
}
config("vulkan_internal_config") {
defines = [ "VULKAN_NON_CMAKE_BUILD" ]
if (is_clang || !is_win) {
cflags = [ "-Wno-unused-function" ]
}
if (is_linux) {
defines += [
"SYSCONFDIR=\"/etc\"",
"FALLBACK_CONFIG_DIRS=\"/etc/xdg\"",
"FALLBACK_DATA_DIRS=\"/usr/local/share:/usr/share\"",
]
}
}
# Vulkan loader
# -------------
config("vulkan_loader_config") {
include_dirs = [
vulkan_gen_dir,
"$angle_root/third_party/vulkan-headers/src/include",
"src/loader",
]
defines = [
"ANGLE_VK_DATA_DIR=\"$data_dir\"",
"ANGLE_VK_ICD_JSON=\"$data_dir/VkICD_mock_icd.json\"",
"API_NAME=\"Vulkan\"",
]
if (is_win) {
cflags = [ "/wd4201" ]
}
if (is_linux) {
# assume secure_getenv() is available
defines += [ "HAVE_SECURE_GETENV" ]
}
}
if (!is_android) {
if (angle_shared_libvulkan) {
library_type = "shared_library"
} else {
library_type = "static_library"
}
target(library_type, "libvulkan") {
sources = [
"src/loader/asm_offset.c",
"src/loader/cJSON.c",
"src/loader/cJSON.h",
"src/loader/debug_utils.c",
"src/loader/debug_utils.h",
"src/loader/dev_ext_trampoline.c",
"src/loader/extension_manual.c",
"src/loader/extension_manual.h",
"src/loader/gpa_helper.h",
"src/loader/loader.c",
"src/loader/loader.h",
"src/loader/murmurhash.c",
"src/loader/murmurhash.h",
"src/loader/phys_dev_ext.c",
"src/loader/trampoline.c",
# TODO(jmadill): Use assembler where available.
"src/loader/unknown_ext_chain.c",
"src/loader/vk_loader_platform.h",
"src/loader/wsi.c",
"src/loader/wsi.h",
]
if (is_win) {
sources += [
"src/loader/dirent_on_windows.c",
"src/loader/dirent_on_windows.h",
]
if (!is_clang) {
cflags = [
"/wd4054", # Type cast from function pointer
"/wd4055", # Type cast from data pointer
"/wd4100", # Unreferenced formal parameter
"/wd4152", # Nonstandard extension used (pointer conversion)
"/wd4201", # Nonstandard extension used: nameless struct/union
"/wd4214", # Nonstandard extension used: bit field types other than int
"/wd4232", # Nonstandard extension used: address of dllimport is not static
"/wd4305", # Type cast truncation
"/wd4706", # Assignment within conditional expression
"/wd4996", # Unsafe stdlib function
]
}
}
deps = [
":vulkan_generate_helper_files",
]
public_deps = [
"$angle_root/third_party/vulkan-headers:vulkan_headers",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":vulkan_internal_config" ]
public_configs = [
"$angle_root:vulkan_config",
":vulkan_loader_config",
]
configs -= vulkan_undefine_configs
}
}