123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- # 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("//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",
- ]
- 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" ]
- if (ozone_platform == "x11") {
- defines += [ "OZONE_PLATFORM_IS_X11" ]
- }
- 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_fuchsia) {
- sources += [ "vulkan_util_fuchsia.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" ]
- }
- }
- }
- }
|