blob: 7bf97265798b0ba38a307f792232bc5baa013c05 [file] [log] [blame]
Corentin Wallez21a23852018-07-31 18:50:03 +02001# Copyright 2018 The Dawn Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Corentin Walleze92ad5b2018-10-31 10:49:21 +000015import("//build_overrides/build.gni")
Li, Hao0e1bef32019-11-07 12:13:27 +000016import("//build_overrides/vulkan_validation_layers.gni")
Idan Raiter1c859762019-05-22 17:18:52 +000017import("generator/dawn_generator.gni")
Corentin Wallezabc753c2019-03-06 23:17:39 +000018import("scripts/dawn_component.gni")
Takuto Ikuta0e6dad02019-02-13 18:42:38 +000019import("scripts/dawn_features.gni")
20import("scripts/dawn_overrides_with_defaults.gni")
Corentin Wallez48a19232018-12-08 10:35:53 +000021
22import("//testing/test.gni")
Corentin Wallez21a23852018-07-31 18:50:03 +020023
Corentin Wallez74cebd62019-11-26 18:21:51 +000024# Swiftshader is an optional dependency of Dawn so we only use it if the path
25# to it has been set.
26use_swiftshader = dawn_use_swiftshader && dawn_swiftshader_dir != ""
27
28if (use_swiftshader) {
29 assert(dawn_enable_vulkan,
30 "dawn_use_swiftshader requires dawn_enable_vulkan=true")
31 import("${dawn_swiftshader_dir}/src/Vulkan/vulkan.gni")
32}
33
Corentin Wallez280b96e2019-12-11 16:54:51 +000034# Import mac_min_system_version
35if (is_mac) {
36 import("//build/config/mac/mac_sdk.gni")
37}
38
Corentin Wallez649e2fe2018-08-03 15:57:43 +020039###############################################################################
Austin Engd4ce7362019-08-13 19:00:34 +000040# dawn_platform
41###############################################################################
42
43source_set("dawn_platform") {
44 configs += [ "${dawn_root}/src/common:dawn_internal" ]
45
46 sources = [
47 "${dawn_root}/src/include/dawn_platform/DawnPlatform.h",
48 "src/dawn_platform/tracing/EventTracer.cpp",
49 "src/dawn_platform/tracing/EventTracer.h",
50 "src/dawn_platform/tracing/TraceEvent.h",
51 ]
52
53 deps = [
54 "${dawn_root}/src/common",
55 ]
56}
57
58###############################################################################
Corentin Wallezbd483852019-01-09 09:05:18 +000059# libdawn_native
Corentin Wallez21a23852018-07-31 18:50:03 +020060###############################################################################
61
62config("libdawn_native_internal") {
Corentin Wallez579cf622019-03-07 01:46:39 +000063 configs = [ "${dawn_root}/src/common:dawn_internal" ]
Corentin Wallez21a23852018-07-31 18:50:03 +020064
Corentin Wallez7dda7d02019-09-18 04:40:32 +000065 # Suppress warnings that Metal isn't in the deployment target of Chrome:
66 # initialization of the Metal backend is behind a IsMetalSupported check so
67 # Dawn won't call Metal functions on macOS 10.10.
Corentin Wallez280b96e2019-12-11 16:54:51 +000068 # At the time this is written Chromium supports 10.10.0 and above, so if we
69 # aren't on 10.11 it means we are on 10.11 and above, and Metal is available.
70 # Skipping this check on 10.11 and above is important as it allows getting
71 # proper compilation warning when using 10.12 and above feature for example.
Corentin Wallez7dda7d02019-09-18 04:40:32 +000072 # TODO(cwallez@chromium.org): Consider using API_AVAILABLE annotations on all
Corentin Wallez280b96e2019-12-11 16:54:51 +000073 # metal code in dawn once crbug.com/1004024 is sorted out if Chromium still
74 # supports 10.10 then.
75 if (is_mac && mac_min_system_version == "10.10.0") {
Corentin Wallez21a23852018-07-31 18:50:03 +020076 cflags_objcc = [ "-Wno-unguarded-availability" ]
77 }
78}
79
Pawel Pluciennik3c79cf22019-10-21 11:35:49 +000080config("libdawn_native_weak_framework") {
81 if (is_mac && dawn_enable_metal) {
82 ldflags = [
83 "-weak_framework",
84 "Metal",
85 ]
86 }
87}
88
Corentin Wallez031fbbb2019-06-11 18:03:05 +000089dawn_json_generator("libdawn_native_utils_gen") {
Corentin Wallez21a23852018-07-31 18:50:03 +020090 target = "dawn_native_utils"
Corentin Wallez59e7fad2018-08-16 15:32:35 +020091 outputs = [
Corentin Wallez897ebc72019-09-18 04:33:12 +000092 "src/dawn_native/ProcTable.cpp",
Corentin Wallez1f6c8c42019-10-23 11:57:41 +000093 "src/dawn_native/wgpu_structs_autogen.h",
94 "src/dawn_native/wgpu_structs_autogen.cpp",
Corentin Wallez897ebc72019-09-18 04:33:12 +000095 "src/dawn_native/ValidationUtils_autogen.h",
96 "src/dawn_native/ValidationUtils_autogen.cpp",
Corentin Wallez21a23852018-07-31 18:50:03 +020097 ]
98}
99
Corentin Wallezdf69f242019-06-13 10:22:32 +0000100if (dawn_enable_opengl) {
101 dawn_generator("libdawn_native_opengl_loader_gen") {
102 script = "generator/opengl_loader_generator.py"
103 args = [
104 "--gl-xml",
Corentin Wallez8f4046b2019-06-17 09:17:29 +0000105 rebase_path("third_party/khronos/gl.xml", root_build_dir),
Jiawei Shao9d9d76c2019-08-22 08:19:13 +0000106 "--supported-extensions",
107 rebase_path("src/dawn_native/opengl/supported_extensions.json",
108 root_build_dir),
Corentin Wallezdf69f242019-06-13 10:22:32 +0000109 ]
110 outputs = [
Corentin Wallez897ebc72019-09-18 04:33:12 +0000111 "src/dawn_native/opengl/OpenGLFunctionsBase_autogen.cpp",
112 "src/dawn_native/opengl/OpenGLFunctionsBase_autogen.h",
113 "src/dawn_native/opengl/opengl_platform_autogen.h",
Corentin Wallezdf69f242019-06-13 10:22:32 +0000114 ]
115 }
116}
117
Corentin Wallezd2969a72018-08-12 21:07:46 +0200118# Public libdawn_native headers so they can be publically visible for
119# dependencies of libdawn_native
120source_set("libdawn_native_headers") {
121 public_deps = [
Austin Engcc071e42019-10-16 10:26:01 +0000122 "${dawn_root}/src/dawn:dawncpp_headers",
Corentin Wallezd2969a72018-08-12 21:07:46 +0200123 ]
Corentin Wallez91e94922019-03-26 17:16:28 +0000124 all_dependent_configs = [ "${dawn_root}/src/common:dawn_public_include_dirs" ]
Corentin Wallezd2969a72018-08-12 21:07:46 +0200125 sources = [
126 "src/include/dawn_native/DawnNative.h",
127 "src/include/dawn_native/dawn_native_export.h",
128
129 # Include all backend's public headers so that dependencies can include
130 # them even when the backends are disabled.
131 "src/include/dawn_native/D3D12Backend.h",
132 "src/include/dawn_native/MetalBackend.h",
133 "src/include/dawn_native/NullBackend.h",
134 "src/include/dawn_native/OpenGLBackend.h",
135 "src/include/dawn_native/VulkanBackend.h",
136 ]
137}
138
Corentin Wallez21a23852018-07-31 18:50:03 +0200139# The meat of the compilation for libdawn_native so that we can cheaply have
Corentin Wallezbd483852019-01-09 09:05:18 +0000140# shared_library / static_library versions of it. It compiles all the files
141# except those that define exported symbols.
Corentin Wallez21a23852018-07-31 18:50:03 +0200142source_set("libdawn_native_sources") {
143 deps = [
Corentin Wallezbd483852019-01-09 09:05:18 +0000144 ":libdawn_native_headers",
Corentin Wallez59e7fad2018-08-16 15:32:35 +0200145 ":libdawn_native_utils_gen",
Corentin Wallez579cf622019-03-07 01:46:39 +0000146 "${dawn_root}/src/common",
Ryan Harrison22e73a52019-11-28 17:14:55 +0000147 "${dawn_shaderc_dir}:spirv_cross",
Corentin Wallez21d84382018-09-06 17:25:46 +0200148 "${dawn_spirv_tools_dir}:spvtools_val",
Corentin Wallez21a23852018-07-31 18:50:03 +0200149 ]
Ryan Harrison19544362019-11-21 18:08:15 +0000150 defines = []
Corentin Wallez74cebd62019-11-26 18:21:51 +0000151 libs = []
152 data_deps = []
Ryan Harrison48bf7452019-11-21 20:31:05 +0000153
Corentin Wallez2ec59d92018-11-14 21:04:26 +0000154 configs += [ ":libdawn_native_internal" ]
Corentin Wallez21a23852018-07-31 18:50:03 +0200155
Corentin Wallez23dd1242019-07-22 23:32:29 +0000156 # Dependencies that are needed to compile libdawn_native entry points in
157 # FooBackend.cpp need to be public deps so they are propagated to the
158 # libdawn_native target
Austin Engd4ce7362019-08-13 19:00:34 +0000159 public_deps = [
160 ":dawn_platform",
Kai Ninomiya47b15042020-02-04 02:48:43 +0000161 "${dawn_shaderc_dir}:libshaderc_spvc",
Austin Engd4ce7362019-08-13 19:00:34 +0000162 ]
Corentin Wallez23dd1242019-07-22 23:32:29 +0000163
Corentin Wallez59e7fad2018-08-16 15:32:35 +0200164 sources = get_target_outputs(":libdawn_native_utils_gen")
165 sources += [
Corentin Wallezac67fec2019-01-04 10:30:40 +0000166 "src/dawn_native/Adapter.cpp",
167 "src/dawn_native/Adapter.h",
Austin Engb98f0fa2019-07-26 19:08:18 +0000168 "src/dawn_native/AttachmentState.cpp",
169 "src/dawn_native/AttachmentState.h",
Corentin Wallezac67fec2019-01-04 10:30:40 +0000170 "src/dawn_native/BackendConnection.cpp",
171 "src/dawn_native/BackendConnection.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200172 "src/dawn_native/BindGroup.cpp",
173 "src/dawn_native/BindGroup.h",
174 "src/dawn_native/BindGroupLayout.cpp",
175 "src/dawn_native/BindGroupLayout.h",
Austin Eng7f3f3312019-09-17 19:25:27 +0000176 "src/dawn_native/BindGroupTracker.h",
Bryan Bernhart35ad5222019-07-30 16:46:10 +0000177 "src/dawn_native/BuddyAllocator.cpp",
178 "src/dawn_native/BuddyAllocator.h",
Bryan Bernhart21dfc912019-10-03 18:17:31 +0000179 "src/dawn_native/BuddyMemoryAllocator.cpp",
180 "src/dawn_native/BuddyMemoryAllocator.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200181 "src/dawn_native/Buffer.cpp",
182 "src/dawn_native/Buffer.h",
Austin Eng84bcf442019-10-30 00:20:03 +0000183 "src/dawn_native/CachedObject.cpp",
184 "src/dawn_native/CachedObject.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200185 "src/dawn_native/CommandAllocator.cpp",
186 "src/dawn_native/CommandAllocator.h",
187 "src/dawn_native/CommandBuffer.cpp",
188 "src/dawn_native/CommandBuffer.h",
189 "src/dawn_native/CommandBufferStateTracker.cpp",
190 "src/dawn_native/CommandBufferStateTracker.h",
Corentin Walleze1f0d4e2019-02-15 12:54:08 +0000191 "src/dawn_native/CommandEncoder.cpp",
192 "src/dawn_native/CommandEncoder.h",
Austin Eng3318caa2019-08-13 00:22:28 +0000193 "src/dawn_native/CommandValidation.cpp",
194 "src/dawn_native/CommandValidation.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200195 "src/dawn_native/Commands.cpp",
196 "src/dawn_native/Commands.h",
Corentin Wallez82fbccb2018-09-21 00:24:37 +0000197 "src/dawn_native/ComputePassEncoder.cpp",
198 "src/dawn_native/ComputePassEncoder.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200199 "src/dawn_native/ComputePipeline.cpp",
200 "src/dawn_native/ComputePipeline.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200201 "src/dawn_native/Device.cpp",
202 "src/dawn_native/Device.h",
Bryan Bernhart74e95ff2019-01-29 00:10:07 +0000203 "src/dawn_native/DynamicUploader.cpp",
204 "src/dawn_native/DynamicUploader.h",
Austin Engfde94902019-07-24 18:15:24 +0000205 "src/dawn_native/EncodingContext.cpp",
206 "src/dawn_native/EncodingContext.h",
Natasha Lee0ecc48e2020-01-15 19:02:13 +0000207 "src/dawn_native/Error.cpp",
Corentin Wallez21a23852018-07-31 18:50:03 +0200208 "src/dawn_native/Error.h",
209 "src/dawn_native/ErrorData.cpp",
210 "src/dawn_native/ErrorData.h",
Austin Eng6ea362c2019-12-17 00:47:40 +0000211 "src/dawn_native/ErrorInjector.cpp",
212 "src/dawn_native/ErrorInjector.h",
Austin Engf35dcfe2019-09-10 23:19:11 +0000213 "src/dawn_native/ErrorScope.cpp",
214 "src/dawn_native/ErrorScope.h",
Austin Engbe990072019-09-17 18:24:07 +0000215 "src/dawn_native/ErrorScopeTracker.cpp",
216 "src/dawn_native/ErrorScopeTracker.h",
Jiawei Shao574b9512019-08-02 00:06:38 +0000217 "src/dawn_native/Extensions.cpp",
218 "src/dawn_native/Extensions.h",
Austin Engf0b761f2018-12-03 16:57:34 +0000219 "src/dawn_native/Fence.cpp",
220 "src/dawn_native/Fence.h",
221 "src/dawn_native/FenceSignalTracker.cpp",
222 "src/dawn_native/FenceSignalTracker.h",
Corentin Wallez1546bfb2019-07-18 09:25:04 +0000223 "src/dawn_native/Format.cpp",
224 "src/dawn_native/Format.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200225 "src/dawn_native/Forward.h",
Corentin Wallezac67fec2019-01-04 10:30:40 +0000226 "src/dawn_native/Instance.cpp",
227 "src/dawn_native/Instance.h",
Corentin Wallez9e4518b2018-10-15 12:54:30 +0000228 "src/dawn_native/ObjectBase.cpp",
229 "src/dawn_native/ObjectBase.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200230 "src/dawn_native/PassResourceUsage.h",
Austin Enge9fabf52019-08-08 17:21:39 +0000231 "src/dawn_native/PassResourceUsageTracker.cpp",
232 "src/dawn_native/PassResourceUsageTracker.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200233 "src/dawn_native/PerStage.cpp",
234 "src/dawn_native/PerStage.h",
235 "src/dawn_native/Pipeline.cpp",
236 "src/dawn_native/Pipeline.h",
237 "src/dawn_native/PipelineLayout.cpp",
238 "src/dawn_native/PipelineLayout.h",
Corentin Wallez82fbccb2018-09-21 00:24:37 +0000239 "src/dawn_native/ProgrammablePassEncoder.cpp",
240 "src/dawn_native/ProgrammablePassEncoder.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200241 "src/dawn_native/Queue.cpp",
242 "src/dawn_native/Queue.h",
243 "src/dawn_native/RefCounted.cpp",
244 "src/dawn_native/RefCounted.h",
Austin Eng8a488c12019-08-13 22:12:54 +0000245 "src/dawn_native/RenderBundle.cpp",
246 "src/dawn_native/RenderBundle.h",
247 "src/dawn_native/RenderBundleEncoder.cpp",
248 "src/dawn_native/RenderBundleEncoder.h",
Austin Eng69f1db72019-07-20 01:34:56 +0000249 "src/dawn_native/RenderEncoderBase.cpp",
250 "src/dawn_native/RenderEncoderBase.h",
Corentin Wallez82fbccb2018-09-21 00:24:37 +0000251 "src/dawn_native/RenderPassEncoder.cpp",
252 "src/dawn_native/RenderPassEncoder.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200253 "src/dawn_native/RenderPipeline.cpp",
254 "src/dawn_native/RenderPipeline.h",
Bryan Bernhart7ffd2342019-08-27 23:36:26 +0000255 "src/dawn_native/ResourceHeap.h",
Corentin Wallezca354352019-10-24 21:28:16 +0000256 "src/dawn_native/ResourceHeapAllocator.h",
Bryan Bernhart7ffd2342019-08-27 23:36:26 +0000257 "src/dawn_native/ResourceMemoryAllocation.cpp",
258 "src/dawn_native/ResourceMemoryAllocation.h",
Bryan Bernhart450e2122019-09-18 22:06:41 +0000259 "src/dawn_native/RingBufferAllocator.cpp",
260 "src/dawn_native/RingBufferAllocator.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200261 "src/dawn_native/Sampler.cpp",
262 "src/dawn_native/Sampler.h",
263 "src/dawn_native/ShaderModule.cpp",
264 "src/dawn_native/ShaderModule.h",
Bryan Bernhart74e95ff2019-01-29 00:10:07 +0000265 "src/dawn_native/StagingBuffer.cpp",
266 "src/dawn_native/StagingBuffer.h",
Corentin Wallez3a1746e2020-01-15 13:14:12 +0000267 "src/dawn_native/Surface.cpp",
268 "src/dawn_native/Surface.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200269 "src/dawn_native/SwapChain.cpp",
270 "src/dawn_native/SwapChain.h",
271 "src/dawn_native/Texture.cpp",
272 "src/dawn_native/Texture.h",
273 "src/dawn_native/ToBackend.h",
Jiawei Shaod08611b2019-07-30 23:58:52 +0000274 "src/dawn_native/Toggles.cpp",
Jiawei Shao15d4c2e2019-04-26 07:52:57 +0000275 "src/dawn_native/Toggles.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200276 "src/dawn_native/dawn_platform.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200277 ]
278
279 if (dawn_enable_d3d12) {
Corentin Wallezd8597b22018-08-30 14:20:28 +0200280 libs += [ "dxguid.lib" ]
Corentin Wallez21a23852018-07-31 18:50:03 +0200281 sources += [
Corentin Wallezd77fd5f2019-01-30 16:07:48 +0000282 "src/dawn_native/d3d12/AdapterD3D12.cpp",
283 "src/dawn_native/d3d12/AdapterD3D12.h",
284 "src/dawn_native/d3d12/BackendD3D12.cpp",
285 "src/dawn_native/d3d12/BackendD3D12.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200286 "src/dawn_native/d3d12/BindGroupD3D12.cpp",
287 "src/dawn_native/d3d12/BindGroupD3D12.h",
288 "src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp",
289 "src/dawn_native/d3d12/BindGroupLayoutD3D12.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200290 "src/dawn_native/d3d12/BufferD3D12.cpp",
291 "src/dawn_native/d3d12/BufferD3D12.h",
292 "src/dawn_native/d3d12/CommandAllocatorManager.cpp",
293 "src/dawn_native/d3d12/CommandAllocatorManager.h",
294 "src/dawn_native/d3d12/CommandBufferD3D12.cpp",
295 "src/dawn_native/d3d12/CommandBufferD3D12.h",
Rafael Cintron8bde0312019-10-10 18:06:58 +0000296 "src/dawn_native/d3d12/CommandRecordingContext.cpp",
297 "src/dawn_native/d3d12/CommandRecordingContext.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200298 "src/dawn_native/d3d12/ComputePipelineD3D12.cpp",
299 "src/dawn_native/d3d12/ComputePipelineD3D12.h",
Natasha Leef3d50ba2019-10-16 09:26:54 +0000300 "src/dawn_native/d3d12/D3D12Error.cpp",
301 "src/dawn_native/d3d12/D3D12Error.h",
Bryan Bernhart970101a2019-06-12 18:54:57 +0000302 "src/dawn_native/d3d12/D3D12Info.cpp",
303 "src/dawn_native/d3d12/D3D12Info.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200304 "src/dawn_native/d3d12/DescriptorHeapAllocator.cpp",
305 "src/dawn_native/d3d12/DescriptorHeapAllocator.h",
306 "src/dawn_native/d3d12/DeviceD3D12.cpp",
307 "src/dawn_native/d3d12/DeviceD3D12.h",
308 "src/dawn_native/d3d12/Forward.h",
Bryan Bernhart154badf2019-10-17 17:25:28 +0000309 "src/dawn_native/d3d12/HeapAllocatorD3D12.cpp",
310 "src/dawn_native/d3d12/HeapAllocatorD3D12.h",
311 "src/dawn_native/d3d12/HeapD3D12.cpp",
312 "src/dawn_native/d3d12/HeapD3D12.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200313 "src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp",
314 "src/dawn_native/d3d12/NativeSwapChainImplD3D12.h",
315 "src/dawn_native/d3d12/PipelineLayoutD3D12.cpp",
316 "src/dawn_native/d3d12/PipelineLayoutD3D12.h",
Corentin Wallezd8597b22018-08-30 14:20:28 +0200317 "src/dawn_native/d3d12/PlatformFunctions.cpp",
318 "src/dawn_native/d3d12/PlatformFunctions.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200319 "src/dawn_native/d3d12/QueueD3D12.cpp",
320 "src/dawn_native/d3d12/QueueD3D12.h",
Brandon Jones700cfe72019-11-12 18:14:21 +0000321 "src/dawn_native/d3d12/RenderPassBuilderD3D12.cpp",
322 "src/dawn_native/d3d12/RenderPassBuilderD3D12.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200323 "src/dawn_native/d3d12/RenderPipelineD3D12.cpp",
324 "src/dawn_native/d3d12/RenderPipelineD3D12.h",
Bryan Bernhart0da52f22019-10-02 21:45:09 +0000325 "src/dawn_native/d3d12/ResourceAllocatorManagerD3D12.cpp",
326 "src/dawn_native/d3d12/ResourceAllocatorManagerD3D12.h",
Bryan Bernharte16a9012019-10-09 16:50:42 +0000327 "src/dawn_native/d3d12/ResourceHeapAllocationD3D12.cpp",
328 "src/dawn_native/d3d12/ResourceHeapAllocationD3D12.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200329 "src/dawn_native/d3d12/SamplerD3D12.cpp",
330 "src/dawn_native/d3d12/SamplerD3D12.h",
331 "src/dawn_native/d3d12/ShaderModuleD3D12.cpp",
332 "src/dawn_native/d3d12/ShaderModuleD3D12.h",
Bryan Bernhart74e95ff2019-01-29 00:10:07 +0000333 "src/dawn_native/d3d12/StagingBufferD3D12.cpp",
334 "src/dawn_native/d3d12/StagingBufferD3D12.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200335 "src/dawn_native/d3d12/SwapChainD3D12.cpp",
336 "src/dawn_native/d3d12/SwapChainD3D12.h",
337 "src/dawn_native/d3d12/TextureCopySplitter.cpp",
338 "src/dawn_native/d3d12/TextureCopySplitter.h",
339 "src/dawn_native/d3d12/TextureD3D12.cpp",
340 "src/dawn_native/d3d12/TextureD3D12.h",
Yan, Shaobo93158eb2019-01-04 04:56:08 +0000341 "src/dawn_native/d3d12/UtilsD3D12.cpp",
342 "src/dawn_native/d3d12/UtilsD3D12.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200343 "src/dawn_native/d3d12/d3d12_platform.h",
344 ]
345 }
346
347 if (dawn_enable_metal) {
348 libs += [
Corentin Wallez21a23852018-07-31 18:50:03 +0200349 "Cocoa.framework",
Li Hao813bfbd2018-11-29 10:54:03 +0000350 "IOKit.framework",
Corentin Wallez0cdf9e02019-03-01 12:01:18 +0000351 "IOSurface.framework",
Corentin Wallez3a1746e2020-01-15 13:14:12 +0000352 "QuartzCore.framework",
Corentin Wallez21a23852018-07-31 18:50:03 +0200353 ]
354 sources += [
Corentin Wallez3a1746e2020-01-15 13:14:12 +0000355 "src/dawn_native/Surface_metal.mm",
Corentin Wallez978fa65a2019-02-05 13:02:30 +0000356 "src/dawn_native/metal/BackendMTL.h",
357 "src/dawn_native/metal/BackendMTL.mm",
Corentin Wallez21a23852018-07-31 18:50:03 +0200358 "src/dawn_native/metal/BufferMTL.h",
359 "src/dawn_native/metal/BufferMTL.mm",
360 "src/dawn_native/metal/CommandBufferMTL.h",
361 "src/dawn_native/metal/CommandBufferMTL.mm",
Austin Eng0c66bcd2020-01-15 18:22:53 +0000362 "src/dawn_native/metal/CommandRecordingContext.h",
363 "src/dawn_native/metal/CommandRecordingContext.mm",
Corentin Wallez21a23852018-07-31 18:50:03 +0200364 "src/dawn_native/metal/ComputePipelineMTL.h",
365 "src/dawn_native/metal/ComputePipelineMTL.mm",
Corentin Wallez21a23852018-07-31 18:50:03 +0200366 "src/dawn_native/metal/DeviceMTL.h",
367 "src/dawn_native/metal/DeviceMTL.mm",
368 "src/dawn_native/metal/Forward.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200369 "src/dawn_native/metal/PipelineLayoutMTL.h",
370 "src/dawn_native/metal/PipelineLayoutMTL.mm",
371 "src/dawn_native/metal/QueueMTL.h",
372 "src/dawn_native/metal/QueueMTL.mm",
373 "src/dawn_native/metal/RenderPipelineMTL.h",
374 "src/dawn_native/metal/RenderPipelineMTL.mm",
Corentin Wallez21a23852018-07-31 18:50:03 +0200375 "src/dawn_native/metal/SamplerMTL.h",
376 "src/dawn_native/metal/SamplerMTL.mm",
377 "src/dawn_native/metal/ShaderModuleMTL.h",
378 "src/dawn_native/metal/ShaderModuleMTL.mm",
Bryan Bernhart67a73bd2019-02-15 21:18:40 +0000379 "src/dawn_native/metal/StagingBufferMTL.h",
380 "src/dawn_native/metal/StagingBufferMTL.mm",
Corentin Wallez21a23852018-07-31 18:50:03 +0200381 "src/dawn_native/metal/SwapChainMTL.h",
382 "src/dawn_native/metal/SwapChainMTL.mm",
383 "src/dawn_native/metal/TextureMTL.h",
384 "src/dawn_native/metal/TextureMTL.mm",
Yan, Shaobo93158eb2019-01-04 04:56:08 +0000385 "src/dawn_native/metal/UtilsMetal.h",
386 "src/dawn_native/metal/UtilsMetal.mm",
Corentin Wallez21a23852018-07-31 18:50:03 +0200387 ]
388 }
389
390 if (dawn_enable_null) {
391 sources += [
Corentin Wallez97d2a712019-01-09 08:35:16 +0000392 "src/dawn_native/null/DeviceNull.cpp",
393 "src/dawn_native/null/DeviceNull.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200394 ]
395 }
396
397 if (dawn_enable_opengl) {
Corentin Wallez23dd1242019-07-22 23:32:29 +0000398 public_deps += [
Corentin Wallezdf69f242019-06-13 10:22:32 +0000399 ":libdawn_native_opengl_loader_gen",
Corentin Wallez8f4046b2019-06-17 09:17:29 +0000400 "third_party:khronos_platform",
Corentin Wallezdf69f242019-06-13 10:22:32 +0000401 ]
402 sources += get_target_outputs(":libdawn_native_opengl_loader_gen")
Corentin Wallez21a23852018-07-31 18:50:03 +0200403 sources += [
Corentin Wallez90e594e2019-01-07 09:48:03 +0000404 "src/dawn_native/opengl/BackendGL.cpp",
405 "src/dawn_native/opengl/BackendGL.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200406 "src/dawn_native/opengl/BufferGL.cpp",
407 "src/dawn_native/opengl/BufferGL.h",
408 "src/dawn_native/opengl/CommandBufferGL.cpp",
409 "src/dawn_native/opengl/CommandBufferGL.h",
410 "src/dawn_native/opengl/ComputePipelineGL.cpp",
411 "src/dawn_native/opengl/ComputePipelineGL.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200412 "src/dawn_native/opengl/DeviceGL.cpp",
413 "src/dawn_native/opengl/DeviceGL.h",
414 "src/dawn_native/opengl/Forward.h",
Corentin Wallez4e3b2182019-07-23 06:40:54 +0000415 "src/dawn_native/opengl/GLFormat.cpp",
416 "src/dawn_native/opengl/GLFormat.h",
Corentin Wallezabdb5662019-06-17 09:01:09 +0000417 "src/dawn_native/opengl/NativeSwapChainImplGL.cpp",
418 "src/dawn_native/opengl/NativeSwapChainImplGL.h",
Corentin Wallezdf69f242019-06-13 10:22:32 +0000419 "src/dawn_native/opengl/OpenGLFunctions.cpp",
420 "src/dawn_native/opengl/OpenGLFunctions.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200421 "src/dawn_native/opengl/PersistentPipelineStateGL.cpp",
422 "src/dawn_native/opengl/PersistentPipelineStateGL.h",
423 "src/dawn_native/opengl/PipelineGL.cpp",
424 "src/dawn_native/opengl/PipelineGL.h",
425 "src/dawn_native/opengl/PipelineLayoutGL.cpp",
426 "src/dawn_native/opengl/PipelineLayoutGL.h",
427 "src/dawn_native/opengl/QueueGL.cpp",
428 "src/dawn_native/opengl/QueueGL.h",
429 "src/dawn_native/opengl/RenderPipelineGL.cpp",
430 "src/dawn_native/opengl/RenderPipelineGL.h",
431 "src/dawn_native/opengl/SamplerGL.cpp",
432 "src/dawn_native/opengl/SamplerGL.h",
433 "src/dawn_native/opengl/ShaderModuleGL.cpp",
434 "src/dawn_native/opengl/ShaderModuleGL.h",
435 "src/dawn_native/opengl/SwapChainGL.cpp",
436 "src/dawn_native/opengl/SwapChainGL.h",
437 "src/dawn_native/opengl/TextureGL.cpp",
438 "src/dawn_native/opengl/TextureGL.h",
Yan, Shaobo93158eb2019-01-04 04:56:08 +0000439 "src/dawn_native/opengl/UtilsGL.cpp",
440 "src/dawn_native/opengl/UtilsGL.h",
Corentin Wallez8f4046b2019-06-17 09:17:29 +0000441 "src/dawn_native/opengl/opengl_platform.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200442 ]
443 }
444
445 if (dawn_enable_vulkan) {
Corentin Wallez23dd1242019-07-22 23:32:29 +0000446 public_deps += [ "third_party:vulkan_headers" ]
Corentin Wallez21a23852018-07-31 18:50:03 +0200447 sources += [
Corentin Wallezd1be0e72019-02-04 09:31:09 +0000448 "src/dawn_native/vulkan/AdapterVk.cpp",
449 "src/dawn_native/vulkan/AdapterVk.h",
450 "src/dawn_native/vulkan/BackendVk.cpp",
451 "src/dawn_native/vulkan/BackendVk.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200452 "src/dawn_native/vulkan/BindGroupLayoutVk.cpp",
453 "src/dawn_native/vulkan/BindGroupLayoutVk.h",
454 "src/dawn_native/vulkan/BindGroupVk.cpp",
455 "src/dawn_native/vulkan/BindGroupVk.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200456 "src/dawn_native/vulkan/BufferVk.cpp",
457 "src/dawn_native/vulkan/BufferVk.h",
458 "src/dawn_native/vulkan/CommandBufferVk.cpp",
459 "src/dawn_native/vulkan/CommandBufferVk.h",
Corentin Wallez897ebc72019-09-18 04:33:12 +0000460 "src/dawn_native/vulkan/CommandRecordingContext.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200461 "src/dawn_native/vulkan/ComputePipelineVk.cpp",
462 "src/dawn_native/vulkan/ComputePipelineVk.h",
Corentin Wallez0558f992019-11-05 15:44:05 +0000463 "src/dawn_native/vulkan/DescriptorSetService.cpp",
464 "src/dawn_native/vulkan/DescriptorSetService.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200465 "src/dawn_native/vulkan/DeviceVk.cpp",
466 "src/dawn_native/vulkan/DeviceVk.h",
Idan Raiter74e48342019-08-10 03:17:52 +0000467 "src/dawn_native/vulkan/ExternalHandle.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200468 "src/dawn_native/vulkan/FencedDeleter.cpp",
469 "src/dawn_native/vulkan/FencedDeleter.h",
470 "src/dawn_native/vulkan/Forward.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200471 "src/dawn_native/vulkan/NativeSwapChainImplVk.cpp",
472 "src/dawn_native/vulkan/NativeSwapChainImplVk.h",
473 "src/dawn_native/vulkan/PipelineLayoutVk.cpp",
474 "src/dawn_native/vulkan/PipelineLayoutVk.h",
475 "src/dawn_native/vulkan/QueueVk.cpp",
476 "src/dawn_native/vulkan/QueueVk.h",
477 "src/dawn_native/vulkan/RenderPassCache.cpp",
478 "src/dawn_native/vulkan/RenderPassCache.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200479 "src/dawn_native/vulkan/RenderPipelineVk.cpp",
480 "src/dawn_native/vulkan/RenderPipelineVk.h",
Corentin Wallez60a04dd2019-10-24 21:24:27 +0000481 "src/dawn_native/vulkan/ResourceHeapVk.cpp",
482 "src/dawn_native/vulkan/ResourceHeapVk.h",
483 "src/dawn_native/vulkan/ResourceMemoryAllocatorVk.cpp",
484 "src/dawn_native/vulkan/ResourceMemoryAllocatorVk.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200485 "src/dawn_native/vulkan/SamplerVk.cpp",
486 "src/dawn_native/vulkan/SamplerVk.h",
487 "src/dawn_native/vulkan/ShaderModuleVk.cpp",
488 "src/dawn_native/vulkan/ShaderModuleVk.h",
Bryan Bernhart96e19112019-02-06 18:10:12 +0000489 "src/dawn_native/vulkan/StagingBufferVk.cpp",
490 "src/dawn_native/vulkan/StagingBufferVk.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200491 "src/dawn_native/vulkan/SwapChainVk.cpp",
492 "src/dawn_native/vulkan/SwapChainVk.h",
493 "src/dawn_native/vulkan/TextureVk.cpp",
494 "src/dawn_native/vulkan/TextureVk.h",
Yan, Shaobo93158eb2019-01-04 04:56:08 +0000495 "src/dawn_native/vulkan/UtilsVulkan.cpp",
496 "src/dawn_native/vulkan/UtilsVulkan.h",
Corentin Walleze9212df2019-01-04 10:18:40 +0000497 "src/dawn_native/vulkan/VulkanError.cpp",
498 "src/dawn_native/vulkan/VulkanError.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200499 "src/dawn_native/vulkan/VulkanFunctions.cpp",
500 "src/dawn_native/vulkan/VulkanFunctions.h",
501 "src/dawn_native/vulkan/VulkanInfo.cpp",
502 "src/dawn_native/vulkan/VulkanInfo.h",
Idan Raiter74e48342019-08-10 03:17:52 +0000503 "src/dawn_native/vulkan/external_memory/MemoryService.h",
504 "src/dawn_native/vulkan/external_semaphore/SemaphoreService.h",
Corentin Wallez21a23852018-07-31 18:50:03 +0200505 ]
Idan Raiter74e48342019-08-10 03:17:52 +0000506
Brian Ho899c1702019-11-21 16:02:10 +0000507 if (is_chromeos) {
508 sources += [
509 "src/dawn_native/vulkan/external_memory/MemoryServiceDmaBuf.cpp",
510 "src/dawn_native/vulkan/external_semaphore/SemaphoreServiceOpaqueFD.cpp",
511 ]
512 } else if (is_linux) {
Idan Raiter74e48342019-08-10 03:17:52 +0000513 sources += [
514 "src/dawn_native/vulkan/external_memory/MemoryServiceOpaqueFD.cpp",
515 "src/dawn_native/vulkan/external_semaphore/SemaphoreServiceOpaqueFD.cpp",
516 ]
David 'Digit' Turnerfa00c692019-09-10 10:07:28 +0000517 } else if (is_fuchsia) {
518 sources += [
519 "src/dawn_native/vulkan/external_memory/MemoryServiceZirconHandle.cpp",
520 "src/dawn_native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp",
521 ]
Idan Raiter74e48342019-08-10 03:17:52 +0000522 } else {
523 sources += [
524 "src/dawn_native/vulkan/external_memory/MemoryServiceNull.cpp",
525 "src/dawn_native/vulkan/external_semaphore/SemaphoreServiceNull.cpp",
526 ]
527 }
David 'Digit' Turnerb749d072019-09-09 10:52:08 +0000528 if (build_with_chromium && is_fuchsia) {
529 # Necessary to ensure that the Vulkan libraries will be in the
530 # final Fuchsia package.
531 data_deps = [
532 # NOTE: The line below is a work around for http://crbug.com/1001081
533 "//third_party/fuchsia-sdk/sdk:trace_engine",
534 "//third_party/fuchsia-sdk:vulkan_base",
535 "//third_party/fuchsia-sdk:vulkan_validation",
536 ]
537 }
Li, Hao0e1bef32019-11-07 12:13:27 +0000538 if (dawn_enable_vulkan_validation_layers) {
Ryan Harrison8f3dc582019-11-20 18:10:11 +0000539 defines += [
Li, Hao0e1bef32019-11-07 12:13:27 +0000540 "DAWN_ENABLE_VULKAN_VALIDATION_LAYERS",
541 "DAWN_VK_DATA_DIR=\"$vulkan_data_subdir\"",
542 ]
543 }
Corentin Wallez74cebd62019-11-26 18:21:51 +0000544
545 if (use_swiftshader) {
Austin Eng636e6ce2020-01-16 00:34:30 +0000546 data_deps += [
547 "${dawn_swiftshader_dir}/src/Vulkan:icd_file",
548 "${dawn_swiftshader_dir}/src/Vulkan:swiftshader_libvulkan",
549 ]
550 defines += [
551 "DAWN_ENABLE_SWIFTSHADER",
552 "DAWN_SWIFTSHADER_VK_ICD_JSON=\"${swiftshader_icd_file_name}\"",
553 ]
Corentin Wallez74cebd62019-11-26 18:21:51 +0000554 }
Corentin Wallez21a23852018-07-31 18:50:03 +0200555 }
Corentin Wallez3a1746e2020-01-15 13:14:12 +0000556
557 if (dawn_use_x11) {
558 libs += [ "X11" ]
559 }
Corentin Wallez21a23852018-07-31 18:50:03 +0200560}
561
Corentin Wallezbd483852019-01-09 09:05:18 +0000562# The static and shared libraries for libdawn_native. Most of the files are
563# already compiled in libdawn_native_sources, but we still need to compile
564# files defining exported symbols.
Corentin Wallezda8ee832019-01-25 03:20:20 +0000565dawn_component("libdawn_native") {
Corentin Wallezbd483852019-01-09 09:05:18 +0000566 DEFINE_PREFIX = "DAWN_NATIVE"
Corentin Wallezd2969a72018-08-12 21:07:46 +0200567
568 #Make headers publically visible
569 public_deps = [
570 ":libdawn_native_headers",
571 ]
Corentin Wallez649e2fe2018-08-03 15:57:43 +0200572
Corentin Wallezbd483852019-01-09 09:05:18 +0000573 deps = [
Austin Engc7f416c2019-01-15 20:49:53 +0000574 ":libdawn_native_sources",
Corentin Wallez579cf622019-03-07 01:46:39 +0000575 "${dawn_root}/src/common",
Corentin Wallezbd483852019-01-09 09:05:18 +0000576 ]
577 sources = [
578 "src/dawn_native/DawnNative.cpp",
579 ]
580 configs = [ ":libdawn_native_internal" ]
Pawel Pluciennik20b41622019-10-24 09:44:13 +0000581 public_configs = [ ":libdawn_native_weak_framework" ]
Corentin Wallezbd483852019-01-09 09:05:18 +0000582
583 if (dawn_enable_d3d12) {
584 sources += [ "src/dawn_native/d3d12/D3D12Backend.cpp" ]
585 }
586 if (dawn_enable_metal) {
587 sources += [ "src/dawn_native/metal/MetalBackend.mm" ]
588 }
589 if (dawn_enable_null) {
590 sources += [ "src/dawn_native/null/NullBackend.cpp" ]
591 }
592 if (dawn_enable_opengl) {
593 sources += [ "src/dawn_native/opengl/OpenGLBackend.cpp" ]
Corentin Wallezbd483852019-01-09 09:05:18 +0000594 }
595 if (dawn_enable_vulkan) {
596 sources += [ "src/dawn_native/vulkan/VulkanBackend.cpp" ]
Li, Hao0e1bef32019-11-07 12:13:27 +0000597
598 if (dawn_enable_vulkan_validation_layers) {
599 data_deps = [
600 "${dawn_vulkan_validation_layers_dir}:vulkan_validation_layers",
601 ]
602 if (!is_android) {
603 data_deps +=
604 [ "${dawn_vulkan_validation_layers_dir}:vulkan_gen_json_files" ]
605 }
606 }
Corentin Wallez649e2fe2018-08-03 15:57:43 +0200607 }
Corentin Wallez21a23852018-07-31 18:50:03 +0200608}
609
Corentin Wallez21a23852018-07-31 18:50:03 +0200610###############################################################################
Corentin Wallezbd483852019-01-09 09:05:18 +0000611# libdawn_wire
Corentin Wallez21a23852018-07-31 18:50:03 +0200612###############################################################################
613
Corentin Wallez031fbbb2019-06-11 18:03:05 +0000614dawn_json_generator("libdawn_wire_gen") {
Corentin Wallez21a23852018-07-31 18:50:03 +0200615 target = "dawn_wire"
Corentin Wallez59e7fad2018-08-16 15:32:35 +0200616 outputs = [
Corentin Wallez897ebc72019-09-18 04:33:12 +0000617 "src/dawn_wire/WireCmd_autogen.h",
618 "src/dawn_wire/WireCmd_autogen.cpp",
619 "src/dawn_wire/client/ApiObjects_autogen.h",
620 "src/dawn_wire/client/ApiProcs_autogen.cpp",
621 "src/dawn_wire/client/ApiProcs_autogen.h",
622 "src/dawn_wire/client/ClientBase_autogen.h",
623 "src/dawn_wire/client/ClientHandlers_autogen.cpp",
624 "src/dawn_wire/client/ClientPrototypes_autogen.inc",
625 "src/dawn_wire/server/ServerBase_autogen.h",
626 "src/dawn_wire/server/ServerDoers_autogen.cpp",
627 "src/dawn_wire/server/ServerHandlers_autogen.cpp",
628 "src/dawn_wire/server/ServerPrototypes_autogen.inc",
Corentin Wallez21a23852018-07-31 18:50:03 +0200629 ]
630}
631
Corentin Wallezda8ee832019-01-25 03:20:20 +0000632dawn_component("libdawn_wire") {
Corentin Wallezbd483852019-01-09 09:05:18 +0000633 DEFINE_PREFIX = "DAWN_WIRE"
634
Corentin Wallez21a23852018-07-31 18:50:03 +0200635 deps = [
Corentin Wallez59e7fad2018-08-16 15:32:35 +0200636 ":libdawn_wire_gen",
Corentin Wallez579cf622019-03-07 01:46:39 +0000637 "${dawn_root}/src/common",
Austin Eng8c1a90192019-03-08 00:51:27 +0000638 "${dawn_root}/src/dawn_wire:libdawn_wire_headers",
Corentin Wallez21a23852018-07-31 18:50:03 +0200639 ]
Corentin Wallezd2969a72018-08-12 21:07:46 +0200640
Corentin Wallez579cf622019-03-07 01:46:39 +0000641 configs = [ "${dawn_root}/src/common:dawn_internal" ]
Corentin Wallez59e7fad2018-08-16 15:32:35 +0200642 sources = get_target_outputs(":libdawn_wire_gen")
Austin Engc7f416c2019-01-15 20:49:53 +0000643 sources += [
Austin Enge2c85132019-02-11 21:50:16 +0000644 "src/dawn_wire/WireClient.cpp",
Austin Engc7f416c2019-01-15 20:49:53 +0000645 "src/dawn_wire/WireDeserializeAllocator.cpp",
646 "src/dawn_wire/WireDeserializeAllocator.h",
Austin Enge2c85132019-02-11 21:50:16 +0000647 "src/dawn_wire/WireServer.cpp",
Austin Engacd8b7d2019-01-16 02:18:06 +0000648 "src/dawn_wire/client/ApiObjects.h",
649 "src/dawn_wire/client/ApiProcs.cpp",
650 "src/dawn_wire/client/Buffer.cpp",
651 "src/dawn_wire/client/Buffer.h",
652 "src/dawn_wire/client/Client.cpp",
653 "src/dawn_wire/client/Client.h",
Austin Eng1139d1c2019-01-30 03:00:17 +0000654 "src/dawn_wire/client/ClientDoers.cpp",
Austin Eng6a5418a2019-07-19 16:01:48 +0000655 "src/dawn_wire/client/ClientInlineMemoryTransferService.cpp",
Austin Engcd4fd8e2019-01-30 02:31:37 +0000656 "src/dawn_wire/client/Device.cpp",
657 "src/dawn_wire/client/Device.h",
Austin Engacd8b7d2019-01-16 02:18:06 +0000658 "src/dawn_wire/client/Fence.cpp",
659 "src/dawn_wire/client/Fence.h",
660 "src/dawn_wire/client/ObjectAllocator.h",
Austin Engfd4688e2019-01-30 02:20:58 +0000661 "src/dawn_wire/server/ObjectStorage.h",
662 "src/dawn_wire/server/Server.cpp",
663 "src/dawn_wire/server/Server.h",
664 "src/dawn_wire/server/ServerBuffer.cpp",
665 "src/dawn_wire/server/ServerDevice.cpp",
666 "src/dawn_wire/server/ServerFence.cpp",
Austin Eng6a5418a2019-07-19 16:01:48 +0000667 "src/dawn_wire/server/ServerInlineMemoryTransferService.cpp",
Austin Engfd4688e2019-01-30 02:20:58 +0000668 "src/dawn_wire/server/ServerQueue.cpp",
Austin Engc7f416c2019-01-15 20:49:53 +0000669 ]
Corentin Wallez59e7fad2018-08-16 15:32:35 +0200670
Corentin Wallez2ec59d92018-11-14 21:04:26 +0000671 # Make headers publically visible
672 public_deps = [
Austin Eng8c1a90192019-03-08 00:51:27 +0000673 "${dawn_root}/src/dawn_wire:libdawn_wire_headers",
Corentin Wallez2ec59d92018-11-14 21:04:26 +0000674 ]
Corentin Wallez649e2fe2018-08-03 15:57:43 +0200675}
676
677###############################################################################
David 'Digit' Turnerb749d072019-09-09 10:52:08 +0000678# GLFW wrapping target
679###############################################################################
680
Corentin Wallez3a1746e2020-01-15 13:14:12 +0000681supports_glfw_for_windowing = is_win || (is_linux && !is_chromeos) || is_mac
682
Corentin Wallezfad96f62019-09-11 16:53:46 +0000683# GLFW does not support ChromeOS, Android or Fuchsia, so provide a small mock
684# library that can be linked into the Dawn tests on these platforms. Otherwise,
685# use the real library from third_party/.
Corentin Wallez3a1746e2020-01-15 13:14:12 +0000686if (supports_glfw_for_windowing) {
Corentin Wallezfad96f62019-09-11 16:53:46 +0000687 group("dawn_glfw") {
688 public_deps = [
689 "third_party:glfw",
690 ]
691 }
692} else if (is_fuchsia) {
693 # The mock implementation of GLFW on Fuchsia
David 'Digit' Turnerb749d072019-09-09 10:52:08 +0000694 config("dawn_glfw_public_config") {
695 # Allow inclusion of <GLFW/glfw3.h>
David 'Digit' Turner47f3b0d2019-09-12 12:50:31 +0000696 include_dirs = [ "${dawn_glfw_dir}/include" ]
697
David 'Digit' Turnerb749d072019-09-09 10:52:08 +0000698 # The GLFW/glfw3.h header includes <GL/gl.h> by default, but the latter
699 # does not exist on Fuchsia. Defining GLFW_INCLUDE_NONE helps work around
700 # the issue, but it needs to be defined for any file that includes the
701 # header.
702 defines = [
703 "GLFW_INCLUDE_NONE",
704 "GLFW_INCLUDE_VULKAN",
705 ]
706 }
707
708 static_library("dawn_glfw") {
709 sources = [
710 # NOTE: The header below is required to pass "gn check".
711 "${dawn_glfw_dir}/include/GLFW/glfw3.h",
712 "src/utils/Glfw3Fuchsia.cpp",
713 ]
714 public_configs = [ ":dawn_glfw_public_config" ]
715 deps = [
716 "${dawn_root}/src/common",
717 ]
718 }
719} else {
Corentin Wallezfad96f62019-09-11 16:53:46 +0000720 # Just skip GLFW on other systems
David 'Digit' Turnerb749d072019-09-09 10:52:08 +0000721 group("dawn_glfw") {
David 'Digit' Turnerb749d072019-09-09 10:52:08 +0000722 }
723}
724
725###############################################################################
Corentin Wallez649e2fe2018-08-03 15:57:43 +0200726# Utils for tests and samples
727###############################################################################
728
729static_library("dawn_utils") {
Corentin Wallez579cf622019-03-07 01:46:39 +0000730 configs += [ "${dawn_root}/src/common:dawn_internal" ]
Corentin Wallez649e2fe2018-08-03 15:57:43 +0200731
732 sources = [
Austin Eng8a488c12019-08-13 22:12:54 +0000733 "src/utils/ComboRenderBundleEncoderDescriptor.cpp",
734 "src/utils/ComboRenderBundleEncoderDescriptor.h",
Yan, Shaoboa4924272018-12-10 19:47:22 +0000735 "src/utils/ComboRenderPipelineDescriptor.cpp",
736 "src/utils/ComboRenderPipelineDescriptor.h",
Corentin Wallez649e2fe2018-08-03 15:57:43 +0200737 "src/utils/SystemUtils.cpp",
738 "src/utils/SystemUtils.h",
739 "src/utils/TerribleCommandBuffer.cpp",
740 "src/utils/TerribleCommandBuffer.h",
Austin Engca0eac32019-08-28 23:18:10 +0000741 "src/utils/Timer.h",
Corentin Wallez04863c42019-10-25 11:36:47 +0000742 "src/utils/WGPUHelpers.cpp",
743 "src/utils/WGPUHelpers.h",
Corentin Wallez649e2fe2018-08-03 15:57:43 +0200744 ]
Corentin Wallez649e2fe2018-08-03 15:57:43 +0200745 deps = [
Corentin Wallez649e2fe2018-08-03 15:57:43 +0200746 ":libdawn_native",
Corentin Wallezd2969a72018-08-12 21:07:46 +0200747 ":libdawn_wire",
Corentin Wallez579cf622019-03-07 01:46:39 +0000748 "${dawn_root}/src/common",
Corentin Wallez16092fa2018-10-04 17:17:57 +0000749 "${dawn_shaderc_dir}:libshaderc",
Brian Ho2fb628d2019-08-13 21:45:44 +0000750 ]
Corentin Wallez3a1746e2020-01-15 13:14:12 +0000751 libs = []
752
753 if (is_win) {
754 sources += [ "src/utils/WindowsTimer.cpp" ]
755 } else if (is_mac) {
756 sources += [
757 "src/utils/OSXTimer.cpp",
758 "src/utils/ObjCUtils.h",
759 "src/utils/ObjCUtils.mm",
760 ]
761 libs += [ "QuartzCore.framework" ]
762 } else {
763 sources += [ "src/utils/PosixTimer.cpp" ]
764 }
765
766 if (supports_glfw_for_windowing) {
767 sources += [
768 "src/utils/GLFWUtils.cpp",
769 "src/utils/GLFWUtils.h",
770 ]
771 deps += [ ":dawn_glfw" ]
772
773 if (dawn_enable_metal) {
774 sources += [ "src/utils/GLFWUtils_metal.mm" ]
775 libs += [ "Metal.framework" ]
776 }
777 }
778
779 public_deps = [
780 "${dawn_root}/src/dawn:dawncpp_headers",
781 ]
Brian Ho2fb628d2019-08-13 21:45:44 +0000782}
783
Corentin Wallez649e2fe2018-08-03 15:57:43 +0200784###############################################################################
785# Dawn test targets
786###############################################################################
787
Corentin Wallez45b51f52019-10-28 22:15:47 +0000788dawn_json_generator("mock_webgpu_gen") {
789 target = "mock_webgpu"
Corentin Wallez48a19232018-12-08 10:35:53 +0000790 outputs = [
Corentin Wallez45b51f52019-10-28 22:15:47 +0000791 "src/dawn/mock_webgpu.h",
792 "src/dawn/mock_webgpu.cpp",
Corentin Wallez649e2fe2018-08-03 15:57:43 +0200793 ]
794}
795
Corentin Wallez48a19232018-12-08 10:35:53 +0000796test("dawn_unittests") {
Corentin Wallez579cf622019-03-07 01:46:39 +0000797 configs += [ "${dawn_root}/src/common:dawn_internal" ]
Corentin Wallez48a19232018-12-08 10:35:53 +0000798
Corentin Wallez649e2fe2018-08-03 15:57:43 +0200799 deps = [
Corentin Wallez48a19232018-12-08 10:35:53 +0000800 ":dawn_utils",
Corentin Wallezbd483852019-01-09 09:05:18 +0000801 ":libdawn_native",
Austin Engc7f416c2019-01-15 20:49:53 +0000802 ":libdawn_native_sources",
Corentin Wallez48a19232018-12-08 10:35:53 +0000803 ":libdawn_wire",
Corentin Wallez45b51f52019-10-28 22:15:47 +0000804 ":mock_webgpu_gen",
Corentin Wallez579cf622019-03-07 01:46:39 +0000805 "${dawn_root}/src/common",
Corentin Wallez96496822019-10-15 11:44:38 +0000806 "${dawn_root}/src/dawn:dawncpp",
807 "${dawn_root}/src/dawn:libdawn_proc",
Corentin Wallez48a19232018-12-08 10:35:53 +0000808 "third_party:gmock_and_gtest",
Corentin Wallez649e2fe2018-08-03 15:57:43 +0200809 ]
Corentin Wallez48a19232018-12-08 10:35:53 +0000810
811 # Add internal Dawn Native headers and config for internal unittests.
812 deps += [ ":libdawn_native_headers" ]
813 configs += [ ":libdawn_native_internal" ]
814
Corentin Wallez45b51f52019-10-28 22:15:47 +0000815 sources = get_target_outputs(":mock_webgpu_gen")
Corentin Wallez48a19232018-12-08 10:35:53 +0000816 sources += [
Austin Eng72724b82019-07-19 16:16:58 +0000817 "src/dawn_wire/client/ClientMemoryTransferService_mock.cpp",
818 "src/dawn_wire/client/ClientMemoryTransferService_mock.h",
819 "src/dawn_wire/server/ServerMemoryTransferService_mock.cpp",
820 "src/dawn_wire/server/ServerMemoryTransferService_mock.h",
Corentin Wallez48a19232018-12-08 10:35:53 +0000821 "src/tests/unittests/BitSetIteratorTests.cpp",
Bryan Bernhart35ad5222019-07-30 16:46:10 +0000822 "src/tests/unittests/BuddyAllocatorTests.cpp",
Bryan Bernhart21dfc912019-10-03 18:17:31 +0000823 "src/tests/unittests/BuddyMemoryAllocatorTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000824 "src/tests/unittests/CommandAllocatorTests.cpp",
825 "src/tests/unittests/EnumClassBitmasksTests.cpp",
826 "src/tests/unittests/ErrorTests.cpp",
Jiawei Shao574b9512019-08-02 00:06:38 +0000827 "src/tests/unittests/ExtensionTests.cpp",
Corentin Wallezc57b1802019-10-15 12:08:48 +0000828 "src/tests/unittests/GetProcAddressTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000829 "src/tests/unittests/MathTests.cpp",
830 "src/tests/unittests/ObjectBaseTests.cpp",
831 "src/tests/unittests/PerStageTests.cpp",
832 "src/tests/unittests/RefCountedTests.cpp",
833 "src/tests/unittests/ResultTests.cpp",
Bryan Bernhart450e2122019-09-18 22:06:41 +0000834 "src/tests/unittests/RingBufferAllocatorTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000835 "src/tests/unittests/SerialMapTests.cpp",
836 "src/tests/unittests/SerialQueueTests.cpp",
Li, Hao0e1bef32019-11-07 12:13:27 +0000837 "src/tests/unittests/SystemUtilsTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000838 "src/tests/unittests/ToBackendTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000839 "src/tests/unittests/validation/BindGroupValidationTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000840 "src/tests/unittests/validation/BufferValidationTests.cpp",
841 "src/tests/unittests/validation/CommandBufferValidationTests.cpp",
Idan Raiter05f7ad52019-06-10 20:56:27 +0000842 "src/tests/unittests/validation/ComputeIndirectValidationTests.cpp",
Austin Eng7b3cc352019-10-22 17:28:20 +0000843 "src/tests/unittests/validation/ComputePassValidationTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000844 "src/tests/unittests/validation/ComputeValidationTests.cpp",
845 "src/tests/unittests/validation/CopyCommandsValidationTests.cpp",
Brandon Jones11d32c82019-02-20 20:21:00 +0000846 "src/tests/unittests/validation/DebugMarkerValidationTests.cpp",
Idan Raiter05f7ad52019-06-10 20:56:27 +0000847 "src/tests/unittests/validation/DrawIndirectValidationTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000848 "src/tests/unittests/validation/DynamicStateCommandValidationTests.cpp",
Austin Engf35dcfe2019-09-10 23:19:11 +0000849 "src/tests/unittests/validation/ErrorScopeValidationTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000850 "src/tests/unittests/validation/FenceValidationTests.cpp",
Austin Engf6eb8902019-11-22 17:02:22 +0000851 "src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000852 "src/tests/unittests/validation/QueueSubmitValidationTests.cpp",
Austin Eng8a488c12019-08-13 22:12:54 +0000853 "src/tests/unittests/validation/RenderBundleValidationTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000854 "src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp",
Austin Eng27a294c2019-03-28 15:28:01 +0000855 "src/tests/unittests/validation/RenderPassValidationTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000856 "src/tests/unittests/validation/RenderPipelineValidationTests.cpp",
Idan Raiter1c859762019-05-22 17:18:52 +0000857 "src/tests/unittests/validation/SamplerValidationTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000858 "src/tests/unittests/validation/ShaderModuleValidationTests.cpp",
Jiawei Shao8bff3b22018-12-12 09:27:16 +0000859 "src/tests/unittests/validation/TextureValidationTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000860 "src/tests/unittests/validation/TextureViewValidationTests.cpp",
Jiawei Shao15d4c2e2019-04-26 07:52:57 +0000861 "src/tests/unittests/validation/ToggleValidationTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000862 "src/tests/unittests/validation/ValidationTest.cpp",
863 "src/tests/unittests/validation/ValidationTest.h",
864 "src/tests/unittests/validation/VertexBufferValidationTests.cpp",
Kai Ninomiyaae1f25f2019-11-07 22:23:29 +0000865 "src/tests/unittests/validation/VertexStateValidationTests.cpp",
Austin Eng11982702019-02-14 18:47:07 +0000866 "src/tests/unittests/wire/WireArgumentTests.cpp",
867 "src/tests/unittests/wire/WireBasicTests.cpp",
868 "src/tests/unittests/wire/WireBufferMappingTests.cpp",
Corentin Wallez0ae00a12019-03-28 17:12:47 +0000869 "src/tests/unittests/wire/WireErrorCallbackTests.cpp",
Austin Eng11982702019-02-14 18:47:07 +0000870 "src/tests/unittests/wire/WireFenceTests.cpp",
Corentin Wallez339bd9d2019-03-28 12:57:11 +0000871 "src/tests/unittests/wire/WireInjectTextureTests.cpp",
Austin Eng72724b82019-07-19 16:16:58 +0000872 "src/tests/unittests/wire/WireMemoryTransferServiceTests.cpp",
Austin Eng11982702019-02-14 18:47:07 +0000873 "src/tests/unittests/wire/WireOptionalTests.cpp",
874 "src/tests/unittests/wire/WireTest.cpp",
875 "src/tests/unittests/wire/WireTest.h",
Corentin Wallez1fdcb162019-10-24 22:27:27 +0000876 "src/tests/unittests/wire/WireWGPUDevicePropertiesTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000877 ]
878
879 if (dawn_enable_d3d12) {
880 sources += [ "src/tests/unittests/d3d12/CopySplitTests.cpp" ]
881 }
882
883 # When building inside Chromium, use their gtest main function because it is
884 # needed to run in swarming correctly.
885 if (build_with_chromium) {
886 sources += [ "//gpu/dawn_unittests_main.cc" ]
887 } else {
888 sources += [ "src/tests/UnittestsMain.cpp" ]
889 }
890}
891
Idan Raiter74e48342019-08-10 03:17:52 +0000892source_set("dawn_end2end_tests_sources") {
Corentin Wallez579cf622019-03-07 01:46:39 +0000893 configs += [ "${dawn_root}/src/common:dawn_internal" ]
Idan Raiter74e48342019-08-10 03:17:52 +0000894 testonly = true
Corentin Wallez48a19232018-12-08 10:35:53 +0000895
896 deps = [
Corentin Wallez48a19232018-12-08 10:35:53 +0000897 ":dawn_utils",
Corentin Wallez48a19232018-12-08 10:35:53 +0000898 ":libdawn_native",
899 ":libdawn_wire",
Corentin Wallez579cf622019-03-07 01:46:39 +0000900 "${dawn_root}/src/common",
Corentin Wallez96496822019-10-15 11:44:38 +0000901 "${dawn_root}/src/dawn:dawncpp",
902 "${dawn_root}/src/dawn:libdawn_proc",
Corentin Wallez48a19232018-12-08 10:35:53 +0000903 "third_party:gmock_and_gtest",
904 ]
905
906 sources = [
Corentin Wallez48a19232018-12-08 10:35:53 +0000907 "src/tests/DawnTest.h",
908 "src/tests/end2end/BasicTests.cpp",
909 "src/tests/end2end/BindGroupTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000910 "src/tests/end2end/BufferTests.cpp",
Jiawei Shao5490e9a2019-03-27 00:01:33 +0000911 "src/tests/end2end/ClipSpaceTests.cpp",
Yunchao He77752582019-02-16 02:27:30 +0000912 "src/tests/end2end/ColorStateTests.cpp",
Jiawei Shao72508d62019-07-02 23:55:55 +0000913 "src/tests/end2end/CompressedTextureFormatTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000914 "src/tests/end2end/ComputeCopyStorageBufferTests.cpp",
Idan Raiter05f7ad52019-06-10 20:56:27 +0000915 "src/tests/end2end/ComputeIndirectTests.cpp",
Kai Ninomiya8e97b4c2019-04-26 02:08:12 +0000916 "src/tests/end2end/ComputeSharedMemoryTests.cpp",
Austin Eng7b3cc352019-10-22 17:28:20 +0000917 "src/tests/end2end/ComputeStorageBufferBarrierTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000918 "src/tests/end2end/CopyTests.cpp",
Yunchao Hed2631f82019-07-06 00:11:10 +0000919 "src/tests/end2end/CullingTests.cpp",
Brandon Jones11d32c82019-02-20 20:21:00 +0000920 "src/tests/end2end/DebugMarkerTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000921 "src/tests/end2end/DepthStencilStateTests.cpp",
Natasha Leecae68ff2019-03-27 22:04:10 +0000922 "src/tests/end2end/DestroyTests.cpp",
Natasha Lee0ecc48e2020-01-15 19:02:13 +0000923 "src/tests/end2end/DeviceLostTests.cpp",
Idan Raiter05f7ad52019-06-10 20:56:27 +0000924 "src/tests/end2end/DrawIndexedIndirectTests.cpp",
Jiawei Shaoff9562f2018-12-13 01:05:26 +0000925 "src/tests/end2end/DrawIndexedTests.cpp",
Idan Raiter05f7ad52019-06-10 20:56:27 +0000926 "src/tests/end2end/DrawIndirectTests.cpp",
Li Hao45da8c02019-01-30 09:01:08 +0000927 "src/tests/end2end/DrawTests.cpp",
Yan, Shaobo34f2fe82019-05-23 00:45:12 +0000928 "src/tests/end2end/DynamicBufferOffsetTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000929 "src/tests/end2end/FenceTests.cpp",
Yunchao He612a63a2019-11-18 04:28:24 +0000930 "src/tests/end2end/GpuMemorySynchronizationTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000931 "src/tests/end2end/IndexFormatTests.cpp",
Jiawei Shao0bc168e2019-03-28 14:18:11 +0000932 "src/tests/end2end/MultisampledRenderingTests.cpp",
Natasha Lee97f08fa2019-05-11 00:21:50 +0000933 "src/tests/end2end/NonzeroTextureCreationTests.cpp",
Corentin Wallez0ee98592019-05-01 12:57:27 +0000934 "src/tests/end2end/ObjectCachingTests.cpp",
Corentin Wallezbfc9cee2019-08-02 18:15:08 +0000935 "src/tests/end2end/OpArrayLengthTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000936 "src/tests/end2end/PrimitiveTopologyTests.cpp",
Austin Eng40618d02019-08-14 02:01:14 +0000937 "src/tests/end2end/RenderBundleTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000938 "src/tests/end2end/RenderPassLoadOpTests.cpp",
Jiawei Shaoc8b067d2019-02-15 10:55:08 +0000939 "src/tests/end2end/RenderPassTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000940 "src/tests/end2end/SamplerTests.cpp",
941 "src/tests/end2end/ScissorTests.cpp",
Corentin Wallez431d6182019-07-01 09:58:07 +0000942 "src/tests/end2end/TextureFormatTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000943 "src/tests/end2end/TextureViewTests.cpp",
Natasha Lee28232ce2019-06-11 18:11:05 +0000944 "src/tests/end2end/TextureZeroInitTests.cpp",
Yan, Shaobo9286adc2019-04-26 15:25:18 +0000945 "src/tests/end2end/VertexFormatTests.cpp",
Kai Ninomiyaae1f25f2019-11-07 22:23:29 +0000946 "src/tests/end2end/VertexStateTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000947 "src/tests/end2end/ViewportOrientationTests.cpp",
Yunchao Hed6f13c62019-07-16 19:27:09 +0000948 "src/tests/end2end/ViewportTests.cpp",
Corentin Wallez48a19232018-12-08 10:35:53 +0000949 ]
950
Corentin Wallezd87e6762020-01-23 17:20:38 +0000951 # Validation tests that need OS windows live in end2end tests.
952 sources += [
953 "src/tests/unittests/validation/ValidationTest.cpp",
954 "src/tests/unittests/validation/ValidationTest.h",
955 ]
956
Corentin Wallez0cdf9e02019-03-01 12:01:18 +0000957 libs = []
958
Rafael Cintron179d7b22019-09-02 19:19:34 +0000959 if (dawn_enable_d3d12) {
960 sources += [ "src/tests/end2end/D3D12ResourceWrappingTests.cpp" ]
961 libs += [
962 "d3d11.lib",
963 "dxgi.lib",
964 ]
965 }
966
Corentin Wallez3a1746e2020-01-15 13:14:12 +0000967 if (dawn_enable_metal) {
968 sources += [ "src/tests/end2end/IOSurfaceWrappingTests.cpp" ]
969 libs += [ "IOSurface.framework" ]
970 }
971
Brian Ho2fb628d2019-08-13 21:45:44 +0000972 if (dawn_enable_opengl) {
Corentin Wallez3a1746e2020-01-15 13:14:12 +0000973 assert(supports_glfw_for_windowing)
974 }
975
976 if (supports_glfw_for_windowing) {
Corentin Wallezd87e6762020-01-23 17:20:38 +0000977 sources += [
978 "src/tests/end2end/SwapChainValidationTests.cpp",
979 "src/tests/end2end/WindowSurfaceTests.cpp",
980 ]
David 'Digit' Turnerb749d072019-09-09 10:52:08 +0000981 deps += [ ":dawn_glfw" ]
Brian Ho2fb628d2019-08-13 21:45:44 +0000982 }
Idan Raiter74e48342019-08-10 03:17:52 +0000983}
984
985source_set("dawn_white_box_tests_sources") {
Austin Eng0c66bcd2020-01-15 18:22:53 +0000986 configs += [ ":libdawn_native_internal" ]
Idan Raiter74e48342019-08-10 03:17:52 +0000987 testonly = true
988
989 deps = [
990 ":dawn_utils",
Idan Raiter74e48342019-08-10 03:17:52 +0000991 ":libdawn_native_sources",
Austin Eng470921f2020-01-06 19:56:17 +0000992 ":libdawn_native_static", # Static because the tests both link against and have libdawn_native
993 # sources. MSVC errors when both importing and exporting symbols.
Idan Raiter74e48342019-08-10 03:17:52 +0000994 ":libdawn_wire",
995 "${dawn_root}/src/common",
Corentin Wallez96496822019-10-15 11:44:38 +0000996 "${dawn_root}/src/dawn:dawncpp",
997 "${dawn_root}/src/dawn:libdawn_proc",
Idan Raiter74e48342019-08-10 03:17:52 +0000998 "third_party:gmock_and_gtest",
999 ]
1000
1001 sources = [
1002 "src/tests/DawnTest.h",
1003 ]
1004
1005 if (dawn_enable_vulkan) {
1006 deps += [ "third_party:vulkan_headers" ]
1007
1008 if (is_linux) {
1009 sources += [ "src/tests/white_box/VulkanImageWrappingTests.cpp" ]
1010 }
Austin Eng6ea362c2019-12-17 00:47:40 +00001011
1012 if (dawn_enable_error_injection) {
1013 sources += [ "src/tests/white_box/VulkanErrorInjectorTests.cpp" ]
1014 }
Idan Raiter74e48342019-08-10 03:17:52 +00001015 }
1016
Bryan Bernhart2cdf1322019-11-05 19:34:45 +00001017 if (dawn_enable_d3d12) {
1018 sources += [ "src/tests/white_box/D3D12SmallTextureTests.cpp" ]
1019 }
1020
Austin Eng0c66bcd2020-01-15 18:22:53 +00001021 if (dawn_enable_metal) {
1022 sources += [ "src/tests/white_box/MetalAutoreleasePoolTests.mm" ]
1023 }
1024
Brian Ho2fb628d2019-08-13 21:45:44 +00001025 if (dawn_enable_opengl) {
David 'Digit' Turnerb749d072019-09-09 10:52:08 +00001026 deps += [ ":dawn_glfw" ]
Brian Ho2fb628d2019-08-13 21:45:44 +00001027 }
1028
Idan Raiter74e48342019-08-10 03:17:52 +00001029 libs = []
1030}
1031
1032test("dawn_end2end_tests") {
1033 configs += [ "${dawn_root}/src/common:dawn_internal" ]
1034
1035 deps = [
1036 ":dawn_end2end_tests_sources",
1037 ":dawn_utils",
1038 ":dawn_white_box_tests_sources",
1039 ":libdawn_native",
1040 ":libdawn_wire",
1041 "${dawn_root}/src/common",
Corentin Wallez96496822019-10-15 11:44:38 +00001042 "${dawn_root}/src/dawn:dawncpp",
1043 "${dawn_root}/src/dawn:libdawn_proc",
Idan Raiter74e48342019-08-10 03:17:52 +00001044 "third_party:gmock_and_gtest",
1045 ]
1046
1047 sources = [
1048 "src/tests/DawnTest.cpp",
1049 "src/tests/DawnTest.h",
1050 ]
1051
1052 libs = []
Corentin Wallez0cdf9e02019-03-01 12:01:18 +00001053
Corentin Wallez48a19232018-12-08 10:35:53 +00001054 # When building inside Chromium, use their gtest main function because it is
1055 # needed to run in swarming correctly.
1056 if (build_with_chromium) {
1057 sources += [ "//gpu/dawn_end2end_tests_main.cc" ]
1058 } else {
1059 sources += [ "src/tests/End2EndTestsMain.cpp" ]
1060 }
Brian Ho2fb628d2019-08-13 21:45:44 +00001061
1062 if (dawn_enable_opengl) {
David 'Digit' Turnerb749d072019-09-09 10:52:08 +00001063 deps += [ ":dawn_glfw" ]
Brian Ho2fb628d2019-08-13 21:45:44 +00001064 }
Corentin Wallez21a23852018-07-31 18:50:03 +02001065}
Corentin Wallez4d7d1692018-08-13 08:23:27 +02001066
Austin Engca0eac32019-08-28 23:18:10 +00001067test("dawn_perf_tests") {
1068 configs += [ "${dawn_root}/src/common:dawn_internal" ]
1069
1070 deps = [
Austin Eng92a011a2019-10-17 19:00:32 +00001071 ":dawn_platform",
Austin Engca0eac32019-08-28 23:18:10 +00001072 ":dawn_utils",
1073 ":libdawn_native",
1074 ":libdawn_wire",
1075 "${dawn_root}/src/common",
Corentin Wallez96496822019-10-15 11:44:38 +00001076 "${dawn_root}/src/dawn:dawncpp",
1077 "${dawn_root}/src/dawn:libdawn_proc",
Austin Engca0eac32019-08-28 23:18:10 +00001078 "third_party:gmock_and_gtest",
1079 ]
1080
1081 sources = [
1082 "src/tests/DawnTest.cpp",
1083 "src/tests/DawnTest.h",
1084 "src/tests/ParamGenerator.h",
1085 "src/tests/perf_tests/BufferUploadPerf.cpp",
1086 "src/tests/perf_tests/DawnPerfTest.cpp",
1087 "src/tests/perf_tests/DawnPerfTest.h",
Austin Eng92a011a2019-10-17 19:00:32 +00001088 "src/tests/perf_tests/DawnPerfTestPlatform.cpp",
1089 "src/tests/perf_tests/DawnPerfTestPlatform.h",
Austin Eng64a3bb92019-10-31 03:20:31 +00001090 "src/tests/perf_tests/DrawCallPerf.cpp",
Austin Engca0eac32019-08-28 23:18:10 +00001091 ]
1092
1093 libs = []
1094
1095 # When building inside Chromium, use their gtest main function because it is
1096 # needed to run in swarming correctly.
1097 if (build_with_chromium) {
1098 sources += [ "//gpu/dawn_perf_tests_main.cc" ]
1099 } else {
1100 sources += [ "src/tests/PerfTestsMain.cpp" ]
1101 }
1102
1103 if (dawn_enable_metal) {
1104 libs += [ "IOSurface.framework" ]
1105 }
1106
1107 if (dawn_enable_opengl) {
David 'Digit' Turnerb749d072019-09-09 10:52:08 +00001108 deps += [ ":dawn_glfw" ]
Austin Engca0eac32019-08-28 23:18:10 +00001109 }
1110}
1111
Corentin Wallez07df6052018-12-10 16:45:24 +00001112# Temporary groups to make a 5-way patch to fix crbug.com/913171
1113group("dawn_unittests_temp_group") {
1114 testonly = true
Jiawei Shao8bff3b22018-12-12 09:27:16 +00001115 deps = [
1116 ":dawn_unittests",
1117 ]
Corentin Wallez07df6052018-12-10 16:45:24 +00001118}
1119
1120group("dawn_end2end_tests_temp_group") {
1121 testonly = true
Jiawei Shao8bff3b22018-12-12 09:27:16 +00001122 deps = [
1123 ":dawn_end2end_tests",
1124 ]
Corentin Wallez07df6052018-12-10 16:45:24 +00001125}
1126
Austin Engca0eac32019-08-28 23:18:10 +00001127group("dawn_perf_tests_temp_group") {
1128 testonly = true
1129 deps = [
1130 ":dawn_perf_tests",
1131 ]
Austin Eng3c26e422019-08-30 19:16:46 +00001132 data_deps = [
1133 ":dawn_perf_tests",
1134 ]
Austin Engca0eac32019-08-28 23:18:10 +00001135}
1136
Corentin Wallez4d7d1692018-08-13 08:23:27 +02001137###############################################################################
1138# Dawn samples, only in standalone builds
1139###############################################################################
1140
1141if (dawn_standalone) {
Corentin Wallez54e50722019-11-19 18:58:50 +00001142 # Library to handle the interaction of Dawn with GLFW windows in samples
1143 static_library("dawn_bindings") {
1144 configs += [ "${dawn_root}/src/common:dawn_internal" ]
1145
1146 sources = [
1147 "src/utils/BackendBinding.cpp",
1148 "src/utils/BackendBinding.h",
1149 ]
1150
1151 public_deps = [
1152 "${dawn_root}/src/dawn:dawn_headers",
1153 ]
1154
1155 deps = [
1156 ":dawn_glfw",
1157 ":libdawn_native",
1158 "${dawn_root}/src/common",
1159 ]
1160 libs = []
1161
1162 if (dawn_enable_d3d12) {
1163 sources += [ "src/utils/D3D12Binding.cpp" ]
1164 }
1165
1166 if (dawn_enable_metal) {
1167 sources += [ "src/utils/MetalBinding.mm" ]
1168 libs += [
1169 "Metal.framework",
1170 "QuartzCore.framework",
1171 ]
1172
1173 # Suppress warnings that Metal isn't in the deployment target of Chrome
1174 if (is_mac) {
1175 cflags_objcc = [ "-Wno-unguarded-availability" ]
1176 }
1177 }
1178
1179 if (dawn_enable_null) {
1180 sources += [ "src/utils/NullBinding.cpp" ]
1181 }
1182
1183 if (dawn_enable_opengl) {
1184 sources += [ "src/utils/OpenGLBinding.cpp" ]
1185 }
1186
1187 if (dawn_enable_vulkan) {
1188 sources += [ "src/utils/VulkanBinding.cpp" ]
1189 }
1190 }
1191
Corentin Wallez4d7d1692018-08-13 08:23:27 +02001192 # Static library to contain code and dependencies common to all samples
1193 static_library("dawn_sample_utils") {
1194 sources = [
1195 "examples/SampleUtils.cpp",
1196 "examples/SampleUtils.h",
1197 ]
1198
1199 # Export all of these as public deps so that `gn check` allows includes
1200 public_deps = [
Brian Ho2fb628d2019-08-13 21:45:44 +00001201 ":dawn_bindings",
David 'Digit' Turnerb749d072019-09-09 10:52:08 +00001202 ":dawn_glfw",
Corentin Wallez4d7d1692018-08-13 08:23:27 +02001203 ":dawn_utils",
Corentin Wallez4d7d1692018-08-13 08:23:27 +02001204 ":libdawn_native",
1205 ":libdawn_wire",
Corentin Wallez579cf622019-03-07 01:46:39 +00001206 "${dawn_root}/src/common",
Corentin Wallez96496822019-10-15 11:44:38 +00001207 "${dawn_root}/src/dawn:dawncpp",
1208 "${dawn_root}/src/dawn:libdawn_proc",
Corentin Wallez4d7d1692018-08-13 08:23:27 +02001209 ]
Corentin Wallez579cf622019-03-07 01:46:39 +00001210 public_configs = [ "${dawn_root}/src/common:dawn_internal" ]
Corentin Wallez4d7d1692018-08-13 08:23:27 +02001211 }
1212
1213 # Template for samples to avoid listing dawn_sample_utils as a dep every time
1214 template("dawn_sample") {
1215 executable(target_name) {
1216 deps = [
1217 ":dawn_sample_utils",
1218 ]
1219 forward_variables_from(invoker, "*", [ "deps" ])
1220
1221 if (defined(invoker.deps)) {
1222 deps += invoker.deps
1223 }
1224 }
1225 }
1226
1227 dawn_sample("CppHelloTriangle") {
1228 sources = [
1229 "examples/CppHelloTriangle.cpp",
1230 ]
1231 }
1232
1233 dawn_sample("CHelloTriangle") {
1234 sources = [
1235 "examples/CHelloTriangle.cpp",
1236 ]
1237 }
1238
1239 dawn_sample("ComputeBoids") {
1240 sources = [
1241 "examples/ComputeBoids.cpp",
1242 ]
1243 deps = [
1244 "third_party:glm",
1245 ]
1246 }
1247
1248 dawn_sample("Animometer") {
1249 sources = [
1250 "examples/Animometer.cpp",
1251 ]
1252 }
1253
1254 dawn_sample("CubeReflection") {
1255 sources = [
1256 "examples/CubeReflection.cpp",
1257 ]
1258 deps = [
1259 "third_party:glm",
1260 ]
1261 }
1262
Corentin Wallez31d1e782018-09-20 21:17:14 +00001263 group("dawn_samples") {
1264 deps = [
Stephen Whited380fdd2018-10-04 16:59:05 +00001265 ":Animometer",
Corentin Wallez31d1e782018-09-20 21:17:14 +00001266 ":CHelloTriangle",
1267 ":ComputeBoids",
Stephen Whited380fdd2018-10-04 16:59:05 +00001268 ":CppHelloTriangle",
Corentin Wallez31d1e782018-09-20 21:17:14 +00001269 ":CubeReflection",
Corentin Wallez31d1e782018-09-20 21:17:14 +00001270 ]
1271 }
Corentin Wallez4d7d1692018-08-13 08:23:27 +02001272}
Ryan Harrison98542952018-11-12 12:20:21 +00001273
1274###############################################################################
1275# Fuzzers
1276###############################################################################
Ryan Harrison98542952018-11-12 12:20:21 +00001277
Corentin Wallez597e1582018-11-12 18:09:56 +00001278group("dawn_fuzzers") {
1279 testonly = true
1280 deps = [
Ryan Harrison00b1e382019-11-27 20:56:14 +00001281 "src/fuzzers:dawn_spirv_cross_glsl_fast_fuzzer",
1282 "src/fuzzers:dawn_spirv_cross_hlsl_fast_fuzzer",
1283 "src/fuzzers:dawn_spirv_cross_msl_fast_fuzzer",
Sarah Mashayekhiaf094e62019-12-11 19:03:01 +00001284 "src/fuzzers:dawn_spvc_glsl_fast_fuzzer",
1285 "src/fuzzers:dawn_spvc_hlsl_fast_fuzzer",
1286 "src/fuzzers:dawn_spvc_msl_fast_fuzzer",
Corentin Wallez597e1582018-11-12 18:09:56 +00001287 "src/fuzzers:dawn_wire_server_and_frontend_fuzzer",
1288 ]
Ryan Harrison98542952018-11-12 12:20:21 +00001289}