| # Copyright 2016 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/buildflag_header.gni") |
| import("//build/config/dcheck_always_on.gni") |
| import("//build/config/ozone.gni") |
| import("//build/config/ui.gni") |
| import("//build_overrides/wayland.gni") |
| import("//testing/test.gni") |
| import("features.gni") |
| |
| # Generate a buildflag header for compile-time checking of Vulkan support. |
| buildflag_header("buildflags") { |
| header = "buildflags.h" |
| flags = [ "ENABLE_VULKAN=$enable_vulkan" ] |
| } |
| |
| if (enable_vulkan) { |
| use_vulkan_xcb = ozone_platform_x11 |
| config("vulkan_config") { |
| defines = [ "VK_NO_PROTOTYPES" ] |
| if (use_vulkan_xcb) { |
| defines += [ "USE_VULKAN_XCB" ] |
| } |
| if (ozone_platform_wayland && !use_system_libwayland) { |
| configs = [ "//third_party/wayland:wayland_config" ] |
| } |
| } |
| |
| source_set("vulkan_function_pointers") { |
| visibility = [ |
| ":vma_wrapper", |
| ":vulkan", |
| ] |
| |
| sources = [ |
| "vulkan_function_pointers.cc", |
| "vulkan_function_pointers.h", |
| "vulkan_queue_lock.cc", |
| "vulkan_queue_lock.h", |
| ] |
| |
| public_configs = [ ":vulkan_config" ] |
| |
| configs += [ "//build/config/compiler:wexit_time_destructors" ] |
| |
| defines = [ "IS_VULKAN_IMPL" ] |
| |
| deps = [ |
| "//base", |
| "//ui/gfx", |
| "//ui/gl", |
| ] |
| |
| public_deps = [ "//third_party/vulkan-headers/src:vulkan_headers" ] |
| |
| if (is_fuchsia) { |
| sources += [ "fuchsia/vulkan_fuchsia_ext.h" ] |
| } |
| } |
| |
| source_set("vma_wrapper") { |
| visibility = [ ":vulkan" ] |
| |
| sources = [ |
| "vma_wrapper.cc", |
| "vma_wrapper.h", |
| ] |
| |
| defines = [ "IS_VULKAN_IMPL" ] |
| |
| configs += [ "//build/config/compiler:wexit_time_destructors" ] |
| |
| deps = [ |
| ":vulkan_function_pointers", |
| "//base", |
| "//third_party/vulkan_memory_allocator", |
| "//ui/gfx", |
| ] |
| } |
| |
| component("vulkan") { |
| output_name = "vulkan_wrapper" |
| |
| sources = [ |
| "semaphore_handle.cc", |
| "semaphore_handle.h", |
| "skia_vk_memory_allocator_impl.cc", |
| "skia_vk_memory_allocator_impl.h", |
| "vulkan_command_buffer.cc", |
| "vulkan_command_buffer.h", |
| "vulkan_command_pool.cc", |
| "vulkan_command_pool.h", |
| "vulkan_crash_keys.cc", |
| "vulkan_crash_keys.h", |
| "vulkan_cxx.h", |
| "vulkan_device_queue.cc", |
| "vulkan_device_queue.h", |
| "vulkan_fence_helper.cc", |
| "vulkan_fence_helper.h", |
| "vulkan_image.cc", |
| "vulkan_image.h", |
| "vulkan_implementation.cc", |
| "vulkan_implementation.h", |
| "vulkan_info.cc", |
| "vulkan_info.h", |
| "vulkan_instance.cc", |
| "vulkan_instance.h", |
| "vulkan_memory.cc", |
| "vulkan_memory.h", |
| "vulkan_surface.cc", |
| "vulkan_surface.h", |
| "vulkan_swap_chain.cc", |
| "vulkan_swap_chain.h", |
| "vulkan_util.cc", |
| "vulkan_util.h", |
| "vulkan_ycbcr_info.cc", |
| "vulkan_ycbcr_info.h", |
| ] |
| |
| defines = [ "IS_VULKAN_IMPL" ] |
| |
| if (ozone_platform == "x11") { |
| defines += [ "OZONE_PLATFORM_IS_X11" ] |
| } |
| |
| configs += [ "//build/config/compiler:wexit_time_destructors" ] |
| |
| deps = [ |
| ":buildflags", |
| "//base", |
| "//components/crash/core/common:crash_key", |
| "//components/viz/common/resources:shared_image_format", |
| "//third_party/vulkan_memory_allocator", |
| "//ui/base:ozone_buildflags", |
| "//ui/gfx", |
| "//ui/gl", |
| ] |
| |
| public_deps = [ |
| ":vma_wrapper", |
| ":vulkan_function_pointers", |
| ] |
| |
| data_deps = [] |
| |
| if (is_posix) { |
| sources += [ "vulkan_util_posix.cc" ] |
| |
| if (is_linux || is_chromeos) { |
| sources += [ "vulkan_image_linux.cc" ] |
| } |
| } |
| |
| if (is_android) { |
| sources += [ "vulkan_image_android.cc" ] |
| } |
| |
| if (is_fuchsia) { |
| sources += [ "vulkan_util_fuchsia.cc" ] |
| } |
| |
| if (is_win) { |
| sources += [ |
| "vulkan_image_win.cc", |
| "vulkan_util_win32.cc", |
| ] |
| } |
| |
| if (is_chromeos) { |
| deps += [ "//ui/gfx/linux:drm" ] |
| } |
| |
| if (is_fuchsia) { |
| sources += [ "vulkan_image_fuchsia.cc" ] |
| |
| public_deps += [ "//third_party/fuchsia-sdk/sdk/pkg/zx" ] |
| |
| data_deps += [ "//third_party/fuchsia-sdk/sdk/pkg/vulkan" ] |
| |
| # VulkanInstance enables validation layer in Debug builds and when DCHECKs |
| # are enabled in Release builds. In these cases the validation layer |
| # libraries and configs need to be included in the generated Fuchsia |
| # package. |
| if (is_debug || dcheck_always_on) { |
| data_deps += [ "//third_party/fuchsia-sdk/sdk/pkg/vulkan_layers:VkLayer_khronos_validation" ] |
| } |
| } |
| |
| if (is_apple) { |
| sources += [ "vulkan_image_mac.cc" ] |
| } |
| } |
| |
| static_library("test_support") { |
| testonly = true |
| sources = [ "tests/native_window.h" ] |
| |
| deps = [ |
| "//ui/base:features", |
| "//ui/gfx", |
| "//ui/gfx:native_widget_types", |
| ] |
| |
| if (use_ozone) { |
| sources += [ "tests/native_window.cc" ] |
| deps += [ |
| "//ui/ozone", |
| "//ui/platform_window", |
| ] |
| } |
| |
| if (is_win) { |
| sources += [ "tests/native_window_win.cc" ] |
| } |
| |
| if (is_android) { |
| sources += [ "tests/native_window_android.cc" ] |
| deps += [ "//ui/gl" ] |
| } |
| |
| # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and |
| # enable the diagnostic by removing this line. |
| configs += [ "//build/config/compiler:no_exit_time_destructors" ] |
| } |
| |
| # TODO(penghuang): support more platforms |
| # https://crbug.com/1065499 |
| if (is_android || is_win || use_ozone) { |
| test("vulkan_tests") { |
| use_xvfb = use_xvfb_in_this_config |
| |
| sources = [ |
| "tests/basic_vulkan_test.cc", |
| "tests/basic_vulkan_test.h", |
| "tests/vulkan_test.cc", |
| "tests/vulkan_tests_main.cc", |
| |
| # TODO(crbug.com/40781300): fix compile problem with the latest vulkan |
| # headers. |
| # "vulkan_cxx_unittest.cc", |
| "vulkan_fence_helper_unittest.cc", |
| "vulkan_image_unittest.cc", |
| ] |
| |
| deps = [ |
| ":test_support", |
| "//base", |
| "//base/test:test_support", |
| "//components/viz/common:vulkan_context_provider", |
| "//gpu/ipc/service", |
| "//gpu/vulkan/init", |
| "//testing/gmock", |
| "//testing/gtest", |
| "//ui/events/platform", |
| "//ui/gfx", |
| "//ui/gfx:native_widget_types", |
| "//ui/gfx:test_support", |
| "//ui/gfx/geometry", |
| ] |
| |
| if (is_android) { |
| deps += [ "//ui/android:ui_java_test_support" ] |
| } |
| |
| if (use_ozone) { |
| deps += [ "//ui/ozone" ] |
| } |
| |
| # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and |
| # enable the diagnostic by removing this line. |
| configs += [ "//build/config/compiler:no_exit_time_destructors" ] |
| } |
| } |
| } |