Split dawn_(native|wire|platform) to their own BUILD.gn files

This will help external projects that want to use Dawn, like Skia, refer
to GN targets without GN discovering Dawn's main BUILD.gn file that
causes all the tests and third_party dependencies to be discovered.

This CL just splits off chunks of BUILD.gn into separate file, adds
necessary includes and fixes up GN paths. It also introduces temporary
groups for targets that are used in Chromium so that the paths can be
fixed in a 3-way patch.

Bug: chromium:1064305

Change-Id: Ib4b73bd8d3121ef67d4ecee2e54ec158875f2117
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18861
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Corentin Wallez 2020-04-07 07:29:45 +00:00 committed by Commit Bot service account
parent c3c6694d8f
commit 5c2d2e7ff8
5 changed files with 769 additions and 729 deletions

793
BUILD.gn
View File

@ -13,687 +13,12 @@
# limitations under the License. # limitations under the License.
import("//build_overrides/build.gni") import("//build_overrides/build.gni")
import("//build_overrides/vulkan_validation_layers.gni")
import("generator/dawn_generator.gni") import("generator/dawn_generator.gni")
import("scripts/dawn_component.gni")
import("scripts/dawn_features.gni") import("scripts/dawn_features.gni")
import("scripts/dawn_overrides_with_defaults.gni") import("scripts/dawn_overrides_with_defaults.gni")
import("//testing/test.gni") import("//testing/test.gni")
# Swiftshader is an optional dependency of Dawn so we only use it if the path
# to it has been set.
use_swiftshader = dawn_use_swiftshader && dawn_swiftshader_dir != ""
if (use_swiftshader) {
assert(dawn_enable_vulkan,
"dawn_use_swiftshader requires dawn_enable_vulkan=true")
import("${dawn_swiftshader_dir}/src/Vulkan/vulkan.gni")
}
# Import mac_min_system_version
if (is_mac) {
import("//build/config/mac/mac_sdk.gni")
}
###############################################################################
# dawn_platform
###############################################################################
source_set("dawn_platform") {
configs += [ "${dawn_root}/src/common:dawn_internal" ]
sources = [
"${dawn_root}/src/include/dawn_platform/DawnPlatform.h",
"src/dawn_platform/tracing/EventTracer.cpp",
"src/dawn_platform/tracing/EventTracer.h",
"src/dawn_platform/tracing/TraceEvent.h",
]
deps = [
"${dawn_root}/src/common",
]
}
###############################################################################
# libdawn_native
###############################################################################
config("libdawn_native_internal") {
configs = [ "${dawn_root}/src/common:dawn_internal" ]
# Suppress warnings that Metal isn't in the deployment target of Chrome:
# initialization of the Metal backend is behind a IsMetalSupported check so
# Dawn won't call Metal functions on macOS 10.10.
# At the time this is written Chromium supports 10.10.0 and above, so if we
# aren't on 10.11 it means we are on 10.11 and above, and Metal is available.
# Skipping this check on 10.11 and above is important as it allows getting
# proper compilation warning when using 10.12 and above feature for example.
# TODO(cwallez@chromium.org): Consider using API_AVAILABLE annotations on all
# metal code in dawn once crbug.com/1004024 is sorted out if Chromium still
# supports 10.10 then.
if (is_mac && mac_min_system_version == "10.10.0") {
cflags_objcc = [ "-Wno-unguarded-availability" ]
}
}
config("libdawn_native_weak_framework") {
if (is_mac && dawn_enable_metal) {
ldflags = [
"-weak_framework",
"Metal",
]
}
}
dawn_json_generator("libdawn_native_utils_gen") {
target = "dawn_native_utils"
outputs = [
"src/dawn_native/ProcTable.cpp",
"src/dawn_native/wgpu_structs_autogen.h",
"src/dawn_native/wgpu_structs_autogen.cpp",
"src/dawn_native/ValidationUtils_autogen.h",
"src/dawn_native/ValidationUtils_autogen.cpp",
]
}
if (dawn_enable_opengl) {
dawn_generator("libdawn_native_opengl_loader_gen") {
script = "generator/opengl_loader_generator.py"
args = [
"--gl-xml",
rebase_path("third_party/khronos/gl.xml", root_build_dir),
"--supported-extensions",
rebase_path("src/dawn_native/opengl/supported_extensions.json",
root_build_dir),
]
outputs = [
"src/dawn_native/opengl/OpenGLFunctionsBase_autogen.cpp",
"src/dawn_native/opengl/OpenGLFunctionsBase_autogen.h",
"src/dawn_native/opengl/opengl_platform_autogen.h",
]
}
}
# Public libdawn_native headers so they can be publically visible for
# dependencies of libdawn_native
source_set("libdawn_native_headers") {
public_deps = [
"${dawn_root}/src/dawn:dawncpp_headers",
]
all_dependent_configs = [ "${dawn_root}/src/common:dawn_public_include_dirs" ]
sources = [
"src/include/dawn_native/DawnNative.h",
"src/include/dawn_native/dawn_native_export.h",
# Include all backend's public headers so that dependencies can include
# them even when the backends are disabled.
"src/include/dawn_native/D3D12Backend.h",
"src/include/dawn_native/MetalBackend.h",
"src/include/dawn_native/NullBackend.h",
"src/include/dawn_native/OpenGLBackend.h",
"src/include/dawn_native/VulkanBackend.h",
]
}
# The meat of the compilation for libdawn_native so that we can cheaply have
# shared_library / static_library versions of it. It compiles all the files
# except those that define exported symbols.
source_set("libdawn_native_sources") {
deps = [
":libdawn_native_headers",
":libdawn_native_utils_gen",
"${dawn_root}/src/common",
"${dawn_shaderc_dir}:spirv_cross",
"${dawn_spirv_tools_dir}:spvtools_val",
]
defines = []
libs = []
data_deps = []
configs += [ ":libdawn_native_internal" ]
# Dependencies that are needed to compile libdawn_native entry points in
# FooBackend.cpp need to be public deps so they are propagated to the
# libdawn_native target
public_deps = [
":dawn_platform",
"${dawn_shaderc_dir}:libshaderc_spvc",
]
sources = get_target_outputs(":libdawn_native_utils_gen")
sources += [
"src/dawn_native/Adapter.cpp",
"src/dawn_native/Adapter.h",
"src/dawn_native/AttachmentState.cpp",
"src/dawn_native/AttachmentState.h",
"src/dawn_native/BackendConnection.cpp",
"src/dawn_native/BackendConnection.h",
"src/dawn_native/BindGroup.cpp",
"src/dawn_native/BindGroup.h",
"src/dawn_native/BindGroupAndStorageBarrierTracker.h",
"src/dawn_native/BindGroupLayout.cpp",
"src/dawn_native/BindGroupLayout.h",
"src/dawn_native/BindGroupTracker.h",
"src/dawn_native/BindingInfo.h",
"src/dawn_native/BuddyAllocator.cpp",
"src/dawn_native/BuddyAllocator.h",
"src/dawn_native/BuddyMemoryAllocator.cpp",
"src/dawn_native/BuddyMemoryAllocator.h",
"src/dawn_native/Buffer.cpp",
"src/dawn_native/Buffer.h",
"src/dawn_native/CachedObject.cpp",
"src/dawn_native/CachedObject.h",
"src/dawn_native/CommandAllocator.cpp",
"src/dawn_native/CommandAllocator.h",
"src/dawn_native/CommandBuffer.cpp",
"src/dawn_native/CommandBuffer.h",
"src/dawn_native/CommandBufferStateTracker.cpp",
"src/dawn_native/CommandBufferStateTracker.h",
"src/dawn_native/CommandEncoder.cpp",
"src/dawn_native/CommandEncoder.h",
"src/dawn_native/CommandValidation.cpp",
"src/dawn_native/CommandValidation.h",
"src/dawn_native/Commands.cpp",
"src/dawn_native/Commands.h",
"src/dawn_native/ComputePassEncoder.cpp",
"src/dawn_native/ComputePassEncoder.h",
"src/dawn_native/ComputePipeline.cpp",
"src/dawn_native/ComputePipeline.h",
"src/dawn_native/Device.cpp",
"src/dawn_native/Device.h",
"src/dawn_native/DynamicUploader.cpp",
"src/dawn_native/DynamicUploader.h",
"src/dawn_native/EncodingContext.cpp",
"src/dawn_native/EncodingContext.h",
"src/dawn_native/Error.cpp",
"src/dawn_native/Error.h",
"src/dawn_native/ErrorData.cpp",
"src/dawn_native/ErrorData.h",
"src/dawn_native/ErrorInjector.cpp",
"src/dawn_native/ErrorInjector.h",
"src/dawn_native/ErrorScope.cpp",
"src/dawn_native/ErrorScope.h",
"src/dawn_native/ErrorScopeTracker.cpp",
"src/dawn_native/ErrorScopeTracker.h",
"src/dawn_native/Extensions.cpp",
"src/dawn_native/Extensions.h",
"src/dawn_native/Fence.cpp",
"src/dawn_native/Fence.h",
"src/dawn_native/FenceSignalTracker.cpp",
"src/dawn_native/FenceSignalTracker.h",
"src/dawn_native/Format.cpp",
"src/dawn_native/Format.h",
"src/dawn_native/Forward.h",
"src/dawn_native/Instance.cpp",
"src/dawn_native/Instance.h",
"src/dawn_native/ObjectBase.cpp",
"src/dawn_native/ObjectBase.h",
"src/dawn_native/PassResourceUsage.h",
"src/dawn_native/PassResourceUsageTracker.cpp",
"src/dawn_native/PassResourceUsageTracker.h",
"src/dawn_native/PerStage.cpp",
"src/dawn_native/PerStage.h",
"src/dawn_native/Pipeline.cpp",
"src/dawn_native/Pipeline.h",
"src/dawn_native/PipelineLayout.cpp",
"src/dawn_native/PipelineLayout.h",
"src/dawn_native/ProgrammablePassEncoder.cpp",
"src/dawn_native/ProgrammablePassEncoder.h",
"src/dawn_native/Queue.cpp",
"src/dawn_native/Queue.h",
"src/dawn_native/RefCounted.cpp",
"src/dawn_native/RefCounted.h",
"src/dawn_native/RenderBundle.cpp",
"src/dawn_native/RenderBundle.h",
"src/dawn_native/RenderBundleEncoder.cpp",
"src/dawn_native/RenderBundleEncoder.h",
"src/dawn_native/RenderEncoderBase.cpp",
"src/dawn_native/RenderEncoderBase.h",
"src/dawn_native/RenderPassEncoder.cpp",
"src/dawn_native/RenderPassEncoder.h",
"src/dawn_native/RenderPipeline.cpp",
"src/dawn_native/RenderPipeline.h",
"src/dawn_native/ResourceHeap.h",
"src/dawn_native/ResourceHeapAllocator.h",
"src/dawn_native/ResourceMemoryAllocation.cpp",
"src/dawn_native/ResourceMemoryAllocation.h",
"src/dawn_native/RingBufferAllocator.cpp",
"src/dawn_native/RingBufferAllocator.h",
"src/dawn_native/Sampler.cpp",
"src/dawn_native/Sampler.h",
"src/dawn_native/ShaderModule.cpp",
"src/dawn_native/ShaderModule.h",
"src/dawn_native/StagingBuffer.cpp",
"src/dawn_native/StagingBuffer.h",
"src/dawn_native/Surface.cpp",
"src/dawn_native/Surface.h",
"src/dawn_native/SwapChain.cpp",
"src/dawn_native/SwapChain.h",
"src/dawn_native/Texture.cpp",
"src/dawn_native/Texture.h",
"src/dawn_native/ToBackend.h",
"src/dawn_native/Toggles.cpp",
"src/dawn_native/Toggles.h",
"src/dawn_native/dawn_platform.h",
]
if (dawn_enable_d3d12) {
libs += [ "dxguid.lib" ]
sources += [
"src/dawn_native/d3d12/AdapterD3D12.cpp",
"src/dawn_native/d3d12/AdapterD3D12.h",
"src/dawn_native/d3d12/BackendD3D12.cpp",
"src/dawn_native/d3d12/BackendD3D12.h",
"src/dawn_native/d3d12/BindGroupD3D12.cpp",
"src/dawn_native/d3d12/BindGroupD3D12.h",
"src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp",
"src/dawn_native/d3d12/BindGroupLayoutD3D12.h",
"src/dawn_native/d3d12/BufferD3D12.cpp",
"src/dawn_native/d3d12/BufferD3D12.h",
"src/dawn_native/d3d12/CPUDescriptorHeapAllocationD3D12.cpp",
"src/dawn_native/d3d12/CPUDescriptorHeapAllocationD3D12.h",
"src/dawn_native/d3d12/CommandAllocatorManager.cpp",
"src/dawn_native/d3d12/CommandAllocatorManager.h",
"src/dawn_native/d3d12/CommandBufferD3D12.cpp",
"src/dawn_native/d3d12/CommandBufferD3D12.h",
"src/dawn_native/d3d12/CommandRecordingContext.cpp",
"src/dawn_native/d3d12/CommandRecordingContext.h",
"src/dawn_native/d3d12/ComputePipelineD3D12.cpp",
"src/dawn_native/d3d12/ComputePipelineD3D12.h",
"src/dawn_native/d3d12/D3D12Error.cpp",
"src/dawn_native/d3d12/D3D12Error.h",
"src/dawn_native/d3d12/D3D12Info.cpp",
"src/dawn_native/d3d12/D3D12Info.h",
"src/dawn_native/d3d12/DescriptorHeapAllocationD3D12.cpp",
"src/dawn_native/d3d12/DescriptorHeapAllocationD3D12.h",
"src/dawn_native/d3d12/DescriptorHeapAllocator.cpp",
"src/dawn_native/d3d12/DescriptorHeapAllocator.h",
"src/dawn_native/d3d12/DeviceD3D12.cpp",
"src/dawn_native/d3d12/DeviceD3D12.h",
"src/dawn_native/d3d12/Forward.h",
"src/dawn_native/d3d12/HeapAllocatorD3D12.cpp",
"src/dawn_native/d3d12/HeapAllocatorD3D12.h",
"src/dawn_native/d3d12/HeapD3D12.cpp",
"src/dawn_native/d3d12/HeapD3D12.h",
"src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp",
"src/dawn_native/d3d12/NativeSwapChainImplD3D12.h",
"src/dawn_native/d3d12/NonShaderVisibleDescriptorAllocatorD3D12.cpp",
"src/dawn_native/d3d12/NonShaderVisibleDescriptorAllocatorD3D12.h",
"src/dawn_native/d3d12/PipelineLayoutD3D12.cpp",
"src/dawn_native/d3d12/PipelineLayoutD3D12.h",
"src/dawn_native/d3d12/PlatformFunctions.cpp",
"src/dawn_native/d3d12/PlatformFunctions.h",
"src/dawn_native/d3d12/QueueD3D12.cpp",
"src/dawn_native/d3d12/QueueD3D12.h",
"src/dawn_native/d3d12/RenderPassBuilderD3D12.cpp",
"src/dawn_native/d3d12/RenderPassBuilderD3D12.h",
"src/dawn_native/d3d12/RenderPipelineD3D12.cpp",
"src/dawn_native/d3d12/RenderPipelineD3D12.h",
"src/dawn_native/d3d12/ResidencyManagerD3D12.cpp",
"src/dawn_native/d3d12/ResidencyManagerD3D12.h",
"src/dawn_native/d3d12/ResourceAllocatorManagerD3D12.cpp",
"src/dawn_native/d3d12/ResourceAllocatorManagerD3D12.h",
"src/dawn_native/d3d12/ResourceHeapAllocationD3D12.cpp",
"src/dawn_native/d3d12/ResourceHeapAllocationD3D12.h",
"src/dawn_native/d3d12/SamplerD3D12.cpp",
"src/dawn_native/d3d12/SamplerD3D12.h",
"src/dawn_native/d3d12/ShaderModuleD3D12.cpp",
"src/dawn_native/d3d12/ShaderModuleD3D12.h",
"src/dawn_native/d3d12/ShaderVisibleDescriptorAllocatorD3D12.cpp",
"src/dawn_native/d3d12/ShaderVisibleDescriptorAllocatorD3D12.h",
"src/dawn_native/d3d12/StagingBufferD3D12.cpp",
"src/dawn_native/d3d12/StagingBufferD3D12.h",
"src/dawn_native/d3d12/SwapChainD3D12.cpp",
"src/dawn_native/d3d12/SwapChainD3D12.h",
"src/dawn_native/d3d12/TextureCopySplitter.cpp",
"src/dawn_native/d3d12/TextureCopySplitter.h",
"src/dawn_native/d3d12/TextureD3D12.cpp",
"src/dawn_native/d3d12/TextureD3D12.h",
"src/dawn_native/d3d12/UtilsD3D12.cpp",
"src/dawn_native/d3d12/UtilsD3D12.h",
"src/dawn_native/d3d12/d3d12_platform.h",
]
}
if (dawn_enable_metal) {
libs += [
"Cocoa.framework",
"IOKit.framework",
"IOSurface.framework",
"QuartzCore.framework",
]
sources += [
"src/dawn_native/Surface_metal.mm",
"src/dawn_native/metal/BackendMTL.h",
"src/dawn_native/metal/BackendMTL.mm",
"src/dawn_native/metal/BindGroupLayoutMTL.h",
"src/dawn_native/metal/BindGroupLayoutMTL.mm",
"src/dawn_native/metal/BindGroupMTL.h",
"src/dawn_native/metal/BindGroupMTL.mm",
"src/dawn_native/metal/BufferMTL.h",
"src/dawn_native/metal/BufferMTL.mm",
"src/dawn_native/metal/CommandBufferMTL.h",
"src/dawn_native/metal/CommandBufferMTL.mm",
"src/dawn_native/metal/CommandRecordingContext.h",
"src/dawn_native/metal/CommandRecordingContext.mm",
"src/dawn_native/metal/ComputePipelineMTL.h",
"src/dawn_native/metal/ComputePipelineMTL.mm",
"src/dawn_native/metal/DeviceMTL.h",
"src/dawn_native/metal/DeviceMTL.mm",
"src/dawn_native/metal/Forward.h",
"src/dawn_native/metal/PipelineLayoutMTL.h",
"src/dawn_native/metal/PipelineLayoutMTL.mm",
"src/dawn_native/metal/QueueMTL.h",
"src/dawn_native/metal/QueueMTL.mm",
"src/dawn_native/metal/RenderPipelineMTL.h",
"src/dawn_native/metal/RenderPipelineMTL.mm",
"src/dawn_native/metal/SamplerMTL.h",
"src/dawn_native/metal/SamplerMTL.mm",
"src/dawn_native/metal/ShaderModuleMTL.h",
"src/dawn_native/metal/ShaderModuleMTL.mm",
"src/dawn_native/metal/StagingBufferMTL.h",
"src/dawn_native/metal/StagingBufferMTL.mm",
"src/dawn_native/metal/SwapChainMTL.h",
"src/dawn_native/metal/SwapChainMTL.mm",
"src/dawn_native/metal/TextureMTL.h",
"src/dawn_native/metal/TextureMTL.mm",
"src/dawn_native/metal/UtilsMetal.h",
"src/dawn_native/metal/UtilsMetal.mm",
]
}
if (dawn_enable_null) {
sources += [
"src/dawn_native/null/DeviceNull.cpp",
"src/dawn_native/null/DeviceNull.h",
]
}
if (dawn_enable_opengl) {
public_deps += [
":libdawn_native_opengl_loader_gen",
"third_party:khronos_platform",
]
sources += get_target_outputs(":libdawn_native_opengl_loader_gen")
sources += [
"src/dawn_native/opengl/BackendGL.cpp",
"src/dawn_native/opengl/BackendGL.h",
"src/dawn_native/opengl/BindGroupGL.cpp",
"src/dawn_native/opengl/BindGroupGL.h",
"src/dawn_native/opengl/BindGroupLayoutGL.cpp",
"src/dawn_native/opengl/BindGroupLayoutGL.h",
"src/dawn_native/opengl/BufferGL.cpp",
"src/dawn_native/opengl/BufferGL.h",
"src/dawn_native/opengl/CommandBufferGL.cpp",
"src/dawn_native/opengl/CommandBufferGL.h",
"src/dawn_native/opengl/ComputePipelineGL.cpp",
"src/dawn_native/opengl/ComputePipelineGL.h",
"src/dawn_native/opengl/DeviceGL.cpp",
"src/dawn_native/opengl/DeviceGL.h",
"src/dawn_native/opengl/Forward.h",
"src/dawn_native/opengl/GLFormat.cpp",
"src/dawn_native/opengl/GLFormat.h",
"src/dawn_native/opengl/NativeSwapChainImplGL.cpp",
"src/dawn_native/opengl/NativeSwapChainImplGL.h",
"src/dawn_native/opengl/OpenGLFunctions.cpp",
"src/dawn_native/opengl/OpenGLFunctions.h",
"src/dawn_native/opengl/PersistentPipelineStateGL.cpp",
"src/dawn_native/opengl/PersistentPipelineStateGL.h",
"src/dawn_native/opengl/PipelineGL.cpp",
"src/dawn_native/opengl/PipelineGL.h",
"src/dawn_native/opengl/PipelineLayoutGL.cpp",
"src/dawn_native/opengl/PipelineLayoutGL.h",
"src/dawn_native/opengl/QueueGL.cpp",
"src/dawn_native/opengl/QueueGL.h",
"src/dawn_native/opengl/RenderPipelineGL.cpp",
"src/dawn_native/opengl/RenderPipelineGL.h",
"src/dawn_native/opengl/SamplerGL.cpp",
"src/dawn_native/opengl/SamplerGL.h",
"src/dawn_native/opengl/ShaderModuleGL.cpp",
"src/dawn_native/opengl/ShaderModuleGL.h",
"src/dawn_native/opengl/SwapChainGL.cpp",
"src/dawn_native/opengl/SwapChainGL.h",
"src/dawn_native/opengl/TextureGL.cpp",
"src/dawn_native/opengl/TextureGL.h",
"src/dawn_native/opengl/UtilsGL.cpp",
"src/dawn_native/opengl/UtilsGL.h",
"src/dawn_native/opengl/opengl_platform.h",
]
}
if (dawn_enable_vulkan) {
public_deps += [ "third_party:vulkan_headers" ]
sources += [
"src/dawn_native/vulkan/AdapterVk.cpp",
"src/dawn_native/vulkan/AdapterVk.h",
"src/dawn_native/vulkan/BackendVk.cpp",
"src/dawn_native/vulkan/BackendVk.h",
"src/dawn_native/vulkan/BindGroupLayoutVk.cpp",
"src/dawn_native/vulkan/BindGroupLayoutVk.h",
"src/dawn_native/vulkan/BindGroupVk.cpp",
"src/dawn_native/vulkan/BindGroupVk.h",
"src/dawn_native/vulkan/BufferVk.cpp",
"src/dawn_native/vulkan/BufferVk.h",
"src/dawn_native/vulkan/CommandBufferVk.cpp",
"src/dawn_native/vulkan/CommandBufferVk.h",
"src/dawn_native/vulkan/CommandRecordingContext.h",
"src/dawn_native/vulkan/ComputePipelineVk.cpp",
"src/dawn_native/vulkan/ComputePipelineVk.h",
"src/dawn_native/vulkan/DescriptorSetService.cpp",
"src/dawn_native/vulkan/DescriptorSetService.h",
"src/dawn_native/vulkan/DeviceVk.cpp",
"src/dawn_native/vulkan/DeviceVk.h",
"src/dawn_native/vulkan/ExternalHandle.h",
"src/dawn_native/vulkan/FencedDeleter.cpp",
"src/dawn_native/vulkan/FencedDeleter.h",
"src/dawn_native/vulkan/Forward.h",
"src/dawn_native/vulkan/NativeSwapChainImplVk.cpp",
"src/dawn_native/vulkan/NativeSwapChainImplVk.h",
"src/dawn_native/vulkan/PipelineLayoutVk.cpp",
"src/dawn_native/vulkan/PipelineLayoutVk.h",
"src/dawn_native/vulkan/QueueVk.cpp",
"src/dawn_native/vulkan/QueueVk.h",
"src/dawn_native/vulkan/RenderPassCache.cpp",
"src/dawn_native/vulkan/RenderPassCache.h",
"src/dawn_native/vulkan/RenderPipelineVk.cpp",
"src/dawn_native/vulkan/RenderPipelineVk.h",
"src/dawn_native/vulkan/ResourceHeapVk.cpp",
"src/dawn_native/vulkan/ResourceHeapVk.h",
"src/dawn_native/vulkan/ResourceMemoryAllocatorVk.cpp",
"src/dawn_native/vulkan/ResourceMemoryAllocatorVk.h",
"src/dawn_native/vulkan/SamplerVk.cpp",
"src/dawn_native/vulkan/SamplerVk.h",
"src/dawn_native/vulkan/ShaderModuleVk.cpp",
"src/dawn_native/vulkan/ShaderModuleVk.h",
"src/dawn_native/vulkan/StagingBufferVk.cpp",
"src/dawn_native/vulkan/StagingBufferVk.h",
"src/dawn_native/vulkan/SwapChainVk.cpp",
"src/dawn_native/vulkan/SwapChainVk.h",
"src/dawn_native/vulkan/TextureVk.cpp",
"src/dawn_native/vulkan/TextureVk.h",
"src/dawn_native/vulkan/UtilsVulkan.cpp",
"src/dawn_native/vulkan/UtilsVulkan.h",
"src/dawn_native/vulkan/VulkanError.cpp",
"src/dawn_native/vulkan/VulkanError.h",
"src/dawn_native/vulkan/VulkanFunctions.cpp",
"src/dawn_native/vulkan/VulkanFunctions.h",
"src/dawn_native/vulkan/VulkanInfo.cpp",
"src/dawn_native/vulkan/VulkanInfo.h",
"src/dawn_native/vulkan/external_memory/MemoryService.h",
"src/dawn_native/vulkan/external_semaphore/SemaphoreService.h",
]
if (is_chromeos) {
sources += [
"src/dawn_native/vulkan/external_memory/MemoryServiceDmaBuf.cpp",
"src/dawn_native/vulkan/external_semaphore/SemaphoreServiceOpaqueFD.cpp",
]
} else if (is_linux) {
sources += [
"src/dawn_native/vulkan/external_memory/MemoryServiceOpaqueFD.cpp",
"src/dawn_native/vulkan/external_semaphore/SemaphoreServiceOpaqueFD.cpp",
]
} else if (is_fuchsia) {
sources += [
"src/dawn_native/vulkan/external_memory/MemoryServiceZirconHandle.cpp",
"src/dawn_native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp",
]
} else {
sources += [
"src/dawn_native/vulkan/external_memory/MemoryServiceNull.cpp",
"src/dawn_native/vulkan/external_semaphore/SemaphoreServiceNull.cpp",
]
}
if (build_with_chromium && is_fuchsia) {
# Necessary to ensure that the Vulkan libraries will be in the
# final Fuchsia package.
data_deps = [
# NOTE: The line below is a work around for http://crbug.com/1001081
"//third_party/fuchsia-sdk/sdk:trace_engine",
"//third_party/fuchsia-sdk:vulkan_base",
"//third_party/fuchsia-sdk:vulkan_validation",
]
}
if (dawn_enable_vulkan_validation_layers) {
defines += [
"DAWN_ENABLE_VULKAN_VALIDATION_LAYERS",
"DAWN_VK_DATA_DIR=\"$vulkan_data_subdir\"",
]
}
if (use_swiftshader) {
data_deps += [
"${dawn_swiftshader_dir}/src/Vulkan:icd_file",
"${dawn_swiftshader_dir}/src/Vulkan:swiftshader_libvulkan",
]
defines += [
"DAWN_ENABLE_SWIFTSHADER",
"DAWN_SWIFTSHADER_VK_ICD_JSON=\"${swiftshader_icd_file_name}\"",
]
}
}
if (dawn_use_x11) {
libs += [ "X11" ]
}
}
# The static and shared libraries for libdawn_native. Most of the files are
# already compiled in libdawn_native_sources, but we still need to compile
# files defining exported symbols.
dawn_component("libdawn_native") {
DEFINE_PREFIX = "DAWN_NATIVE"
#Make headers publically visible
public_deps = [
":libdawn_native_headers",
]
deps = [
":libdawn_native_sources",
"${dawn_root}/src/common",
]
sources = [
"src/dawn_native/DawnNative.cpp",
]
configs = [ ":libdawn_native_internal" ]
public_configs = [ ":libdawn_native_weak_framework" ]
if (dawn_enable_d3d12) {
sources += [ "src/dawn_native/d3d12/D3D12Backend.cpp" ]
}
if (dawn_enable_metal) {
sources += [ "src/dawn_native/metal/MetalBackend.mm" ]
}
if (dawn_enable_null) {
sources += [ "src/dawn_native/null/NullBackend.cpp" ]
}
if (dawn_enable_opengl) {
sources += [ "src/dawn_native/opengl/OpenGLBackend.cpp" ]
}
if (dawn_enable_vulkan) {
sources += [ "src/dawn_native/vulkan/VulkanBackend.cpp" ]
if (dawn_enable_vulkan_validation_layers) {
data_deps = [
"${dawn_vulkan_validation_layers_dir}:vulkan_validation_layers",
]
if (!is_android) {
data_deps +=
[ "${dawn_vulkan_validation_layers_dir}:vulkan_gen_json_files" ]
}
}
}
}
###############################################################################
# libdawn_wire
###############################################################################
dawn_json_generator("libdawn_wire_gen") {
target = "dawn_wire"
outputs = [
"src/dawn_wire/WireCmd_autogen.h",
"src/dawn_wire/WireCmd_autogen.cpp",
"src/dawn_wire/client/ApiObjects_autogen.h",
"src/dawn_wire/client/ApiProcs_autogen.cpp",
"src/dawn_wire/client/ApiProcs_autogen.h",
"src/dawn_wire/client/ClientBase_autogen.h",
"src/dawn_wire/client/ClientHandlers_autogen.cpp",
"src/dawn_wire/client/ClientPrototypes_autogen.inc",
"src/dawn_wire/server/ServerBase_autogen.h",
"src/dawn_wire/server/ServerDoers_autogen.cpp",
"src/dawn_wire/server/ServerHandlers_autogen.cpp",
"src/dawn_wire/server/ServerPrototypes_autogen.inc",
]
}
dawn_component("libdawn_wire") {
DEFINE_PREFIX = "DAWN_WIRE"
deps = [
":libdawn_wire_gen",
"${dawn_root}/src/common",
"${dawn_root}/src/dawn_wire:libdawn_wire_headers",
]
configs = [ "${dawn_root}/src/common:dawn_internal" ]
sources = get_target_outputs(":libdawn_wire_gen")
sources += [
"src/dawn_wire/WireClient.cpp",
"src/dawn_wire/WireDeserializeAllocator.cpp",
"src/dawn_wire/WireDeserializeAllocator.h",
"src/dawn_wire/WireServer.cpp",
"src/dawn_wire/client/ApiObjects.h",
"src/dawn_wire/client/ApiProcs.cpp",
"src/dawn_wire/client/Buffer.cpp",
"src/dawn_wire/client/Buffer.h",
"src/dawn_wire/client/Client.cpp",
"src/dawn_wire/client/Client.h",
"src/dawn_wire/client/ClientDoers.cpp",
"src/dawn_wire/client/ClientInlineMemoryTransferService.cpp",
"src/dawn_wire/client/Device.cpp",
"src/dawn_wire/client/Device.h",
"src/dawn_wire/client/Fence.cpp",
"src/dawn_wire/client/Fence.h",
"src/dawn_wire/client/ObjectAllocator.h",
"src/dawn_wire/server/ObjectStorage.h",
"src/dawn_wire/server/Server.cpp",
"src/dawn_wire/server/Server.h",
"src/dawn_wire/server/ServerBuffer.cpp",
"src/dawn_wire/server/ServerDevice.cpp",
"src/dawn_wire/server/ServerFence.cpp",
"src/dawn_wire/server/ServerInlineMemoryTransferService.cpp",
"src/dawn_wire/server/ServerQueue.cpp",
]
# Make headers publically visible
public_deps = [
"${dawn_root}/src/dawn_wire:libdawn_wire_headers",
]
}
############################################################################### ###############################################################################
# GLFW wrapping target # GLFW wrapping target
############################################################################### ###############################################################################
@ -765,9 +90,9 @@ static_library("dawn_utils") {
"src/utils/WGPUHelpers.h", "src/utils/WGPUHelpers.h",
] ]
deps = [ deps = [
":libdawn_native",
":libdawn_wire",
"${dawn_root}/src/common", "${dawn_root}/src/common",
"${dawn_root}/src/dawn_native:libdawn_native",
"${dawn_root}/src/dawn_wire:libdawn_wire",
"${dawn_shaderc_dir}:libshaderc", "${dawn_shaderc_dir}:libshaderc",
] ]
libs = [] libs = []
@ -820,19 +145,19 @@ test("dawn_unittests") {
deps = [ deps = [
":dawn_utils", ":dawn_utils",
":libdawn_native",
":libdawn_native_sources",
":libdawn_wire",
":mock_webgpu_gen", ":mock_webgpu_gen",
"${dawn_root}/src/common", "${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn:libdawn_proc", "${dawn_root}/src/dawn:libdawn_proc",
"${dawn_root}/src/dawn_native:libdawn_native",
"${dawn_root}/src/dawn_native:libdawn_native_sources",
"${dawn_root}/src/dawn_wire:libdawn_wire",
"third_party:gmock_and_gtest", "third_party:gmock_and_gtest",
] ]
# Add internal Dawn Native headers and config for internal unittests. # Add internal Dawn Native headers and config for internal unittests.
deps += [ ":libdawn_native_headers" ] deps += [ "${dawn_root}/src/dawn_native:libdawn_native_headers" ]
configs += [ ":libdawn_native_internal" ] configs += [ "${dawn_root}/src/dawn_native:libdawn_native_internal" ]
sources = get_target_outputs(":mock_webgpu_gen") sources = get_target_outputs(":mock_webgpu_gen")
sources += [ sources += [
@ -923,11 +248,11 @@ source_set("dawn_end2end_tests_sources") {
deps = [ deps = [
":dawn_utils", ":dawn_utils",
":libdawn_native",
":libdawn_wire",
"${dawn_root}/src/common", "${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn:libdawn_proc", "${dawn_root}/src/dawn:libdawn_proc",
"${dawn_root}/src/dawn_native:libdawn_native",
"${dawn_root}/src/dawn_wire:libdawn_wire",
"third_party:gmock_and_gtest", "third_party:gmock_and_gtest",
] ]
@ -1013,18 +338,20 @@ source_set("dawn_end2end_tests_sources") {
} }
source_set("dawn_white_box_tests_sources") { source_set("dawn_white_box_tests_sources") {
configs += [ ":libdawn_native_internal" ] configs += [ "${dawn_root}/src/dawn_native:libdawn_native_internal" ]
testonly = true testonly = true
deps = [ deps = [
":dawn_utils", ":dawn_utils",
":libdawn_native_sources",
":libdawn_native_static", # Static because the tests both link against and have libdawn_native
# sources. MSVC errors when both importing and exporting symbols.
":libdawn_wire",
"${dawn_root}/src/common", "${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn:libdawn_proc", "${dawn_root}/src/dawn:libdawn_proc",
"${dawn_root}/src/dawn_native:libdawn_native_sources",
# Static because the tests both link against and have libdawn_native
# sources. MSVC errors when both importing and exporting symbols.
"${dawn_root}/src/dawn_native:libdawn_native_static",
"${dawn_root}/src/dawn_wire:libdawn_wire",
"third_party:gmock_and_gtest", "third_party:gmock_and_gtest",
] ]
@ -1071,11 +398,11 @@ test("dawn_end2end_tests") {
":dawn_end2end_tests_sources", ":dawn_end2end_tests_sources",
":dawn_utils", ":dawn_utils",
":dawn_white_box_tests_sources", ":dawn_white_box_tests_sources",
":libdawn_native",
":libdawn_wire",
"${dawn_root}/src/common", "${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn:libdawn_proc", "${dawn_root}/src/dawn:libdawn_proc",
"${dawn_root}/src/dawn_native:libdawn_native",
"${dawn_root}/src/dawn_wire:libdawn_wire",
"third_party:gmock_and_gtest", "third_party:gmock_and_gtest",
] ]
@ -1107,13 +434,13 @@ test("dawn_perf_tests") {
configs += [ "${dawn_root}/src/common:dawn_internal" ] configs += [ "${dawn_root}/src/common:dawn_internal" ]
deps = [ deps = [
":dawn_platform",
":dawn_utils", ":dawn_utils",
":libdawn_native",
":libdawn_wire",
"${dawn_root}/src/common", "${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn:libdawn_proc", "${dawn_root}/src/dawn:libdawn_proc",
"${dawn_root}/src/dawn_native:libdawn_native",
"${dawn_root}/src/dawn_platform",
"${dawn_root}/src/dawn_wire:libdawn_wire",
"third_party:gmock_and_gtest", "third_party:gmock_and_gtest",
] ]
@ -1148,31 +475,6 @@ test("dawn_perf_tests") {
} }
} }
# Temporary groups to make a 5-way patch to fix crbug.com/913171
group("dawn_unittests_temp_group") {
testonly = true
deps = [
":dawn_unittests",
]
}
group("dawn_end2end_tests_temp_group") {
testonly = true
deps = [
":dawn_end2end_tests",
]
}
group("dawn_perf_tests_temp_group") {
testonly = true
deps = [
":dawn_perf_tests",
]
data_deps = [
":dawn_perf_tests",
]
}
############################################################################### ###############################################################################
# Dawn samples, only in standalone builds # Dawn samples, only in standalone builds
############################################################################### ###############################################################################
@ -1193,8 +495,8 @@ if (dawn_standalone) {
deps = [ deps = [
":dawn_glfw", ":dawn_glfw",
":libdawn_native",
"${dawn_root}/src/common", "${dawn_root}/src/common",
"${dawn_root}/src/dawn_native:libdawn_native",
] ]
libs = [] libs = []
@ -1240,11 +542,11 @@ if (dawn_standalone) {
":dawn_bindings", ":dawn_bindings",
":dawn_glfw", ":dawn_glfw",
":dawn_utils", ":dawn_utils",
":libdawn_native",
":libdawn_wire",
"${dawn_root}/src/common", "${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn:libdawn_proc", "${dawn_root}/src/dawn:libdawn_proc",
"${dawn_root}/src/dawn_native:libdawn_native",
"${dawn_root}/src/dawn_wire:libdawn_wire",
] ]
public_configs = [ "${dawn_root}/src/common:dawn_internal" ] public_configs = [ "${dawn_root}/src/common:dawn_internal" ]
} }
@ -1332,3 +634,50 @@ group("dawn_fuzzers") {
"src/fuzzers:dawn_wire_server_and_frontend_fuzzer", "src/fuzzers:dawn_wire_server_and_frontend_fuzzer",
] ]
} }
###############################################################################
# Temporary groups
###############################################################################
group("libdawn_native") {
deps = [
"src/dawn_native:libdawn_native",
]
}
group("libdawn_native_sources") {
deps = [
"src/dawn_native:libdawn_native_sources",
]
}
group("libdawn_wire") {
deps = [
"src/dawn_wire:libdawn_wire",
]
}
# Temporary groups to make a 5-way patch to fix crbug.com/913171
group("dawn_unittests_temp_group") {
testonly = true
deps = [
":dawn_unittests",
]
}
group("dawn_end2end_tests_temp_group") {
testonly = true
deps = [
":dawn_end2end_tests",
]
}
group("dawn_perf_tests_temp_group") {
testonly = true
deps = [
":dawn_perf_tests",
]
data_deps = [
":dawn_perf_tests",
]
}

