Hash :
d33a2222
Author :
Date :
2021-04-26T16:56:15
Upstream Apple's direct-to-Metal backend: compile libANGLE. This change is meant to merge the metal backend changes from Apple's direct-to-Metal backend. Taken from Kyle Piddington's CL: https://chromium-review.googlesource.com/c/angle/angle/+/2857366/ The goal of this CL is to merge the metal backend code in a state that compiles, but not to switch the Metal backend over to using the direct-to-metal backend yet. Bug: angleproject:5505 Bug: angleproject:6127 Change-Id: If6783e06e0086b3a1dd25c6f53caca5cfc96cb86 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2950067 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
# Copyright 2019 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("../gni/angle.gni")
_util_sources = [
"EGLPlatformParameters.h",
"EGLWindow.cpp",
"EGLWindow.h",
"Event.h",
"Matrix.cpp",
"Matrix.h",
"OSPixmap.h",
"OSWindow.cpp",
"OSWindow.h",
"com_utils.h",
"frame_capture_test_utils.h",
"geometry_utils.cpp",
"geometry_utils.h",
"keyboard.h",
"mouse.h",
"random_utils.cpp",
"random_utils.h",
"shader_utils.cpp",
"shader_utils.h",
"util_export.h",
"util_gl.h",
]
if (is_win) {
_util_sources += [ "windows/WGLWindow.h" ]
if (!angle_is_winuwp) {
_util_sources += [
"windows/win32/Win32Pixmap.cpp",
"windows/win32/Win32Pixmap.h",
"windows/win32/Win32Window.cpp",
"windows/win32/Win32Window.h",
]
}
}
if (is_linux) {
_util_sources += [
"display/DisplayPixmap.cpp",
"display/DisplayWindow.cpp",
"display/DisplayWindow.h",
]
}
if (angle_use_x11) {
_util_sources += [
"x11/X11Pixmap.cpp",
"x11/X11Pixmap.h",
"x11/X11Window.cpp",
"x11/X11Window.h",
]
}
if (is_fuchsia) {
_util_sources += [
"fuchsia/FuchsiaPixmap.cpp",
"fuchsia/FuchsiaPixmap.h",
"fuchsia/ScenicWindow.cpp",
"fuchsia/ScenicWindow.h",
]
} else if (use_ozone && !angle_use_x11 && !angle_use_vulkan_display) {
# Use X11 impl by default otherwise switch to fake Ozone impl that does not
# seem to do anything real.
# TODO(msisov): probably, we need to have a proper support for different
# Ozone backends, and be able to switch between them for proper tests.
# For example, Wayland, X11, etc.
_util_sources += [
"ozone/OzonePixmap.cpp",
"ozone/OzoneWindow.cpp",
"ozone/OzoneWindow.h",
]
}
if (is_mac) {
_util_sources += [
"osx/OSXPixmap.h",
"osx/OSXPixmap.mm",
"osx/OSXWindow.h",
"osx/OSXWindow.mm",
]
}
if (is_ios) {
_util_sources += [
"ios/IOSPixmap.h",
"ios/IOSPixmap.mm",
"ios/IOSWindow.h",
"ios/IOSWindow.mm",
]
}
if (is_android) {
_util_sources += [
"android/AndroidPixmap.cpp",
"android/AndroidWindow.cpp",
"android/AndroidWindow.h",
"android/third_party/android_native_app_glue.c",
"android/third_party/android_native_app_glue.h",
]
}
config("angle_util_loader_config") {
defines = [ "ANGLE_USE_UTIL_LOADER" ]
}
config("angle_util_loader_headers_config") {
# Force users to include "util/header.h" instead of just "header.h".
include_dirs = [ ".." ]
}
angle_source_set("angle_util_loader_headers") {
testonly = true
sources = [
"egl_loader_autogen.h",
"gles_loader_autogen.h",
"util_export.h",
]
if (is_win && !angle_is_winuwp) {
sources += [ "windows/wgl_loader_autogen.h" ]
}
public_deps = [ "$angle_root:includes" ]
public_configs = [ ":angle_util_loader_headers_config" ]
}
angle_source_set("angle_util_loader") {
testonly = true
defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
sources = [
"egl_loader_autogen.cpp",
"gles_loader_autogen.cpp",
]
if (is_win && !angle_is_winuwp) {
sources += [ "windows/wgl_loader_autogen.cpp" ]
}
deps = [ ":angle_util_loader_headers" ]
public_configs += [
"$angle_root:no_gl_prototypes",
":angle_util_config",
":angle_util_loader_config",
":angle_util_loader_headers_config",
]
}
config("angle_util_config") {
# Force users to include "util/header.h" instead of just "header.h".
include_dirs = [ ".." ]
if ((is_linux || is_chromeos) && angle_use_x11) {
libs = [ "X11" ]
}
}
foreach(is_shared_library,
[
true,
false,
]) {
if (is_shared_library) {
library_type = "angle_shared_library"
library_name = "angle_util"
dep_suffix = "${angle_libs_suffix}"
} else {
library_type = "angle_static_library"
library_name = "angle_util_static"
dep_suffix = "_static"
}
target(library_type, library_name) {
testonly = true
sources = _util_sources
public_deps = [
":angle_test_utils",
":angle_util_loader_headers",
]
libs = []
if (is_linux || is_chromeos) {
libs += [
"rt",
"dl",
]
}
if (is_apple) {
frameworks = [ "QuartzCore.framework" ]
if (is_mac) {
frameworks += [ "AppKit.framework" ]
}
if (is_ios) {
frameworks += [ "UIKit.framework" ]
}
}
if (is_android) {
libs += [
"android",
"log",
]
}
configs += [ "$angle_root:debug_annotations_config" ]
public_configs += [ ":angle_util_config" ]
if (is_fuchsia) {
public_deps += [
"$angle_root/src/common/fuchsia_egl",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.images",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.policy",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.scenic",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.views",
"//third_party/fuchsia-sdk/sdk/pkg/async-loop-cpp",
"//third_party/fuchsia-sdk/sdk/pkg/async-loop-default",
"//third_party/fuchsia-sdk/sdk/pkg/fdio",
"//third_party/fuchsia-sdk/sdk/pkg/scenic_cpp",
]
}
if (is_shared_library) {
defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
public_deps += [ ":angle_util_loader" ]
if ((is_mac || is_ios) && !is_component_build) {
ldflags = [
"-install_name",
"@rpath/libangle_util.dylib",
]
}
# Currently excluded from the static build because of build issues.
# Would be nice if could be included.
if (is_win && !angle_is_winuwp) {
sources += [ "windows/WGLWindow.cpp" ]
}
} else {
public_configs += [
"$angle_root:angle_static",
"$angle_root:gl_prototypes",
]
}
}
}
if (is_win && !angle_is_winuwp) {
angle_source_set("angle_stack_walker") {
sources = [
"windows/third_party/StackWalker/src/StackWalker.cpp",
"windows/third_party/StackWalker/src/StackWalker.h",
]
if (is_clang) {
cflags_cc = [
"-Wno-c++98-compat-extra-semi",
"-Wno-missing-declarations",
"-Wno-switch",
]
} else {
cflags_cc = [ "/wd4740" ]
}
}
}
config("angle_png_utils_config") {
include_dirs = [ ".." ]
}
angle_source_set("angle_png_utils") {
deps = [ "$angle_libpng_dir" ]
sources = [
"png_utils.cpp",
"png_utils.h",
]
public_configs = [ ":angle_png_utils_config" ]
}
config("angle_test_util_config") {
include_dirs = [ ".." ]
}
angle_source_set("angle_test_utils") {
public_configs = [ ":angle_test_util_config" ]
public_deps = [ "$angle_root:angle_common" ]
deps = []
sources = [
"Timer.cpp",
"Timer.h",
"test_utils.cpp",
"test_utils.h",
]
if (is_win) {
sources += [ "windows/test_utils_win.cpp" ]
if (angle_is_winuwp) {
sources += [ "windows/test_utils_winuwp.cpp" ]
} else {
deps += [ ":angle_stack_walker" ]
sources += [ "windows/win32/test_utils_win32.cpp" ]
}
} else {
sources += [
"posix/crash_handler_posix.cpp",
"posix/test_utils_posix.cpp",
]
}
}