| # Copyright 2016 The Chromium Authors. All rights reserved. |
| # 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("//testing/test.gni") |
| import("features.gni") |
| |
| if (ozone_platform_wayland) { |
| import("//third_party/wayland/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", |
| ] |
| |
| public_configs = [ ":vulkan_config" ] |
| |
| defines = [ "IS_VULKAN_IMPL" ] |
| |
| deps = [ |
| "//base", |
| "//ui/gfx", |
| ] |
| |
| public_deps = |
| [ "//third_party/vulkan-deps/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" ] |
| |
| deps = [ |
| ":vulkan_function_pointers", |
| "//base", |
| "//third_party/vulkan_memory_allocator", |
| ] |
| } |
| |
| component("vulkan") { |
| output_name = "vulkan_wrapper" |
| |
| sources = [ |
| "semaphore_handle.cc", |
| "semaphore_handle.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_instance.cc", |
| "vulkan_instance.h", |
| "vulkan_surface.cc", |
| "vulkan_surface.h", |
| "vulkan_swap_chain.cc", |
| "vulkan_swap_chain.h", |
| "vulkan_util.cc", |
| "vulkan_util.h", |
| ] |
| |
| defines = [ "IS_VULKAN_IMPL" ] |
| |
| deps = [ |
| ":buildflags", |
| "//base", |
| "//build:chromeos_buildflags", |
| "//components/crash/core/common:crash_key", |
| "//gpu/ipc/common:vulkan_ycbcr_info", |
| "//ui/gfx", |
| "//ui/gl", |
| ] |
| |
| public_deps = [ |
| ":vma_wrapper", |
| ":vulkan_function_pointers", |
| "//gpu/config:vulkan_info", |
| ] |
| |
| 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_win) { |
| sources += [ |
| "vulkan_image_win.cc", |
| "vulkan_util_win32.cc", |
| ] |
| } |
| |
| 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/android:ui_java", |
| "//ui/gl", |
| ] |
| } |
| } |
| |
| # 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/1234132): 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", |
| "//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" ] |
| } |
| } |
| } |
| } |