603
src/dawn_native/BUILD.gn Normal file
View File

@ -0,0 +1,603 @@
# Copyright 2020 The Dawn Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("../../scripts/dawn_overrides_with_defaults.gni")
import("//build_overrides/build.gni")
import("//build_overrides/vulkan_validation_layers.gni")
import("${dawn_root}/generator/dawn_generator.gni")
import("${dawn_root}/scripts/dawn_component.gni")
import("${dawn_root}/scripts/dawn_features.gni")
# Import mac_min_system_version
if (is_mac) {
import("//build/config/mac/mac_sdk.gni")
}
# Swiftshader is an optional dependency of Dawn so we only use it if the path
# to it has been set.
use_swiftshader = dawn_use_swiftshader && dawn_swiftshader_dir != ""
if (use_swiftshader) {
assert(dawn_enable_vulkan,
"dawn_use_swiftshader requires dawn_enable_vulkan=true")
import("${dawn_swiftshader_dir}/src/Vulkan/vulkan.gni")
}
config("libdawn_native_internal") {
configs = [ "${dawn_root}/src/common:dawn_internal" ]
# Suppress warnings that Metal isn't in the deployment target of Chrome:
# initialization of the Metal backend is behind a IsMetalSupported check so
# Dawn won't call Metal functions on macOS 10.10.
# At the time this is written Chromium supports 10.10.0 and above, so if we
# aren't on 10.11 it means we are on 10.11 and above, and Metal is available.
# Skipping this check on 10.11 and above is important as it allows getting
# proper compilation warning when using 10.12 and above feature for example.
# TODO(cwallez@chromium.org): Consider using API_AVAILABLE annotations on all
# metal code in dawn once crbug.com/1004024 is sorted out if Chromium still
# supports 10.10 then.
if (is_mac && mac_min_system_version == "10.10.0") {
cflags_objcc = [ "-Wno-unguarded-availability" ]
}
}
config("libdawn_native_weak_framework") {
if (is_mac && dawn_enable_metal) {
ldflags = [
"-weak_framework",
"Metal",
]
}
}
dawn_json_generator("libdawn_native_utils_gen") {
target = "dawn_native_utils"
outputs = [
"src/dawn_native/ProcTable.cpp",
"src/dawn_native/wgpu_structs_autogen.h",
"src/dawn_native/wgpu_structs_autogen.cpp",
"src/dawn_native/ValidationUtils_autogen.h",
"src/dawn_native/ValidationUtils_autogen.cpp",
]
}
if (dawn_enable_opengl) {
dawn_generator("libdawn_native_opengl_loader_gen") {
script = "${dawn_root}/generator/opengl_loader_generator.py"
args = [
"--gl-xml",
rebase_path("${dawn_root}/third_party/khronos/gl.xml", root_build_dir),
"--supported-extensions",
rebase_path("opengl/supported_extensions.json", root_build_dir),
]
outputs = [
"src/dawn_native/opengl/OpenGLFunctionsBase_autogen.cpp",
"src/dawn_native/opengl/OpenGLFunctionsBase_autogen.h",
"src/dawn_native/opengl/opengl_platform_autogen.h",
]
}
}
# Public libdawn_native headers so they can be publically visible for
# dependencies of libdawn_native
source_set("libdawn_native_headers") {
public_deps = [
"${dawn_root}/src/dawn:dawncpp_headers",
]
all_dependent_configs = [ "${dawn_root}/src/common:dawn_public_include_dirs" ]
sources = [
"${dawn_root}/src/include/dawn_native/DawnNative.h",
"${dawn_root}/src/include/dawn_native/dawn_native_export.h",
# Include all backend's public headers so that dependencies can include
# them even when the backends are disabled.
"${dawn_root}/src/include/dawn_native/D3D12Backend.h",
"${dawn_root}/src/include/dawn_native/MetalBackend.h",
"${dawn_root}/src/include/dawn_native/NullBackend.h",
"${dawn_root}/src/include/dawn_native/OpenGLBackend.h",
"${dawn_root}/src/include/dawn_native/VulkanBackend.h",
]
}
# The meat of the compilation for libdawn_native so that we can cheaply have
# shared_library / static_library versions of it. It compiles all the files
# except those that define exported symbols.
source_set("libdawn_native_sources") {
deps = [
":libdawn_native_headers",
":libdawn_native_utils_gen",
"${dawn_root}/src/common",
"${dawn_shaderc_dir}:spirv_cross",
"${dawn_spirv_tools_dir}:spvtools_val",
]
defines = []
libs = []
data_deps = []
configs += [ ":libdawn_native_internal" ]
# Dependencies that are needed to compile libdawn_native entry points in
# FooBackend.cpp need to be public deps so they are propagated to the
# libdawn_native target
public_deps = [
"${dawn_root}/src/dawn_platform",
"${dawn_shaderc_dir}:libshaderc_spvc",
]
sources = get_target_outputs(":libdawn_native_utils_gen")
sources += [
"Adapter.cpp",
"Adapter.h",
"AttachmentState.cpp",
"AttachmentState.h",
"BackendConnection.cpp",
"BackendConnection.h",
"BindGroup.cpp",
"BindGroup.h",
"BindGroupAndStorageBarrierTracker.h",
"BindGroupLayout.cpp",
"BindGroupLayout.h",
"BindGroupTracker.h",
"BindingInfo.h",
"BuddyAllocator.cpp",
"BuddyAllocator.h",
"BuddyMemoryAllocator.cpp",
"BuddyMemoryAllocator.h",
"Buffer.cpp",
"Buffer.h",
"CachedObject.cpp",
"CachedObject.h",
"CommandAllocator.cpp",
"CommandAllocator.h",
"CommandBuffer.cpp",
"CommandBuffer.h",
"CommandBufferStateTracker.cpp",
"CommandBufferStateTracker.h",
"CommandEncoder.cpp",
"CommandEncoder.h",
"CommandValidation.cpp",
"CommandValidation.h",
"Commands.cpp",
"Commands.h",
"ComputePassEncoder.cpp",
"ComputePassEncoder.h",
"ComputePipeline.cpp",
"ComputePipeline.h",
"Device.cpp",
"Device.h",
"DynamicUploader.cpp",
"DynamicUploader.h",
"EncodingContext.cpp",
"EncodingContext.h",
"Error.cpp",
"Error.h",
"ErrorData.cpp",
"ErrorData.h",
"ErrorInjector.cpp",
"ErrorInjector.h",
"ErrorScope.cpp",
"ErrorScope.h",
"ErrorScopeTracker.cpp",
"ErrorScopeTracker.h",
"Extensions.cpp",
"Extensions.h",
"Fence.cpp",
"Fence.h",
"FenceSignalTracker.cpp",
"FenceSignalTracker.h",
"Format.cpp",
"Format.h",
"Forward.h",
"Instance.cpp",
"Instance.h",
"ObjectBase.cpp",
"ObjectBase.h",
"PassResourceUsage.h",
"PassResourceUsageTracker.cpp",
"PassResourceUsageTracker.h",
"PerStage.cpp",
"PerStage.h",
"Pipeline.cpp",
"Pipeline.h",
"PipelineLayout.cpp",
"PipelineLayout.h",
"ProgrammablePassEncoder.cpp",
"ProgrammablePassEncoder.h",
"Queue.cpp",
"Queue.h",
"RefCounted.cpp",
"RefCounted.h",
"RenderBundle.cpp",
"RenderBundle.h",
"RenderBundleEncoder.cpp",
"RenderBundleEncoder.h",
"RenderEncoderBase.cpp",
"RenderEncoderBase.h",
"RenderPassEncoder.cpp",
"RenderPassEncoder.h",
"RenderPipeline.cpp",
"RenderPipeline.h",
"ResourceHeap.h",
"ResourceHeapAllocator.h",
"ResourceMemoryAllocation.cpp",
"ResourceMemoryAllocation.h",
"RingBufferAllocator.cpp",
"RingBufferAllocator.h",
"Sampler.cpp",
"Sampler.h",
"ShaderModule.cpp",
"ShaderModule.h",
"StagingBuffer.cpp",
"StagingBuffer.h",
"Surface.cpp",
"Surface.h",
"SwapChain.cpp",
"SwapChain.h",
"Texture.cpp",
"Texture.h",
"ToBackend.h",
"Toggles.cpp",
"Toggles.h",
"dawn_platform.h",
]
if (dawn_enable_d3d12) {
libs += [ "dxguid.lib" ]
sources += [
"d3d12/AdapterD3D12.cpp",
"d3d12/AdapterD3D12.h",
"d3d12/BackendD3D12.cpp",
"d3d12/BackendD3D12.h",
"d3d12/BindGroupD3D12.cpp",
"d3d12/BindGroupD3D12.h",
"d3d12/BindGroupLayoutD3D12.cpp",
"d3d12/BindGroupLayoutD3D12.h",
"d3d12/BufferD3D12.cpp",
"d3d12/BufferD3D12.h",
"d3d12/CPUDescriptorHeapAllocationD3D12.cpp",
"d3d12/CPUDescriptorHeapAllocationD3D12.h",
"d3d12/CommandAllocatorManager.cpp",
"d3d12/CommandAllocatorManager.h",
"d3d12/CommandBufferD3D12.cpp",
"d3d12/CommandBufferD3D12.h",
"d3d12/CommandRecordingContext.cpp",
"d3d12/CommandRecordingContext.h",
"d3d12/ComputePipelineD3D12.cpp",
"d3d12/ComputePipelineD3D12.h",
"d3d12/D3D12Error.cpp",
"d3d12/D3D12Error.h",
"d3d12/D3D12Info.cpp",
"d3d12/D3D12Info.h",
"d3d12/DescriptorHeapAllocationD3D12.cpp",
"d3d12/DescriptorHeapAllocationD3D12.h",
"d3d12/DescriptorHeapAllocator.cpp",
"d3d12/DescriptorHeapAllocator.h",
"d3d12/DeviceD3D12.cpp",
"d3d12/DeviceD3D12.h",
"d3d12/Forward.h",
"d3d12/HeapAllocatorD3D12.cpp",
"d3d12/HeapAllocatorD3D12.h",
"d3d12/HeapD3D12.cpp",
"d3d12/HeapD3D12.h",
"d3d12/NativeSwapChainImplD3D12.cpp",
"d3d12/NativeSwapChainImplD3D12.h",
"d3d12/NonShaderVisibleDescriptorAllocatorD3D12.cpp",
"d3d12/NonShaderVisibleDescriptorAllocatorD3D12.h",
"d3d12/PipelineLayoutD3D12.cpp",
"d3d12/PipelineLayoutD3D12.h",
"d3d12/PlatformFunctions.cpp",
"d3d12/PlatformFunctions.h",
"d3d12/QueueD3D12.cpp",
"d3d12/QueueD3D12.h",
"d3d12/RenderPassBuilderD3D12.cpp",
"d3d12/RenderPassBuilderD3D12.h",
"d3d12/RenderPipelineD3D12.cpp",
"d3d12/RenderPipelineD3D12.h",
"d3d12/ResidencyManagerD3D12.cpp",
"d3d12/ResidencyManagerD3D12.h",
"d3d12/ResourceAllocatorManagerD3D12.cpp",
"d3d12/ResourceAllocatorManagerD3D12.h",
"d3d12/ResourceHeapAllocationD3D12.cpp",
"d3d12/ResourceHeapAllocationD3D12.h",
"d3d12/SamplerD3D12.cpp",
"d3d12/SamplerD3D12.h",
"d3d12/ShaderModuleD3D12.cpp",
"d3d12/ShaderModuleD3D12.h",
"d3d12/ShaderVisibleDescriptorAllocatorD3D12.cpp",
"d3d12/ShaderVisibleDescriptorAllocatorD3D12.h",
"d3d12/StagingBufferD3D12.cpp",
"d3d12/StagingBufferD3D12.h",
"d3d12/SwapChainD3D12.cpp",
"d3d12/SwapChainD3D12.h",
"d3d12/TextureCopySplitter.cpp",
"d3d12/TextureCopySplitter.h",
"d3d12/TextureD3D12.cpp",
"d3d12/TextureD3D12.h",
"d3d12/UtilsD3D12.cpp",
"d3d12/UtilsD3D12.h",
"d3d12/d3d12_platform.h",
]
}
if (dawn_enable_metal) {
libs += [
"Cocoa.framework",
"IOKit.framework",
"IOSurface.framework",
"QuartzCore.framework",
]
sources += [
"Surface_metal.mm",
"metal/BackendMTL.h",
"metal/BackendMTL.mm",
"metal/BindGroupLayoutMTL.h",
"metal/BindGroupLayoutMTL.mm",
"metal/BindGroupMTL.h",
"metal/BindGroupMTL.mm",
"metal/BufferMTL.h",
"metal/BufferMTL.mm",
"metal/CommandBufferMTL.h",
"metal/CommandBufferMTL.mm",
"metal/CommandRecordingContext.h",
"metal/CommandRecordingContext.mm",
"metal/ComputePipelineMTL.h",
"metal/ComputePipelineMTL.mm",
"metal/DeviceMTL.h",
"metal/DeviceMTL.mm",
"metal/Forward.h",
"metal/PipelineLayoutMTL.h",
"metal/PipelineLayoutMTL.mm",
"metal/QueueMTL.h",
"metal/QueueMTL.mm",
"metal/RenderPipelineMTL.h",
"metal/RenderPipelineMTL.mm",
"metal/SamplerMTL.h",
"metal/SamplerMTL.mm",
"metal/ShaderModuleMTL.h",
"metal/ShaderModuleMTL.mm",
"metal/StagingBufferMTL.h",
"metal/StagingBufferMTL.mm",
"metal/SwapChainMTL.h",
"metal/SwapChainMTL.mm",
"metal/TextureMTL.h",
"metal/TextureMTL.mm",
"metal/UtilsMetal.h",
"metal/UtilsMetal.mm",
]
}
if (dawn_enable_null) {
sources += [
"null/DeviceNull.cpp",
"null/DeviceNull.h",
]
}
if (dawn_enable_opengl) {
public_deps += [
":libdawn_native_opengl_loader_gen",
"${dawn_root}/third_party:khronos_platform",
]
sources += get_target_outputs(":libdawn_native_opengl_loader_gen")
sources += [
"opengl/BackendGL.cpp",
"opengl/BackendGL.h",
"opengl/BindGroupGL.cpp",
"opengl/BindGroupGL.h",
"opengl/BindGroupLayoutGL.cpp",
"opengl/BindGroupLayoutGL.h",
"opengl/BufferGL.cpp",
"opengl/BufferGL.h",
"opengl/CommandBufferGL.cpp",
"opengl/CommandBufferGL.h",
"opengl/ComputePipelineGL.cpp",
"opengl/ComputePipelineGL.h",
"opengl/DeviceGL.cpp",
"opengl/DeviceGL.h",
"opengl/Forward.h",
"opengl/GLFormat.cpp",
"opengl/GLFormat.h",
"opengl/NativeSwapChainImplGL.cpp",
"opengl/NativeSwapChainImplGL.h",
"opengl/OpenGLFunctions.cpp",
"opengl/OpenGLFunctions.h",
"opengl/PersistentPipelineStateGL.cpp",
"opengl/PersistentPipelineStateGL.h",
"opengl/PipelineGL.cpp",
"opengl/PipelineGL.h",
"opengl/PipelineLayoutGL.cpp",
"opengl/PipelineLayoutGL.h",
"opengl/QueueGL.cpp",
"opengl/QueueGL.h",
"opengl/RenderPipelineGL.cpp",
"opengl/RenderPipelineGL.h",
"opengl/SamplerGL.cpp",
"opengl/SamplerGL.h",
"opengl/ShaderModuleGL.cpp",
"opengl/ShaderModuleGL.h",
"opengl/SwapChainGL.cpp",
"opengl/SwapChainGL.h",
"opengl/TextureGL.cpp",
"opengl/TextureGL.h",
"opengl/UtilsGL.cpp",
"opengl/UtilsGL.h",
"opengl/opengl_platform.h",
]
}
if (dawn_enable_vulkan) {
public_deps += [ "${dawn_root}/third_party:vulkan_headers" ]
sources += [
"vulkan/AdapterVk.cpp",
"vulkan/AdapterVk.h",
"vulkan/BackendVk.cpp",
"vulkan/BackendVk.h",
"vulkan/BindGroupLayoutVk.cpp",
"vulkan/BindGroupLayoutVk.h",
"vulkan/BindGroupVk.cpp",
"vulkan/BindGroupVk.h",
"vulkan/BufferVk.cpp",
"vulkan/BufferVk.h",
"vulkan/CommandBufferVk.cpp",
"vulkan/CommandBufferVk.h",
"vulkan/CommandRecordingContext.h",
"vulkan/ComputePipelineVk.cpp",
"vulkan/ComputePipelineVk.h",
"vulkan/DescriptorSetService.cpp",
"vulkan/DescriptorSetService.h",
"vulkan/DeviceVk.cpp",
"vulkan/DeviceVk.h",
"vulkan/ExternalHandle.h",
"vulkan/FencedDeleter.cpp",
"vulkan/FencedDeleter.h",
"vulkan/Forward.h",
"vulkan/NativeSwapChainImplVk.cpp",
"vulkan/NativeSwapChainImplVk.h",
"vulkan/PipelineLayoutVk.cpp",
"vulkan/PipelineLayoutVk.h",
"vulkan/QueueVk.cpp",
"vulkan/QueueVk.h",
"vulkan/RenderPassCache.cpp",
"vulkan/RenderPassCache.h",
"vulkan/RenderPipelineVk.cpp",
"vulkan/RenderPipelineVk.h",
"vulkan/ResourceHeapVk.cpp",
"vulkan/ResourceHeapVk.h",
"vulkan/ResourceMemoryAllocatorVk.cpp",
"vulkan/ResourceMemoryAllocatorVk.h",
"vulkan/SamplerVk.cpp",
"vulkan/SamplerVk.h",
"vulkan/ShaderModuleVk.cpp",
"vulkan/ShaderModuleVk.h",
"vulkan/StagingBufferVk.cpp",
"vulkan/StagingBufferVk.h",
"vulkan/SwapChainVk.cpp",
"vulkan/SwapChainVk.h",
"vulkan/TextureVk.cpp",
"vulkan/TextureVk.h",
"vulkan/UtilsVulkan.cpp",
"vulkan/UtilsVulkan.h",
"vulkan/VulkanError.cpp",
"vulkan/VulkanError.h",
"vulkan/VulkanFunctions.cpp",
"vulkan/VulkanFunctions.h",
"vulkan/VulkanInfo.cpp",
"vulkan/VulkanInfo.h",
"vulkan/external_memory/MemoryService.h",
"vulkan/external_semaphore/SemaphoreService.h",
]
if (is_chromeos) {
sources += [
"vulkan/external_memory/MemoryServiceDmaBuf.cpp",
"vulkan/external_semaphore/SemaphoreServiceOpaqueFD.cpp",
]
} else if (is_linux) {
sources += [
"vulkan/external_memory/MemoryServiceOpaqueFD.cpp",
"vulkan/external_semaphore/SemaphoreServiceOpaqueFD.cpp",
]
} else if (is_fuchsia) {
sources += [
"vulkan/external_memory/MemoryServiceZirconHandle.cpp",
"vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp",
]
} else {
sources += [
"vulkan/external_memory/MemoryServiceNull.cpp",
"vulkan/external_semaphore/SemaphoreServiceNull.cpp",
]
}
if (build_with_chromium && is_fuchsia) {
# Necessary to ensure that the Vulkan libraries will be in the
# final Fuchsia package.
data_deps = [
# NOTE: The line below is a work around for http://crbug.com/1001081
"//third_party/fuchsia-sdk/sdk:trace_engine",
"//third_party/fuchsia-sdk:vulkan_base",
"//third_party/fuchsia-sdk:vulkan_validation",
]
}
if (dawn_enable_vulkan_validation_layers) {
defines += [
"DAWN_ENABLE_VULKAN_VALIDATION_LAYERS",
"DAWN_VK_DATA_DIR=\"$vulkan_data_subdir\"",
]
}
if (use_swiftshader) {
data_deps += [
"${dawn_swiftshader_dir}/src/Vulkan:icd_file",
"${dawn_swiftshader_dir}/src/Vulkan:swiftshader_libvulkan",
]
defines += [
"DAWN_ENABLE_SWIFTSHADER",
"DAWN_SWIFTSHADER_VK_ICD_JSON=\"${swiftshader_icd_file_name}\"",
]
}
}
if (dawn_use_x11) {
libs += [ "X11" ]
}
}
# The static and shared libraries for libdawn_native. Most of the files are
# already compiled in libdawn_native_sources, but we still need to compile
# files defining exported symbols.
dawn_component("libdawn_native") {
DEFINE_PREFIX = "DAWN_NATIVE"
#Make headers publically visible
public_deps = [
":libdawn_native_headers",
]
deps = [
":libdawn_native_sources",
"${dawn_root}/src/common",
]
sources = [
"DawnNative.cpp",
]
configs = [ ":libdawn_native_internal" ]
public_configs = [ ":libdawn_native_weak_framework" ]
if (dawn_enable_d3d12) {
sources += [ "d3d12/D3D12Backend.cpp" ]
}
if (dawn_enable_metal) {
sources += [ "metal/MetalBackend.mm" ]
}
if (dawn_enable_null) {
sources += [ "null/NullBackend.cpp" ]
}
if (dawn_enable_opengl) {
sources += [ "opengl/OpenGLBackend.cpp" ]
}
if (dawn_enable_vulkan) {
sources += [ "vulkan/VulkanBackend.cpp" ]
if (dawn_enable_vulkan_validation_layers) {
data_deps = [
"${dawn_vulkan_validation_layers_dir}:vulkan_validation_layers",
]
if (!is_android) {
data_deps +=
[ "${dawn_vulkan_validation_layers_dir}:vulkan_gen_json_files" ]
}
}
}
}

