• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
21_vulkan_backend_sources = [
22  "BufferVk.cpp",
23  "BufferVk.h",
24  "CommandProcessor.cpp",
25  "CommandProcessor.h",
26  "CompilerVk.cpp",
27  "CompilerVk.h",
28  "ContextVk.cpp",
29  "ContextVk.h",
30  "DebugAnnotatorVk.cpp",
31  "DebugAnnotatorVk.h",
32  "DeviceVk.cpp",
33  "DeviceVk.h",
34  "DisplayVk.cpp",
35  "DisplayVk.h",
36  "DisplayVk_api.h",
37  "FenceNVVk.cpp",
38  "FenceNVVk.h",
39  "FramebufferVk.cpp",
40  "FramebufferVk.h",
41  "GlslangWrapperVk.cpp",
42  "GlslangWrapperVk.h",
43  "ImageVk.cpp",
44  "ImageVk.h",
45  "MemoryObjectVk.cpp",
46  "MemoryObjectVk.h",
47  "OverlayVk.cpp",
48  "OverlayVk.h",
49  "PersistentCommandPool.cpp",
50  "PersistentCommandPool.h",
51  "ProgramExecutableVk.cpp",
52  "ProgramExecutableVk.h",
53  "ProgramPipelineVk.cpp",
54  "ProgramPipelineVk.h",
55  "ProgramVk.cpp",
56  "ProgramVk.h",
57  "QueryVk.cpp",
58  "QueryVk.h",
59  "RenderTargetVk.cpp",
60  "RenderTargetVk.h",
61  "RenderbufferVk.cpp",
62  "RenderbufferVk.h",
63  "RendererVk.cpp",
64  "RendererVk.h",
65  "ResourceVk.cpp",
66  "ResourceVk.h",
67  "SamplerVk.cpp",
68  "SamplerVk.h",
69  "SecondaryCommandBuffer.cpp",
70  "SecondaryCommandBuffer.h",
71  "SemaphoreVk.cpp",
72  "SemaphoreVk.h",
73  "ShaderVk.cpp",
74  "ShaderVk.h",
75  "SurfaceVk.cpp",
76  "SurfaceVk.h",
77  "SyncVk.cpp",
78  "SyncVk.h",
79  "TextureVk.cpp",
80  "TextureVk.h",
81  "TransformFeedbackVk.cpp",
82  "TransformFeedbackVk.h",
83  "UtilsVk.cpp",
84  "UtilsVk.h",
85  "VertexArrayVk.cpp",
86  "VertexArrayVk.h",
87  "android/vk_android_utils.cpp",
88  "android/vk_android_utils.h",
89  "vk_cache_utils.cpp",
90  "vk_cache_utils.h",
91  "vk_caps_utils.cpp",
92  "vk_caps_utils.h",
93  "vk_format_table_autogen.cpp",
94  "vk_format_utils.cpp",
95  "vk_format_utils.h",
96  "vk_helpers.cpp",
97  "vk_helpers.h",
98  "vk_internal_shaders_autogen.cpp",
99  "vk_internal_shaders_autogen.h",
100  "vk_mandatory_format_support_table_autogen.cpp",
101  "vk_utils.cpp",
102  "vk_utils.h",
103  "vk_wrapper.h",
104]
105
106if (angle_enable_cl) {
107  _vulkan_backend_sources += [
108    "CLCommandQueueVk.cpp",
109    "CLCommandQueueVk.h",
110    "CLContextVk.cpp",
111    "CLContextVk.h",
112    "CLDeviceVk.cpp",
113    "CLDeviceVk.h",
114    "CLEventVk.cpp",
115    "CLEventVk.h",
116    "CLKernelVk.cpp",
117    "CLKernelVk.h",
118    "CLMemoryVk.cpp",
119    "CLMemoryVk.h",
120    "CLPlatformVk.cpp",
121    "CLPlatformVk.h",
122    "CLProgramVk.cpp",
123    "CLProgramVk.h",
124    "CLSamplerVk.cpp",
125    "CLSamplerVk.h",
126    "cl_types.h",
127  ]
128}
129
130if (angle_use_vulkan_null_display) {
131  _vulkan_backend_sources += [
132    "null/DisplayVkNull.cpp",
133    "null/DisplayVkNull.h",
134    "null/WindowSurfaceVkNull.cpp",
135    "null/WindowSurfaceVkNull.h",
136  ]
137}
138
139if (is_linux) {
140  _vulkan_backend_sources += [
141    "display/DisplayVkSimple.cpp",
142    "display/DisplayVkSimple.h",
143    "display/WindowSurfaceVkSimple.cpp",
144    "display/WindowSurfaceVkSimple.h",
145    "headless/DisplayVkHeadless.cpp",
146    "headless/DisplayVkHeadless.h",
147    "headless/WindowSurfaceVkHeadless.cpp",
148    "headless/WindowSurfaceVkHeadless.h",
149  ]
150}
151
152if (is_android) {
153  _vulkan_backend_sources += [
154    "android/AHBFunctions.cpp",
155    "android/AHBFunctions.h",
156    "android/DisplayVkAndroid.cpp",
157    "android/DisplayVkAndroid.h",
158    "android/HardwareBufferImageSiblingVkAndroid.cpp",
159    "android/HardwareBufferImageSiblingVkAndroid.h",
160    "android/WindowSurfaceVkAndroid.cpp",
161    "android/WindowSurfaceVkAndroid.h",
162  ]
163}
164
165if (is_win) {
166  _vulkan_backend_sources += [
167    "win32/DisplayVkWin32.cpp",
168    "win32/DisplayVkWin32.h",
169    "win32/WindowSurfaceVkWin32.cpp",
170    "win32/WindowSurfaceVkWin32.h",
171  ]
172}
173
174if (angle_use_x11) {
175  _vulkan_backend_sources += [
176    "xcb/DisplayVkXcb.cpp",
177    "xcb/DisplayVkXcb.h",
178    "xcb/WindowSurfaceVkXcb.cpp",
179    "xcb/WindowSurfaceVkXcb.h",
180  ]
181}
182
183if (is_fuchsia) {
184  _vulkan_backend_sources += [
185    "fuchsia/DisplayVkFuchsia.cpp",
186    "fuchsia/DisplayVkFuchsia.h",
187    "fuchsia/WindowSurfaceVkFuchsia.cpp",
188    "fuchsia/WindowSurfaceVkFuchsia.h",
189  ]
190}
191
192if (is_ggp) {
193  _vulkan_backend_sources += [
194    "ggp/DisplayVkGGP.cpp",
195    "ggp/DisplayVkGGP.h",
196    "ggp/WindowSurfaceVkGGP.cpp",
197    "ggp/WindowSurfaceVkGGP.h",
198  ]
199}
200
201if (is_mac) {
202  _vulkan_backend_sources += [
203    "mac/DisplayVkMac.h",
204    "mac/DisplayVkMac.mm",
205    "mac/IOSurfaceSurfaceVkMac.h",
206    "mac/IOSurfaceSurfaceVkMac.mm",
207    "mac/WindowSurfaceVkMac.h",
208    "mac/WindowSurfaceVkMac.mm",
209  ]
210}
211
212config("angle_vulkan_backend_config") {
213  defines = [ "ANGLE_ENABLE_VULKAN" ]
214  if (angle_enable_swiftshader) {
215    defines += [ "ANGLE_ENABLE_SWIFTSHADER" ]
216  }
217  if (angle_enable_custom_vulkan_cmd_buffers) {
218    defines += [ "ANGLE_USE_CUSTOM_VULKAN_CMD_BUFFERS=1" ]
219  }
220  if (angle_enable_vulkan_gpu_trace_events) {
221    defines += [ "ANGLE_ENABLE_VULKAN_GPU_TRACE_EVENTS=1" ]
222  }
223  if (angle_enable_vulkan_validation_layers) {
224    defines += [ "ANGLE_ENABLE_VULKAN_VALIDATION_LAYERS" ]
225  }
226}
227
228angle_source_set("angle_vk_mem_alloc_wrapper") {
229  deps = [
230    "$angle_root/src/common/vulkan:angle_vulkan_headers",
231    "$angle_vulkan_memory_allocator_dir",
232  ]
233  configs += [ "$angle_root:angle_no_cfi_unrelated_cast" ]
234  sources = [
235    "vk_mem_alloc_wrapper.cpp",
236    "vk_mem_alloc_wrapper.h",
237  ]
238  if (is_clang) {
239    cflags_cc = [
240      "-Wno-extra-semi-stmt",
241      "-Wno-missing-field-initializers",
242      "-Wno-suggest-destructor-override",
243      "-Wno-suggest-override",
244    ]
245  }
246}
247
248angle_source_set("angle_vulkan_backend") {
249  sources = _vulkan_backend_sources
250  libs = []
251  deps = [
252    ":angle_vk_mem_alloc_wrapper",
253    "$angle_root:angle_abseil",
254    "$angle_root:angle_compression",
255    "$angle_root:angle_gpu_info_util",
256    "$angle_root:angle_image_util",
257    "$angle_root/src/common/spirv:angle_spirv_builder",
258    "$angle_spirv_headers_dir:spv_headers",
259  ]
260
261  public_deps = [
262    "$angle_root:angle_glslang_wrapper",
263    "$angle_root:libANGLE_headers",
264    "$angle_root/src/common/vulkan",
265    "$angle_root/src/common/vulkan:angle_libvulkan_loader",
266    "$angle_root/src/common/vulkan:angle_vulkan_entry_points",
267    "$angle_root/src/common/vulkan:angle_vulkan_headers",
268  ]
269  public_configs = [ ":angle_vulkan_backend_config" ]
270
271  data_deps = []
272
273  defines = []
274
275  if (angle_enable_vulkan_validation_layers) {
276    defines += [ "ANGLE_ENABLE_VULKAN_VALIDATION_LAYERS_BY_DEFAULT" ]
277    data_deps += [ "$angle_root/src/common/vulkan:vulkan_validation_layers" ]
278  }
279
280  if (is_fuchsia) {
281    public_deps += [ "$angle_root/src/common/fuchsia_egl:backend" ]
282  }
283
284  # Include generated shaders.
285  import("vk_internal_shaders_autogen.gni")
286  sources += angle_vulkan_internal_shaders
287}
288