1# Copyright 2019 The ANGLE Project Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4# 5# This file houses the build configuration for the ANGLE Vulkan back-end. 6 7import("//build/config/dcheck_always_on.gni") 8import("//build_overrides/swiftshader.gni") 9import("../../../../gni/angle.gni") 10 11assert(angle_enable_vulkan) 12 13declare_args() { 14 # Enable custom (cpu-side) secondary command buffers 15 angle_enable_custom_vulkan_cmd_buffers = true 16 17 # Enable Vulkan GPU trace event capability 18 angle_enable_vulkan_gpu_trace_events = false 19} 20 21declare_args() { 22 # Enable custom secondary command buffers for outside render pass commands only 23 angle_enable_custom_vulkan_outside_render_pass_cmd_buffers = 24 angle_enable_custom_vulkan_cmd_buffers 25 26 # Enable custom secondary command buffers for render pass commands only 27 angle_enable_custom_vulkan_render_pass_cmd_buffers = 28 angle_enable_custom_vulkan_cmd_buffers 29} 30 31_vulkan_backend_sources = [ 32 "BufferVk.cpp", 33 "BufferVk.h", 34 "CommandProcessor.cpp", 35 "CommandProcessor.h", 36 "CompilerVk.cpp", 37 "CompilerVk.h", 38 "ContextVk.cpp", 39 "ContextVk.h", 40 "DebugAnnotatorVk.cpp", 41 "DebugAnnotatorVk.h", 42 "DeviceVk.cpp", 43 "DeviceVk.h", 44 "DisplayVk.cpp", 45 "DisplayVk.h", 46 "DisplayVk_api.h", 47 "FenceNVVk.cpp", 48 "FenceNVVk.h", 49 "FramebufferVk.cpp", 50 "FramebufferVk.h", 51 "GlslangWrapperVk.cpp", 52 "GlslangWrapperVk.h", 53 "ImageVk.cpp", 54 "ImageVk.h", 55 "MemoryObjectVk.cpp", 56 "MemoryObjectVk.h", 57 "OverlayVk.cpp", 58 "OverlayVk.h", 59 "PersistentCommandPool.cpp", 60 "PersistentCommandPool.h", 61 "ProgramExecutableVk.cpp", 62 "ProgramExecutableVk.h", 63 "ProgramPipelineVk.cpp", 64 "ProgramPipelineVk.h", 65 "ProgramVk.cpp", 66 "ProgramVk.h", 67 "QueryVk.cpp", 68 "QueryVk.h", 69 "RenderTargetVk.cpp", 70 "RenderTargetVk.h", 71 "RenderbufferVk.cpp", 72 "RenderbufferVk.h", 73 "RendererVk.cpp", 74 "RendererVk.h", 75 "ResourceVk.cpp", 76 "ResourceVk.h", 77 "SamplerVk.cpp", 78 "SamplerVk.h", 79 "SecondaryCommandBuffer.cpp", 80 "SecondaryCommandBuffer.h", 81 "SemaphoreVk.cpp", 82 "SemaphoreVk.h", 83 "ShaderVk.cpp", 84 "ShaderVk.h", 85 "SurfaceVk.cpp", 86 "SurfaceVk.h", 87 "SyncVk.cpp", 88 "SyncVk.h", 89 "TextureVk.cpp", 90 "TextureVk.h", 91 "TransformFeedbackVk.cpp", 92 "TransformFeedbackVk.h", 93 "UtilsVk.cpp", 94 "UtilsVk.h", 95 "VertexArrayVk.cpp", 96 "VertexArrayVk.h", 97 "VkImageImageSiblingVk.cpp", 98 "VkImageImageSiblingVk.h", 99 "VulkanSecondaryCommandBuffer.cpp", 100 "VulkanSecondaryCommandBuffer.h", 101 "android/vk_android_utils.cpp", 102 "android/vk_android_utils.h", 103 "vk_cache_utils.cpp", 104 "vk_cache_utils.h", 105 "vk_caps_utils.cpp", 106 "vk_caps_utils.h", 107 "vk_command_buffer_utils.h", 108 "vk_format_table_autogen.cpp", 109 "vk_format_utils.cpp", 110 "vk_format_utils.h", 111 "vk_helpers.cpp", 112 "vk_helpers.h", 113 "vk_internal_shaders_autogen.cpp", 114 "vk_internal_shaders_autogen.h", 115 "vk_mandatory_format_support_table_autogen.cpp", 116 "vk_utils.cpp", 117 "vk_utils.h", 118 "vk_wrapper.h", 119] 120 121if (angle_enable_cl) { 122 _vulkan_backend_sources += [ 123 "CLCommandQueueVk.cpp", 124 "CLCommandQueueVk.h", 125 "CLContextVk.cpp", 126 "CLContextVk.h", 127 "CLDeviceVk.cpp", 128 "CLDeviceVk.h", 129 "CLEventVk.cpp", 130 "CLEventVk.h", 131 "CLKernelVk.cpp", 132 "CLKernelVk.h", 133 "CLMemoryVk.cpp", 134 "CLMemoryVk.h", 135 "CLPlatformVk.cpp", 136 "CLPlatformVk.h", 137 "CLProgramVk.cpp", 138 "CLProgramVk.h", 139 "CLSamplerVk.cpp", 140 "CLSamplerVk.h", 141 "cl_types.h", 142 ] 143} 144 145if (angle_use_vulkan_null_display) { 146 _vulkan_backend_sources += [ 147 "null/DisplayVkNull.cpp", 148 "null/DisplayVkNull.h", 149 ] 150} 151 152if (is_linux || is_chromeos) { 153 _vulkan_backend_sources += [ 154 "linux/DisplayVkLinux.cpp", 155 "linux/DisplayVkLinux.h", 156 "linux/DmaBufImageSiblingVkLinux.cpp", 157 "linux/DmaBufImageSiblingVkLinux.h", 158 "linux/display/DisplayVkSimple.cpp", 159 "linux/display/DisplayVkSimple.h", 160 "linux/display/WindowSurfaceVkSimple.cpp", 161 "linux/display/WindowSurfaceVkSimple.h", 162 "linux/headless/DisplayVkHeadless.cpp", 163 "linux/headless/DisplayVkHeadless.h", 164 "linux/headless/WindowSurfaceVkHeadless.cpp", 165 "linux/headless/WindowSurfaceVkHeadless.h", 166 ] 167} 168 169if (is_android) { 170 _vulkan_backend_sources += [ 171 "android/AHBFunctions.cpp", 172 "android/AHBFunctions.h", 173 "android/DisplayVkAndroid.cpp", 174 "android/DisplayVkAndroid.h", 175 "android/HardwareBufferImageSiblingVkAndroid.cpp", 176 "android/HardwareBufferImageSiblingVkAndroid.h", 177 "android/WindowSurfaceVkAndroid.cpp", 178 "android/WindowSurfaceVkAndroid.h", 179 ] 180} 181 182if (is_win) { 183 _vulkan_backend_sources += [ 184 "win32/DisplayVkWin32.cpp", 185 "win32/DisplayVkWin32.h", 186 "win32/WindowSurfaceVkWin32.cpp", 187 "win32/WindowSurfaceVkWin32.h", 188 ] 189} 190 191if (angle_use_x11) { 192 _vulkan_backend_sources += [ 193 "linux/xcb/DisplayVkXcb.cpp", 194 "linux/xcb/DisplayVkXcb.h", 195 "linux/xcb/WindowSurfaceVkXcb.cpp", 196 "linux/xcb/WindowSurfaceVkXcb.h", 197 ] 198} 199 200if (angle_use_wayland) { 201 _vulkan_backend_sources += [ 202 "linux/wayland/DisplayVkWayland.cpp", 203 "linux/wayland/DisplayVkWayland.h", 204 "linux/wayland/WindowSurfaceVkWayland.cpp", 205 "linux/wayland/WindowSurfaceVkWayland.h", 206 ] 207} 208 209if (is_fuchsia) { 210 _vulkan_backend_sources += [ 211 "fuchsia/DisplayVkFuchsia.cpp", 212 "fuchsia/DisplayVkFuchsia.h", 213 "fuchsia/WindowSurfaceVkFuchsia.cpp", 214 "fuchsia/WindowSurfaceVkFuchsia.h", 215 ] 216} 217 218if (is_ggp) { 219 _vulkan_backend_sources += [ 220 "ggp/DisplayVkGGP.cpp", 221 "ggp/DisplayVkGGP.h", 222 "ggp/WindowSurfaceVkGGP.cpp", 223 "ggp/WindowSurfaceVkGGP.h", 224 ] 225} 226 227if (is_mac) { 228 _vulkan_backend_sources += [ 229 "mac/DisplayVkMac.h", 230 "mac/DisplayVkMac.mm", 231 "mac/IOSurfaceSurfaceVkMac.h", 232 "mac/IOSurfaceSurfaceVkMac.mm", 233 "mac/WindowSurfaceVkMac.h", 234 "mac/WindowSurfaceVkMac.mm", 235 ] 236} 237 238config("angle_vulkan_backend_config") { 239 defines = [ "ANGLE_ENABLE_VULKAN" ] 240 if (angle_enable_swiftshader) { 241 defines += [ "ANGLE_ENABLE_SWIFTSHADER" ] 242 } 243 if (angle_enable_custom_vulkan_outside_render_pass_cmd_buffers) { 244 defines += [ "ANGLE_USE_CUSTOM_VULKAN_OUTSIDE_RENDER_PASS_CMD_BUFFERS=1" ] 245 } 246 if (angle_enable_custom_vulkan_render_pass_cmd_buffers) { 247 defines += [ "ANGLE_USE_CUSTOM_VULKAN_RENDER_PASS_CMD_BUFFERS=1" ] 248 } 249 if (angle_enable_vulkan_gpu_trace_events) { 250 defines += [ "ANGLE_ENABLE_VULKAN_GPU_TRACE_EVENTS=1" ] 251 } 252 if (angle_enable_vulkan_validation_layers) { 253 defines += [ "ANGLE_ENABLE_VULKAN_VALIDATION_LAYERS" ] 254 } 255} 256 257angle_source_set("angle_vk_mem_alloc_wrapper") { 258 deps = [ 259 "$angle_root/src/common/vulkan:angle_vulkan_headers", 260 "$angle_vulkan_memory_allocator_dir", 261 ] 262 configs += [ "$angle_root:angle_no_cfi_unrelated_cast" ] 263 sources = [ 264 "vk_mem_alloc_wrapper.cpp", 265 "vk_mem_alloc_wrapper.h", 266 ] 267 if (is_clang) { 268 cflags_cc = [ 269 "-Wno-extra-semi-stmt", 270 "-Wno-missing-field-initializers", 271 "-Wno-suggest-destructor-override", 272 "-Wno-suggest-override", 273 ] 274 } 275} 276 277angle_source_set("angle_vulkan_backend") { 278 sources = _vulkan_backend_sources 279 libs = [] 280 deps = [ 281 ":angle_vk_mem_alloc_wrapper", 282 "$angle_root:angle_abseil", 283 "$angle_root:angle_compression", 284 "$angle_root:angle_gpu_info_util", 285 "$angle_root:angle_image_util", 286 "$angle_root/src/common/spirv:angle_spirv_builder", 287 "$angle_spirv_headers_dir:spv_headers", 288 ] 289 290 if (angle_enable_cl || is_android) { 291 deps += [ "$angle_root:angle_version_info" ] 292 } 293 294 public_deps = [ 295 "$angle_root:angle_glslang_wrapper", 296 "$angle_root:libANGLE_headers", 297 "$angle_root/src/common/vulkan", 298 "$angle_root/src/common/vulkan:angle_libvulkan_loader", 299 "$angle_root/src/common/vulkan:angle_vulkan_entry_points", 300 "$angle_root/src/common/vulkan:angle_vulkan_headers", 301 ] 302 public_configs = [ ":angle_vulkan_backend_config" ] 303 304 if (angle_use_wayland) { 305 public_configs += [ "$angle_root:angle_wayland_config" ] 306 } 307 308 data_deps = [] 309 310 defines = [] 311 312 if (angle_enable_vulkan_validation_layers) { 313 defines += [ "ANGLE_ENABLE_VULKAN_VALIDATION_LAYERS_BY_DEFAULT" ] 314 data_deps += [ "$angle_root/src/common/vulkan:vulkan_validation_layers" ] 315 } 316 317 if (is_linux || is_chromeos) { 318 deps += [ "$angle_root/src/common/linux:angle_dma_buf" ] 319 } 320 321 if (is_fuchsia) { 322 public_deps += [ "$angle_root/src/common/fuchsia_egl:backend" ] 323 } 324 325 # Include generated shaders. 326 import("vk_internal_shaders_autogen.gni") 327 sources += angle_vulkan_internal_shaders 328} 329