dawn-cmake/BUILD.gn

665 lines
20 KiB
Plaintext
Raw Normal View History

# Copyright 2018 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("//build_overrides/build.gni")
import("generator/dawn_generator.gni")
import("scripts/dawn_features.gni")
import("scripts/dawn_overrides_with_defaults.gni")
import("//testing/test.gni")
Enable Vulkan for Chromium Fuchsia build. Enable the Vulkan backend when building Dawn with the Chromium build system for Fuchsia. To make this work properly the following is required: - Modify VulkanInfo.cpp and BackendVk.cpp to correctly probe the Fuchsia swapchain layer and its layer extension, as well as enabling them when creating a new VkInstance. - Modify VulkanFunctions.cpp to load the Fuchsia swapchain related extension for this platform only. - Provide a small mock GLFW library for Fuchsia under src/utils/Glfw3Fuchsia.cpp, since the upstream project does not support this platform at all. Its purpose is only to allow the creation of the right VulkanBinding instance, which depends on the creation of a display surface for latter swapchain creation. - Add //third_party/fuchsia-sdk:vulkan_base and //third_party/fuchsia-sdk:vulkan_validation as data_deps of the libdawn_native_sources target in order to ensure that the Fuchsia package created by the build system will include the correct Vulkan libraries (loader and validation layers). This builds correctly, and both dawn_unittests and dawn_end2end_tests will run on a real Fuchsia device or inside the Fuchsia emulator, using either GPU virtualization or a software-based renderer. Note: dawn_unittests will also run inside QEMU, but not dawn_end2end_tests, since the latter requires proper GPU emulation which is not available in this environment. NOTE: All end2end tests pass using a device with an "Intel HD Graphics 615 (Kaby Lake GT2)" adapter. However: - For some reason, a single test takes up to 129 seconds to pass (BufferSetSubDataTests.ManySetSubData/Vulkan). - The test process crashes inside VkDestroyInstance(), apparently inside the Fuchsia-specific imagepipe layer (which implements swapchain support). This is likely a bug in the layer itself, and not Dawn. Also, may end2end tests will crash when run inside the Fuchsia emulator (which uses GPU virtualization to talk to the host GPU). The crashes happen inside libvulkan-goldfish.so, the emulator-specific Vulkan ICD on this sytem. Not a Dawn bug either. Bug=dawn:221 Change-Id: Id3598b673e8c6393f24db728b8da49fdde3cac76 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8963 Commit-Queue: David Turner <digit@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-09 10:52:08 +00:00
###############################################################################
# GLFW wrapping target
###############################################################################
supports_glfw_for_windowing = is_win || (is_linux && !is_chromeos) || is_mac
# GLFW does not support ChromeOS, Android or Fuchsia, so provide a small mock
# library that can be linked into the Dawn tests on these platforms. Otherwise,
# use the real library from third_party/.
if (supports_glfw_for_windowing) {
group("dawn_glfw") {
public_deps = [
"third_party:glfw",
]
}
} else if (is_fuchsia) {
# The mock implementation of GLFW on Fuchsia
Enable Vulkan for Chromium Fuchsia build. Enable the Vulkan backend when building Dawn with the Chromium build system for Fuchsia. To make this work properly the following is required: - Modify VulkanInfo.cpp and BackendVk.cpp to correctly probe the Fuchsia swapchain layer and its layer extension, as well as enabling them when creating a new VkInstance. - Modify VulkanFunctions.cpp to load the Fuchsia swapchain related extension for this platform only. - Provide a small mock GLFW library for Fuchsia under src/utils/Glfw3Fuchsia.cpp, since the upstream project does not support this platform at all. Its purpose is only to allow the creation of the right VulkanBinding instance, which depends on the creation of a display surface for latter swapchain creation. - Add //third_party/fuchsia-sdk:vulkan_base and //third_party/fuchsia-sdk:vulkan_validation as data_deps of the libdawn_native_sources target in order to ensure that the Fuchsia package created by the build system will include the correct Vulkan libraries (loader and validation layers). This builds correctly, and both dawn_unittests and dawn_end2end_tests will run on a real Fuchsia device or inside the Fuchsia emulator, using either GPU virtualization or a software-based renderer. Note: dawn_unittests will also run inside QEMU, but not dawn_end2end_tests, since the latter requires proper GPU emulation which is not available in this environment. NOTE: All end2end tests pass using a device with an "Intel HD Graphics 615 (Kaby Lake GT2)" adapter. However: - For some reason, a single test takes up to 129 seconds to pass (BufferSetSubDataTests.ManySetSubData/Vulkan). - The test process crashes inside VkDestroyInstance(), apparently inside the Fuchsia-specific imagepipe layer (which implements swapchain support). This is likely a bug in the layer itself, and not Dawn. Also, may end2end tests will crash when run inside the Fuchsia emulator (which uses GPU virtualization to talk to the host GPU). The crashes happen inside libvulkan-goldfish.so, the emulator-specific Vulkan ICD on this sytem. Not a Dawn bug either. Bug=dawn:221 Change-Id: Id3598b673e8c6393f24db728b8da49fdde3cac76 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8963 Commit-Queue: David Turner <digit@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-09 10:52:08 +00:00
config("dawn_glfw_public_config") {
# Allow inclusion of <GLFW/glfw3.h>
include_dirs = [ "${dawn_glfw_dir}/include" ]
Enable Vulkan for Chromium Fuchsia build. Enable the Vulkan backend when building Dawn with the Chromium build system for Fuchsia. To make this work properly the following is required: - Modify VulkanInfo.cpp and BackendVk.cpp to correctly probe the Fuchsia swapchain layer and its layer extension, as well as enabling them when creating a new VkInstance. - Modify VulkanFunctions.cpp to load the Fuchsia swapchain related extension for this platform only. - Provide a small mock GLFW library for Fuchsia under src/utils/Glfw3Fuchsia.cpp, since the upstream project does not support this platform at all. Its purpose is only to allow the creation of the right VulkanBinding instance, which depends on the creation of a display surface for latter swapchain creation. - Add //third_party/fuchsia-sdk:vulkan_base and //third_party/fuchsia-sdk:vulkan_validation as data_deps of the libdawn_native_sources target in order to ensure that the Fuchsia package created by the build system will include the correct Vulkan libraries (loader and validation layers). This builds correctly, and both dawn_unittests and dawn_end2end_tests will run on a real Fuchsia device or inside the Fuchsia emulator, using either GPU virtualization or a software-based renderer. Note: dawn_unittests will also run inside QEMU, but not dawn_end2end_tests, since the latter requires proper GPU emulation which is not available in this environment. NOTE: All end2end tests pass using a device with an "Intel HD Graphics 615 (Kaby Lake GT2)" adapter. However: - For some reason, a single test takes up to 129 seconds to pass (BufferSetSubDataTests.ManySetSubData/Vulkan). - The test process crashes inside VkDestroyInstance(), apparently inside the Fuchsia-specific imagepipe layer (which implements swapchain support). This is likely a bug in the layer itself, and not Dawn. Also, may end2end tests will crash when run inside the Fuchsia emulator (which uses GPU virtualization to talk to the host GPU). The crashes happen inside libvulkan-goldfish.so, the emulator-specific Vulkan ICD on this sytem. Not a Dawn bug either. Bug=dawn:221 Change-Id: Id3598b673e8c6393f24db728b8da49fdde3cac76 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8963 Commit-Queue: David Turner <digit@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-09 10:52:08 +00:00
# The GLFW/glfw3.h header includes <GL/gl.h> by default, but the latter
# does not exist on Fuchsia. Defining GLFW_INCLUDE_NONE helps work around
# the issue, but it needs to be defined for any file that includes the
# header.
defines = [
"GLFW_INCLUDE_NONE",
"GLFW_INCLUDE_VULKAN",
]
}
static_library("dawn_glfw") {
sources = [
# NOTE: The header below is required to pass "gn check".
"${dawn_glfw_dir}/include/GLFW/glfw3.h",
"src/utils/Glfw3Fuchsia.cpp",
]
public_configs = [ ":dawn_glfw_public_config" ]
deps = [
"${dawn_root}/src/common",
]
}
} else {
# Just skip GLFW on other systems
Enable Vulkan for Chromium Fuchsia build. Enable the Vulkan backend when building Dawn with the Chromium build system for Fuchsia. To make this work properly the following is required: - Modify VulkanInfo.cpp and BackendVk.cpp to correctly probe the Fuchsia swapchain layer and its layer extension, as well as enabling them when creating a new VkInstance. - Modify VulkanFunctions.cpp to load the Fuchsia swapchain related extension for this platform only. - Provide a small mock GLFW library for Fuchsia under src/utils/Glfw3Fuchsia.cpp, since the upstream project does not support this platform at all. Its purpose is only to allow the creation of the right VulkanBinding instance, which depends on the creation of a display surface for latter swapchain creation. - Add //third_party/fuchsia-sdk:vulkan_base and //third_party/fuchsia-sdk:vulkan_validation as data_deps of the libdawn_native_sources target in order to ensure that the Fuchsia package created by the build system will include the correct Vulkan libraries (loader and validation layers). This builds correctly, and both dawn_unittests and dawn_end2end_tests will run on a real Fuchsia device or inside the Fuchsia emulator, using either GPU virtualization or a software-based renderer. Note: dawn_unittests will also run inside QEMU, but not dawn_end2end_tests, since the latter requires proper GPU emulation which is not available in this environment. NOTE: All end2end tests pass using a device with an "Intel HD Graphics 615 (Kaby Lake GT2)" adapter. However: - For some reason, a single test takes up to 129 seconds to pass (BufferSetSubDataTests.ManySetSubData/Vulkan). - The test process crashes inside VkDestroyInstance(), apparently inside the Fuchsia-specific imagepipe layer (which implements swapchain support). This is likely a bug in the layer itself, and not Dawn. Also, may end2end tests will crash when run inside the Fuchsia emulator (which uses GPU virtualization to talk to the host GPU). The crashes happen inside libvulkan-goldfish.so, the emulator-specific Vulkan ICD on this sytem. Not a Dawn bug either. Bug=dawn:221 Change-Id: Id3598b673e8c6393f24db728b8da49fdde3cac76 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8963 Commit-Queue: David Turner <digit@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-09 10:52:08 +00:00
group("dawn_glfw") {
}
}
###############################################################################
# Utils for tests and samples
###############################################################################
static_library("dawn_utils") {
configs += [ "${dawn_root}/src/common:dawn_internal" ]
sources = [
"src/utils/ComboRenderBundleEncoderDescriptor.cpp",
"src/utils/ComboRenderBundleEncoderDescriptor.h",
"src/utils/ComboRenderPipelineDescriptor.cpp",
"src/utils/ComboRenderPipelineDescriptor.h",
"src/utils/SystemUtils.cpp",
"src/utils/SystemUtils.h",
"src/utils/TerribleCommandBuffer.cpp",
"src/utils/TerribleCommandBuffer.h",
"src/utils/TextureFormatUtils.cpp",
"src/utils/TextureFormatUtils.h",
"src/utils/Timer.h",
"src/utils/WGPUHelpers.cpp",
"src/utils/WGPUHelpers.h",
]
deps = [
"${dawn_root}/src/common",
"${dawn_root}/src/dawn_native",
"${dawn_root}/src/dawn_wire",
"${dawn_shaderc_dir}:libshaderc",
]
libs = []
if (is_win) {
sources += [ "src/utils/WindowsTimer.cpp" ]
} else if (is_mac) {
sources += [
"src/utils/OSXTimer.cpp",
"src/utils/ObjCUtils.h",
"src/utils/ObjCUtils.mm",
]
libs += [ "QuartzCore.framework" ]
} else {
sources += [ "src/utils/PosixTimer.cpp" ]
}
if (supports_glfw_for_windowing) {
sources += [
"src/utils/GLFWUtils.cpp",
"src/utils/GLFWUtils.h",
]
deps += [ ":dawn_glfw" ]
if (dawn_enable_metal) {
sources += [ "src/utils/GLFWUtils_metal.mm" ]
libs += [ "Metal.framework" ]
}
}
public_deps = [
"${dawn_root}/src/dawn:dawncpp_headers",
]
}
###############################################################################
# Dawn test targets
###############################################################################
dawn_json_generator("mock_webgpu_gen") {
target = "mock_webgpu"
outputs = [
"src/dawn/mock_webgpu.h",
"src/dawn/mock_webgpu.cpp",
]
}
test("dawn_unittests") {
configs += [ "${dawn_root}/src/common:dawn_internal" ]
deps = [
":dawn_utils",
":mock_webgpu_gen",
"${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn:libdawn_proc",
"${dawn_root}/src/dawn_native",
"${dawn_root}/src/dawn_native:dawn_native_sources",
"${dawn_root}/src/dawn_wire",
"third_party:gmock_and_gtest",
]
# Add internal dawn_native config for internal unittests.
configs += [ "${dawn_root}/src/dawn_native:dawn_native_internal" ]
sources = get_target_outputs(":mock_webgpu_gen")
sources += [
"src/dawn_wire/client/ClientMemoryTransferService_mock.cpp",
"src/dawn_wire/client/ClientMemoryTransferService_mock.h",
"src/dawn_wire/server/ServerMemoryTransferService_mock.cpp",
"src/dawn_wire/server/ServerMemoryTransferService_mock.h",
"src/tests/unittests/BitSetIteratorTests.cpp",
"src/tests/unittests/BuddyAllocatorTests.cpp",
"src/tests/unittests/BuddyMemoryAllocatorTests.cpp",
"src/tests/unittests/CommandAllocatorTests.cpp",
"src/tests/unittests/EnumClassBitmasksTests.cpp",
"src/tests/unittests/ErrorTests.cpp",
"src/tests/unittests/ExtensionTests.cpp",
"src/tests/unittests/GetProcAddressTests.cpp",
"src/tests/unittests/LinkedListTests.cpp",
"src/tests/unittests/MathTests.cpp",
"src/tests/unittests/ObjectBaseTests.cpp",
"src/tests/unittests/PerStageTests.cpp",
"src/tests/unittests/PlacementAllocatedTests.cpp",
"src/tests/unittests/RefCountedTests.cpp",
"src/tests/unittests/ResultTests.cpp",
"src/tests/unittests/RingBufferAllocatorTests.cpp",
"src/tests/unittests/SerialMapTests.cpp",
"src/tests/unittests/SerialQueueTests.cpp",
"src/tests/unittests/SlabAllocatorTests.cpp",
"src/tests/unittests/SystemUtilsTests.cpp",
"src/tests/unittests/ToBackendTests.cpp",
"src/tests/unittests/validation/BindGroupValidationTests.cpp",
"src/tests/unittests/validation/BufferValidationTests.cpp",
"src/tests/unittests/validation/CommandBufferValidationTests.cpp",
"src/tests/unittests/validation/ComputeIndirectValidationTests.cpp",
"src/tests/unittests/validation/ComputePassValidationTests.cpp",
"src/tests/unittests/validation/ComputeValidationTests.cpp",
"src/tests/unittests/validation/CopyCommandsValidationTests.cpp",
"src/tests/unittests/validation/DebugMarkerValidationTests.cpp",
"src/tests/unittests/validation/DrawIndirectValidationTests.cpp",
"src/tests/unittests/validation/DynamicStateCommandValidationTests.cpp",
"src/tests/unittests/validation/ErrorScopeValidationTests.cpp",
"src/tests/unittests/validation/FenceValidationTests.cpp",
"src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp",
"src/tests/unittests/validation/QueueSubmitValidationTests.cpp",
"src/tests/unittests/validation/RenderBundleValidationTests.cpp",
"src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp",
"src/tests/unittests/validation/RenderPassValidationTests.cpp",
"src/tests/unittests/validation/RenderPipelineValidationTests.cpp",
"src/tests/unittests/validation/ResourceUsageTrackingTests.cpp",
"src/tests/unittests/validation/SamplerValidationTests.cpp",
"src/tests/unittests/validation/ShaderModuleValidationTests.cpp",
"src/tests/unittests/validation/StorageTextureValidationTests.cpp",
"src/tests/unittests/validation/TextureValidationTests.cpp",
"src/tests/unittests/validation/TextureViewValidationTests.cpp",
"src/tests/unittests/validation/ToggleValidationTests.cpp",
"src/tests/unittests/validation/ValidationTest.cpp",
"src/tests/unittests/validation/ValidationTest.h",
"src/tests/unittests/validation/VertexBufferValidationTests.cpp",
"src/tests/unittests/validation/VertexStateValidationTests.cpp",
"src/tests/unittests/wire/WireArgumentTests.cpp",
"src/tests/unittests/wire/WireBasicTests.cpp",
"src/tests/unittests/wire/WireBufferMappingTests.cpp",
"src/tests/unittests/wire/WireErrorCallbackTests.cpp",
"src/tests/unittests/wire/WireExtensionTests.cpp",
"src/tests/unittests/wire/WireFenceTests.cpp",
"src/tests/unittests/wire/WireInjectTextureTests.cpp",
"src/tests/unittests/wire/WireMemoryTransferServiceTests.cpp",
"src/tests/unittests/wire/WireOptionalTests.cpp",
"src/tests/unittests/wire/WireTest.cpp",
"src/tests/unittests/wire/WireTest.h",
"src/tests/unittests/wire/WireWGPUDevicePropertiesTests.cpp",
]
if (dawn_enable_d3d12) {
sources += [ "src/tests/unittests/d3d12/CopySplitTests.cpp" ]
}
# When building inside Chromium, use their gtest main function because it is
# needed to run in swarming correctly.
if (build_with_chromium) {
sources += [ "//gpu/dawn_unittests_main.cc" ]
} else {
sources += [ "src/tests/UnittestsMain.cpp" ]
}
}
source_set("dawn_end2end_tests_sources") {
configs += [ "${dawn_root}/src/common:dawn_internal" ]
testonly = true
deps = [
":dawn_utils",
"${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn:libdawn_proc",
"${dawn_root}/src/dawn_native",
"${dawn_root}/src/dawn_wire",
"third_party:gmock_and_gtest",
]
sources = [
"src/tests/DawnTest.h",
"src/tests/end2end/BasicTests.cpp",
"src/tests/end2end/BindGroupTests.cpp",
"src/tests/end2end/BufferTests.cpp",
"src/tests/end2end/ClipSpaceTests.cpp",
"src/tests/end2end/ColorStateTests.cpp",
Support BC5 formats on Vulkan This patch supports BC5 formats on Vulkan backends and adds related Dawn end2end tests. For the textures with BC formats, they could have non-multiple-of-4 sizes on the non-zero mipmap levels in sampling, but we are still required to provide texture data in complete 4x4 blocks in texture copies because that is the size of which they are stored in GPU memory. In this patch, we refer the term "physical memory size" as the memory size of the texture subresource in GPU memory, and the term "virtual memory size" as the size used in texture sampling. As Dawn requires the Extent3D in texture copies must fit in the physical memory size, while Vulkan requires it must fit in the virtual memory size, this patch recalculates the imageExtent to ensure it always follow this Vulkan validation rules. For Dawn end2end tests, note that we use pure green and pure red for the textures because BC5 does not support SRGB formats. Furthermore, "CopyPartofTextureSubResourceIntoNonZeroMipmapLevel" is skipped in this patch because there is an issue on the T2T copies from a region within the virtual size of one texture to another one that exceeds the virtual size of another texture in Vulkan SPEC. BUG=dawn:42 TEST=dawn_end2end_tests Change-Id: I17518cd335fb13125cb753bbf879bc06eb20e426 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8260 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2019-07-02 23:55:55 +00:00
"src/tests/end2end/CompressedTextureFormatTests.cpp",
"src/tests/end2end/ComputeCopyStorageBufferTests.cpp",
"src/tests/end2end/ComputeIndirectTests.cpp",
"src/tests/end2end/ComputeSharedMemoryTests.cpp",
"src/tests/end2end/ComputeStorageBufferBarrierTests.cpp",
"src/tests/end2end/CopyTests.cpp",
"src/tests/end2end/CullingTests.cpp",
"src/tests/end2end/DebugMarkerTests.cpp",
"src/tests/end2end/DepthStencilStateTests.cpp",
"src/tests/end2end/DestroyTests.cpp",
"src/tests/end2end/DeviceLostTests.cpp",
"src/tests/end2end/DrawIndexedIndirectTests.cpp",
"src/tests/end2end/DrawIndexedTests.cpp",
"src/tests/end2end/DrawIndirectTests.cpp",
"src/tests/end2end/DrawTests.cpp",
"src/tests/end2end/DynamicBufferOffsetTests.cpp",
"src/tests/end2end/FenceTests.cpp",
"src/tests/end2end/GpuMemorySynchronizationTests.cpp",
"src/tests/end2end/IndexFormatTests.cpp",
"src/tests/end2end/MultisampledRenderingTests.cpp",
"src/tests/end2end/NonzeroTextureCreationTests.cpp",
"src/tests/end2end/ObjectCachingTests.cpp",
"src/tests/end2end/OpArrayLengthTests.cpp",
"src/tests/end2end/PrimitiveTopologyTests.cpp",
"src/tests/end2end/RenderBundleTests.cpp",
"src/tests/end2end/RenderPassLoadOpTests.cpp",
"src/tests/end2end/RenderPassTests.cpp",
"src/tests/end2end/SamplerTests.cpp",
"src/tests/end2end/ScissorTests.cpp",
"src/tests/end2end/StorageTextureTests.cpp",
2019-07-01 09:58:07 +00:00
"src/tests/end2end/TextureFormatTests.cpp",
"src/tests/end2end/TextureViewTests.cpp",
"src/tests/end2end/TextureZeroInitTests.cpp",
"src/tests/end2end/VertexFormatTests.cpp",
"src/tests/end2end/VertexStateTests.cpp",
"src/tests/end2end/ViewportOrientationTests.cpp",
"src/tests/end2end/ViewportTests.cpp",
]
# Validation tests that need OS windows live in end2end tests.
sources += [
"src/tests/unittests/validation/ValidationTest.cpp",
"src/tests/unittests/validation/ValidationTest.h",
]
libs = []
if (dawn_enable_d3d12) {
sources += [ "src/tests/end2end/D3D12ResourceWrappingTests.cpp" ]
libs += [
"d3d11.lib",
"dxgi.lib",
]
}
if (dawn_enable_metal) {
sources += [ "src/tests/end2end/IOSurfaceWrappingTests.cpp" ]
libs += [ "IOSurface.framework" ]
}
if (dawn_enable_opengl) {
assert(supports_glfw_for_windowing)
}
if (supports_glfw_for_windowing) {
sources += [
"src/tests/end2end/SwapChainTests.cpp",
"src/tests/end2end/SwapChainValidationTests.cpp",
"src/tests/end2end/WindowSurfaceTests.cpp",
]
Enable Vulkan for Chromium Fuchsia build. Enable the Vulkan backend when building Dawn with the Chromium build system for Fuchsia. To make this work properly the following is required: - Modify VulkanInfo.cpp and BackendVk.cpp to correctly probe the Fuchsia swapchain layer and its layer extension, as well as enabling them when creating a new VkInstance. - Modify VulkanFunctions.cpp to load the Fuchsia swapchain related extension for this platform only. - Provide a small mock GLFW library for Fuchsia under src/utils/Glfw3Fuchsia.cpp, since the upstream project does not support this platform at all. Its purpose is only to allow the creation of the right VulkanBinding instance, which depends on the creation of a display surface for latter swapchain creation. - Add //third_party/fuchsia-sdk:vulkan_base and //third_party/fuchsia-sdk:vulkan_validation as data_deps of the libdawn_native_sources target in order to ensure that the Fuchsia package created by the build system will include the correct Vulkan libraries (loader and validation layers). This builds correctly, and both dawn_unittests and dawn_end2end_tests will run on a real Fuchsia device or inside the Fuchsia emulator, using either GPU virtualization or a software-based renderer. Note: dawn_unittests will also run inside QEMU, but not dawn_end2end_tests, since the latter requires proper GPU emulation which is not available in this environment. NOTE: All end2end tests pass using a device with an "Intel HD Graphics 615 (Kaby Lake GT2)" adapter. However: - For some reason, a single test takes up to 129 seconds to pass (BufferSetSubDataTests.ManySetSubData/Vulkan). - The test process crashes inside VkDestroyInstance(), apparently inside the Fuchsia-specific imagepipe layer (which implements swapchain support). This is likely a bug in the layer itself, and not Dawn. Also, may end2end tests will crash when run inside the Fuchsia emulator (which uses GPU virtualization to talk to the host GPU). The crashes happen inside libvulkan-goldfish.so, the emulator-specific Vulkan ICD on this sytem. Not a Dawn bug either. Bug=dawn:221 Change-Id: Id3598b673e8c6393f24db728b8da49fdde3cac76 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8963 Commit-Queue: David Turner <digit@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-09 10:52:08 +00:00
deps += [ ":dawn_glfw" ]
}
}
source_set("dawn_white_box_tests_sources") {
configs += [ "${dawn_root}/src/dawn_native:dawn_native_internal" ]
testonly = true
deps = [
":dawn_utils",
"${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn:libdawn_proc",
"${dawn_root}/src/dawn_native:dawn_native_sources",
# Static because the tests both link against and have dawn_native
# sources. MSVC errors when both importing and exporting symbols.
"${dawn_root}/src/dawn_native:dawn_native_static",
"${dawn_root}/src/dawn_wire",
"third_party:gmock_and_gtest",
]
sources = [
"src/tests/DawnTest.h",
]
if (dawn_enable_vulkan) {
deps += [ "third_party:vulkan_headers" ]
if (is_chromeos) {
sources += [ "src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp" ]
} else if (is_linux) {
sources += [ "src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp" ]
}
if (dawn_enable_error_injection) {
sources += [ "src/tests/white_box/VulkanErrorInjectorTests.cpp" ]
}
}
if (dawn_enable_d3d12) {
sources += [
"src/tests/white_box/D3D12DescriptorHeapTests.cpp",
"src/tests/white_box/D3D12SmallTextureTests.cpp",
]
}
if (dawn_enable_metal) {
sources += [ "src/tests/white_box/MetalAutoreleasePoolTests.mm" ]
}
if (dawn_enable_opengl) {
Enable Vulkan for Chromium Fuchsia build. Enable the Vulkan backend when building Dawn with the Chromium build system for Fuchsia. To make this work properly the following is required: - Modify VulkanInfo.cpp and BackendVk.cpp to correctly probe the Fuchsia swapchain layer and its layer extension, as well as enabling them when creating a new VkInstance. - Modify VulkanFunctions.cpp to load the Fuchsia swapchain related extension for this platform only. - Provide a small mock GLFW library for Fuchsia under src/utils/Glfw3Fuchsia.cpp, since the upstream project does not support this platform at all. Its purpose is only to allow the creation of the right VulkanBinding instance, which depends on the creation of a display surface for latter swapchain creation. - Add //third_party/fuchsia-sdk:vulkan_base and //third_party/fuchsia-sdk:vulkan_validation as data_deps of the libdawn_native_sources target in order to ensure that the Fuchsia package created by the build system will include the correct Vulkan libraries (loader and validation layers). This builds correctly, and both dawn_unittests and dawn_end2end_tests will run on a real Fuchsia device or inside the Fuchsia emulator, using either GPU virtualization or a software-based renderer. Note: dawn_unittests will also run inside QEMU, but not dawn_end2end_tests, since the latter requires proper GPU emulation which is not available in this environment. NOTE: All end2end tests pass using a device with an "Intel HD Graphics 615 (Kaby Lake GT2)" adapter. However: - For some reason, a single test takes up to 129 seconds to pass (BufferSetSubDataTests.ManySetSubData/Vulkan). - The test process crashes inside VkDestroyInstance(), apparently inside the Fuchsia-specific imagepipe layer (which implements swapchain support). This is likely a bug in the layer itself, and not Dawn. Also, may end2end tests will crash when run inside the Fuchsia emulator (which uses GPU virtualization to talk to the host GPU). The crashes happen inside libvulkan-goldfish.so, the emulator-specific Vulkan ICD on this sytem. Not a Dawn bug either. Bug=dawn:221 Change-Id: Id3598b673e8c6393f24db728b8da49fdde3cac76 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8963 Commit-Queue: David Turner <digit@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-09 10:52:08 +00:00
deps += [ ":dawn_glfw" ]
}
libs = []
}
test("dawn_end2end_tests") {
configs += [ "${dawn_root}/src/common:dawn_internal" ]
deps = [
":dawn_end2end_tests_sources",
":dawn_utils",
":dawn_white_box_tests_sources",
"${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn:libdawn_proc",
"${dawn_root}/src/dawn_native",
"${dawn_root}/src/dawn_wire",
"third_party:gmock_and_gtest",
]
sources = [
"src/tests/DawnTest.cpp",
"src/tests/DawnTest.h",
]
libs = []
# When building inside Chromium, use their gtest main function because it is
# needed to run in swarming correctly.
if (build_with_chromium) {
sources += [ "//gpu/dawn_end2end_tests_main.cc" ]
} else {
sources += [ "src/tests/End2EndTestsMain.cpp" ]
}
if (dawn_enable_opengl) {
Enable Vulkan for Chromium Fuchsia build. Enable the Vulkan backend when building Dawn with the Chromium build system for Fuchsia. To make this work properly the following is required: - Modify VulkanInfo.cpp and BackendVk.cpp to correctly probe the Fuchsia swapchain layer and its layer extension, as well as enabling them when creating a new VkInstance. - Modify VulkanFunctions.cpp to load the Fuchsia swapchain related extension for this platform only. - Provide a small mock GLFW library for Fuchsia under src/utils/Glfw3Fuchsia.cpp, since the upstream project does not support this platform at all. Its purpose is only to allow the creation of the right VulkanBinding instance, which depends on the creation of a display surface for latter swapchain creation. - Add //third_party/fuchsia-sdk:vulkan_base and //third_party/fuchsia-sdk:vulkan_validation as data_deps of the libdawn_native_sources target in order to ensure that the Fuchsia package created by the build system will include the correct Vulkan libraries (loader and validation layers). This builds correctly, and both dawn_unittests and dawn_end2end_tests will run on a real Fuchsia device or inside the Fuchsia emulator, using either GPU virtualization or a software-based renderer. Note: dawn_unittests will also run inside QEMU, but not dawn_end2end_tests, since the latter requires proper GPU emulation which is not available in this environment. NOTE: All end2end tests pass using a device with an "Intel HD Graphics 615 (Kaby Lake GT2)" adapter. However: - For some reason, a single test takes up to 129 seconds to pass (BufferSetSubDataTests.ManySetSubData/Vulkan). - The test process crashes inside VkDestroyInstance(), apparently inside the Fuchsia-specific imagepipe layer (which implements swapchain support). This is likely a bug in the layer itself, and not Dawn. Also, may end2end tests will crash when run inside the Fuchsia emulator (which uses GPU virtualization to talk to the host GPU). The crashes happen inside libvulkan-goldfish.so, the emulator-specific Vulkan ICD on this sytem. Not a Dawn bug either. Bug=dawn:221 Change-Id: Id3598b673e8c6393f24db728b8da49fdde3cac76 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8963 Commit-Queue: David Turner <digit@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-09 10:52:08 +00:00
deps += [ ":dawn_glfw" ]
}
if (is_chromeos) {
libs += [ "gbm" ]
}
}
test("dawn_perf_tests") {
configs += [ "${dawn_root}/src/common:dawn_internal" ]
deps = [
":dawn_utils",
"${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn:libdawn_proc",
"${dawn_root}/src/dawn_native",
"${dawn_root}/src/dawn_platform",
"${dawn_root}/src/dawn_wire",
"third_party:gmock_and_gtest",
]
sources = [
"src/tests/DawnTest.cpp",
"src/tests/DawnTest.h",
"src/tests/ParamGenerator.h",
"src/tests/perf_tests/BufferUploadPerf.cpp",
"src/tests/perf_tests/DawnPerfTest.cpp",
"src/tests/perf_tests/DawnPerfTest.h",
"src/tests/perf_tests/DawnPerfTestPlatform.cpp",
"src/tests/perf_tests/DawnPerfTestPlatform.h",
"src/tests/perf_tests/DrawCallPerf.cpp",
]
libs = []
# When building inside Chromium, use their gtest main function because it is
# needed to run in swarming correctly.
if (build_with_chromium) {
sources += [ "//gpu/dawn_perf_tests_main.cc" ]
} else {
sources += [ "src/tests/PerfTestsMain.cpp" ]
}
if (dawn_enable_metal) {
libs += [ "IOSurface.framework" ]
}
if (dawn_enable_opengl) {
Enable Vulkan for Chromium Fuchsia build. Enable the Vulkan backend when building Dawn with the Chromium build system for Fuchsia. To make this work properly the following is required: - Modify VulkanInfo.cpp and BackendVk.cpp to correctly probe the Fuchsia swapchain layer and its layer extension, as well as enabling them when creating a new VkInstance. - Modify VulkanFunctions.cpp to load the Fuchsia swapchain related extension for this platform only. - Provide a small mock GLFW library for Fuchsia under src/utils/Glfw3Fuchsia.cpp, since the upstream project does not support this platform at all. Its purpose is only to allow the creation of the right VulkanBinding instance, which depends on the creation of a display surface for latter swapchain creation. - Add //third_party/fuchsia-sdk:vulkan_base and //third_party/fuchsia-sdk:vulkan_validation as data_deps of the libdawn_native_sources target in order to ensure that the Fuchsia package created by the build system will include the correct Vulkan libraries (loader and validation layers). This builds correctly, and both dawn_unittests and dawn_end2end_tests will run on a real Fuchsia device or inside the Fuchsia emulator, using either GPU virtualization or a software-based renderer. Note: dawn_unittests will also run inside QEMU, but not dawn_end2end_tests, since the latter requires proper GPU emulation which is not available in this environment. NOTE: All end2end tests pass using a device with an "Intel HD Graphics 615 (Kaby Lake GT2)" adapter. However: - For some reason, a single test takes up to 129 seconds to pass (BufferSetSubDataTests.ManySetSubData/Vulkan). - The test process crashes inside VkDestroyInstance(), apparently inside the Fuchsia-specific imagepipe layer (which implements swapchain support). This is likely a bug in the layer itself, and not Dawn. Also, may end2end tests will crash when run inside the Fuchsia emulator (which uses GPU virtualization to talk to the host GPU). The crashes happen inside libvulkan-goldfish.so, the emulator-specific Vulkan ICD on this sytem. Not a Dawn bug either. Bug=dawn:221 Change-Id: Id3598b673e8c6393f24db728b8da49fdde3cac76 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8963 Commit-Queue: David Turner <digit@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-09 10:52:08 +00:00
deps += [ ":dawn_glfw" ]
}
}
###############################################################################
# Dawn samples, only in standalone builds
###############################################################################
if (dawn_standalone) {
# Library to handle the interaction of Dawn with GLFW windows in samples
static_library("dawn_bindings") {
configs += [ "${dawn_root}/src/common:dawn_internal" ]
sources = [
"src/utils/BackendBinding.cpp",
"src/utils/BackendBinding.h",
]
public_deps = [
"${dawn_root}/src/dawn:dawn_headers",
]
deps = [
":dawn_glfw",
"${dawn_root}/src/common",
"${dawn_root}/src/dawn_native",
]
libs = []
if (dawn_enable_d3d12) {
sources += [ "src/utils/D3D12Binding.cpp" ]
}
if (dawn_enable_metal) {
sources += [ "src/utils/MetalBinding.mm" ]
libs += [
"Metal.framework",
"QuartzCore.framework",
]
# Suppress warnings that Metal isn't in the deployment target of Chrome
if (is_mac) {
cflags_objcc = [ "-Wno-unguarded-availability" ]
}
}
if (dawn_enable_null) {
sources += [ "src/utils/NullBinding.cpp" ]
}
if (dawn_enable_opengl) {
sources += [ "src/utils/OpenGLBinding.cpp" ]
}
if (dawn_enable_vulkan) {
sources += [ "src/utils/VulkanBinding.cpp" ]
}
}
# Static library to contain code and dependencies common to all samples
static_library("dawn_sample_utils") {
sources = [
"examples/SampleUtils.cpp",
"examples/SampleUtils.h",
]
# Export all of these as public deps so that `gn check` allows includes
public_deps = [
":dawn_bindings",
Enable Vulkan for Chromium Fuchsia build. Enable the Vulkan backend when building Dawn with the Chromium build system for Fuchsia. To make this work properly the following is required: - Modify VulkanInfo.cpp and BackendVk.cpp to correctly probe the Fuchsia swapchain layer and its layer extension, as well as enabling them when creating a new VkInstance. - Modify VulkanFunctions.cpp to load the Fuchsia swapchain related extension for this platform only. - Provide a small mock GLFW library for Fuchsia under src/utils/Glfw3Fuchsia.cpp, since the upstream project does not support this platform at all. Its purpose is only to allow the creation of the right VulkanBinding instance, which depends on the creation of a display surface for latter swapchain creation. - Add //third_party/fuchsia-sdk:vulkan_base and //third_party/fuchsia-sdk:vulkan_validation as data_deps of the libdawn_native_sources target in order to ensure that the Fuchsia package created by the build system will include the correct Vulkan libraries (loader and validation layers). This builds correctly, and both dawn_unittests and dawn_end2end_tests will run on a real Fuchsia device or inside the Fuchsia emulator, using either GPU virtualization or a software-based renderer. Note: dawn_unittests will also run inside QEMU, but not dawn_end2end_tests, since the latter requires proper GPU emulation which is not available in this environment. NOTE: All end2end tests pass using a device with an "Intel HD Graphics 615 (Kaby Lake GT2)" adapter. However: - For some reason, a single test takes up to 129 seconds to pass (BufferSetSubDataTests.ManySetSubData/Vulkan). - The test process crashes inside VkDestroyInstance(), apparently inside the Fuchsia-specific imagepipe layer (which implements swapchain support). This is likely a bug in the layer itself, and not Dawn. Also, may end2end tests will crash when run inside the Fuchsia emulator (which uses GPU virtualization to talk to the host GPU). The crashes happen inside libvulkan-goldfish.so, the emulator-specific Vulkan ICD on this sytem. Not a Dawn bug either. Bug=dawn:221 Change-Id: Id3598b673e8c6393f24db728b8da49fdde3cac76 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8963 Commit-Queue: David Turner <digit@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
2019-09-09 10:52:08 +00:00
":dawn_glfw",
":dawn_utils",
"${dawn_root}/src/common",
"${dawn_root}/src/dawn:dawncpp",
"${dawn_root}/src/dawn:libdawn_proc",
"${dawn_root}/src/dawn_native",
"${dawn_root}/src/dawn_wire",
]
public_configs = [ "${dawn_root}/src/common:dawn_internal" ]
}
# Template for samples to avoid listing dawn_sample_utils as a dep every time
template("dawn_sample") {
executable(target_name) {
deps = [
":dawn_sample_utils",
]
forward_variables_from(invoker, "*", [ "deps" ])
if (defined(invoker.deps)) {
deps += invoker.deps
}
}
}
dawn_sample("CppHelloTriangle") {
sources = [
"examples/CppHelloTriangle.cpp",
]
}
dawn_sample("CHelloTriangle") {
sources = [
"examples/CHelloTriangle.cpp",
]
}
dawn_sample("ComputeBoids") {
sources = [
"examples/ComputeBoids.cpp",
]
deps = [
"third_party:glm",
]
}
dawn_sample("Animometer") {
sources = [
"examples/Animometer.cpp",
]
}
dawn_sample("CubeReflection") {
sources = [
"examples/CubeReflection.cpp",
]
deps = [
"third_party:glm",
]
}
dawn_sample("ManualSwapChainTest") {
sources = [
"examples/ManualSwapChainTest.cpp",
]
}
group("dawn_samples") {
deps = [
":Animometer",
":CHelloTriangle",
":ComputeBoids",
":CppHelloTriangle",
":CubeReflection",
]
}
}
Add fuzzers for SPIRV-Cross This CL adds in fuzzers for SPIRV-Cross for HLSL, GLSL, and MSL outputs. These fuzzers live in Dawn because there is not appropriate location in the Chromium source repo for them and it is unlikely they would be land-able in the SPIRV-Cross repo, because it is not coupled with Chromium's build system and thus Clusterfuzz so would be effectively dead code. Dawn depends on this code, but it is also integrated into the Chromium build system, so this was the best place I could find for them The code under fuzz unfortunately uses exceptions/aborting as its error reporting mechanism. This is an acknowledge short coming and there are efforts to remove this behaviour. To work around this and reduce the number of false positives found by the fuzzers, a signal trap has been implemented which will be removed once the code under fuzz has been updated. The trap replaces the existing signal handler and silencing signals while running the code under test. This allows the code under test to call abort() and not crash the fuzzing process. Theoretically, only SIGABRT should need to be trapped, but something is causing the signal from abort() to be converted to SIGSEGV when running under ASAN. This signal trap has been tested with the fuzzing/sanitizers by intentionally inserting bad calls that will occur after a few thousand test cases. It was confirmed that the fuzzer detected the issue and stops fuzzing. The alternate to implementing this signal trap would be to turn on exceptions for the fuzzer. This was attempted, but proved to be fruitless due to what was reported as an ODR issue, but couldn't couldn't be silenced. The likely underlying issue was a pre-built library or other object being built without exceptions was causing different versions of symbols or the exception version of the standard library not being instrumented by ASAN. Given the majority of Chromium eco-system turns off exceptions, fixing this issue would not be helpful to the larger community and was looking like it would require significant effort. BUG=chromium:903380 Change-Id: I63a5595383f99b7a0e150d72bb04c89b8d722631 Reviewed-on: https://dawn-review.googlesource.com/c/2260 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Max Moroz <mmoroz@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2018-11-12 12:20:21 +00:00
###############################################################################
# Fuzzers
###############################################################################
group("dawn_fuzzers") {
testonly = true
deps = [
"src/fuzzers:dawn_spirv_cross_glsl_fast_fuzzer",
"src/fuzzers:dawn_spirv_cross_hlsl_fast_fuzzer",
"src/fuzzers:dawn_spirv_cross_msl_fast_fuzzer",
"src/fuzzers:dawn_spvc_glsl_fast_fuzzer",
"src/fuzzers:dawn_spvc_hlsl_fast_fuzzer",
"src/fuzzers:dawn_spvc_msl_fast_fuzzer",
"src/fuzzers:dawn_wire_server_and_frontend_fuzzer",
]
Add fuzzers for SPIRV-Cross This CL adds in fuzzers for SPIRV-Cross for HLSL, GLSL, and MSL outputs. These fuzzers live in Dawn because there is not appropriate location in the Chromium source repo for them and it is unlikely they would be land-able in the SPIRV-Cross repo, because it is not coupled with Chromium's build system and thus Clusterfuzz so would be effectively dead code. Dawn depends on this code, but it is also integrated into the Chromium build system, so this was the best place I could find for them The code under fuzz unfortunately uses exceptions/aborting as its error reporting mechanism. This is an acknowledge short coming and there are efforts to remove this behaviour. To work around this and reduce the number of false positives found by the fuzzers, a signal trap has been implemented which will be removed once the code under fuzz has been updated. The trap replaces the existing signal handler and silencing signals while running the code under test. This allows the code under test to call abort() and not crash the fuzzing process. Theoretically, only SIGABRT should need to be trapped, but something is causing the signal from abort() to be converted to SIGSEGV when running under ASAN. This signal trap has been tested with the fuzzing/sanitizers by intentionally inserting bad calls that will occur after a few thousand test cases. It was confirmed that the fuzzer detected the issue and stops fuzzing. The alternate to implementing this signal trap would be to turn on exceptions for the fuzzer. This was attempted, but proved to be fruitless due to what was reported as an ODR issue, but couldn't couldn't be silenced. The likely underlying issue was a pre-built library or other object being built without exceptions was causing different versions of symbols or the exception version of the standard library not being instrumented by ASAN. Given the majority of Chromium eco-system turns off exceptions, fixing this issue would not be helpful to the larger community and was looking like it would require significant effort. BUG=chromium:903380 Change-Id: I63a5595383f99b7a0e150d72bb04c89b8d722631 Reviewed-on: https://dawn-review.googlesource.com/c/2260 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Max Moroz <mmoroz@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2018-11-12 12:20:21 +00:00
}
###############################################################################
# Temporary groups
###############################################################################
# Temporary groups to make a 5-way patch to fix crbug.com/913171
group("dawn_unittests_temp_group") {
testonly = true
public_deps = [
":dawn_unittests",
]
}
group("dawn_end2end_tests_temp_group") {
testonly = true
public_deps = [
":dawn_end2end_tests",
]
}
group("dawn_perf_tests_temp_group") {
testonly = true
public_deps = [
":dawn_perf_tests",
]
data_deps = [
":dawn_perf_tests",
]
}