View File

@ -0,0 +1,30 @@
# Copyright 2020 The Dawn Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("../../scripts/dawn_overrides_with_defaults.gni")
source_set("dawn_platform") {
configs += [ "${dawn_root}/src/common:dawn_internal" ]
sources = [
"${dawn_root}/src/include/dawn_platform/DawnPlatform.h",
"tracing/EventTracer.cpp",
"tracing/EventTracer.h",
"tracing/TraceEvent.h",
]
deps = [
"${dawn_root}/src/common",
]
}

View File

@ -14,12 +14,8 @@
import("../../scripts/dawn_overrides_with_defaults.gni") import("../../scripts/dawn_overrides_with_defaults.gni")
import("${dawn_root}/scripts/dawn_component.gni")
import("${dawn_root}/generator/dawn_generator.gni") import("${dawn_root}/generator/dawn_generator.gni")
import("${dawn_root}/scripts/dawn_component.gni")
###############################################################################
# libdawn_wire
###############################################################################
# Public libdawn_wire headers so they can be publically visible for # Public libdawn_wire headers so they can be publically visible for
# dependencies of libdawn_wire # dependencies of libdawn_wire
@ -35,3 +31,65 @@ source_set("libdawn_wire_headers") {
"${dawn_root}/src/include/dawn_wire/dawn_wire_export.h", "${dawn_root}/src/include/dawn_wire/dawn_wire_export.h",
] ]
} }
dawn_json_generator("libdawn_wire_gen") {
target = "dawn_wire"
outputs = [
"src/dawn_wire/WireCmd_autogen.h",
"src/dawn_wire/WireCmd_autogen.cpp",
"src/dawn_wire/client/ApiObjects_autogen.h",
"src/dawn_wire/client/ApiProcs_autogen.cpp",
"src/dawn_wire/client/ApiProcs_autogen.h",
"src/dawn_wire/client/ClientBase_autogen.h",
"src/dawn_wire/client/ClientHandlers_autogen.cpp",
"src/dawn_wire/client/ClientPrototypes_autogen.inc",
"src/dawn_wire/server/ServerBase_autogen.h",
"src/dawn_wire/server/ServerDoers_autogen.cpp",
"src/dawn_wire/server/ServerHandlers_autogen.cpp",
"src/dawn_wire/server/ServerPrototypes_autogen.inc",
]
}
dawn_component("libdawn_wire") {
DEFINE_PREFIX = "DAWN_WIRE"
deps = [
":libdawn_wire_gen",
"${dawn_root}/src/common",
]
configs = [ "${dawn_root}/src/common:dawn_internal" ]
sources = get_target_outputs(":libdawn_wire_gen")
sources += [
"WireClient.cpp",
"WireDeserializeAllocator.cpp",
"WireDeserializeAllocator.h",
"WireServer.cpp",
"client/ApiObjects.h",
"client/ApiProcs.cpp",
"client/Buffer.cpp",
"client/Buffer.h",
"client/Client.cpp",
"client/Client.h",
"client/ClientDoers.cpp",
"client/ClientInlineMemoryTransferService.cpp",
"client/Device.cpp",
"client/Device.h",
"client/Fence.cpp",
"client/Fence.h",
"client/ObjectAllocator.h",
"server/ObjectStorage.h",
"server/Server.cpp",
"server/Server.h",
"server/ServerBuffer.cpp",
"server/ServerDevice.cpp",
"server/ServerFence.cpp",
"server/ServerInlineMemoryTransferService.cpp",
"server/ServerQueue.cpp",
]
# Make headers publicly visible
public_deps = [
":libdawn_wire_headers",
]
}

View File

@ -85,11 +85,11 @@ static_library("dawn_wire_server_fuzzer_common") {
"DawnWireServerFuzzer.h", "DawnWireServerFuzzer.h",
] ]
public_deps = [ public_deps = [
"${dawn_root}/:libdawn_native_static",
"${dawn_root}/:libdawn_wire_static",
"${dawn_root}/src/common", "${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn:libdawn_proc", "${dawn_root}/src/dawn:libdawn_proc",
"${dawn_root}/src/dawn_native:libdawn_native_static",
"${dawn_root}/src/dawn_wire:libdawn_wire_static",
] ]
} }