aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn72
-rw-r--r--gn/BUILDCONFIG.gn3
-rw-r--r--third_party/vulkan/BUILD.gn69
-rw-r--r--tools/gpu/vk/GrVulkanDefines.h43
4 files changed, 111 insertions, 76 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 65b73993eb..4b907e1dd7 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -43,9 +43,6 @@ declare_args() {
skia_enable_spirv_validation = is_skia_dev_build && is_debug
skia_enable_tools = is_skia_dev_build
skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
- skia_vulkan_header = ""
- skia_vulkan_sdk = getenv("VULKAN_SDK")
- skia_moltenvk_path = ""
skia_qt_path = getenv("QT_PATH")
skia_compile_processors = false
skia_generate_workarounds = false
@@ -71,7 +68,8 @@ declare_args() {
} else if (is_fuchsia) {
skia_use_vulkan = fuchsia_use_vulkan
} else {
- skia_use_vulkan = skia_vulkan_sdk != "" || skia_moltenvk_path != ""
+ skia_use_vulkan = (defined(skia_vulkan_sdk) && skia_vulkan_sdk != "") ||
+ (defined(skia_moltenvk_path) && skia_moltenvk_path != "")
}
if (is_ios) {
@@ -79,17 +77,6 @@ declare_args() {
skia_ios_profile = "Google Development"
}
}
-declare_args() {
- skia_tools_vulkan_header_dir = ""
- if (skia_use_vulkan) {
- # When buliding on Android we get the header via the NDK so no need for any extra path.
- if (is_fuchsia) {
- skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
- } else if (is_linux || is_win) {
- skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
- }
- }
-}
if (defined(skia_settings)) {
import(skia_settings)
@@ -130,9 +117,6 @@ if (skia_use_metal) {
# Skia public API, generally provided by :skia.
config("skia_public") {
include_dirs = skia_public_includes
- if (skia_tools_vulkan_header_dir != "") {
- include_dirs += [ skia_tools_vulkan_header_dir ]
- }
defines = []
if (is_component_build) {
defines += [ "SKIA_DLL" ]
@@ -224,32 +208,6 @@ config("skia_library") {
defines = [ "SKIA_IMPLEMENTATION=1" ]
}
-config("moltenvk") {
- if (is_ios) {
- moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
- } else {
- moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
- }
- cflags = [
- "-F$moltenvk_framework_path",
- "-isystem$skia_moltenvk_path/MoltenVK/include", # for <vulkan/vulkan.h>
- ]
- ldflags = [ "-F$moltenvk_framework_path" ]
- libs = [
- "MoltenVK.framework",
- "Metal.framework",
- "IOSurface.framework",
- "QuartzCore.framework",
- "Foundation.framework",
- ]
- if (is_ios) {
- libs += [ "UIKit.framework" ]
- } else {
- libs += [ "IOKit.framework" ]
- }
- defines = [ "SK_MOLTENVK" ]
-}
-
skia_library_configs = [
":skia_public",
":skia_private",
@@ -401,6 +359,7 @@ template("optional") {
"*",
[
"public_defines",
+ "public_deps",
"deps",
"libs",
"sources",
@@ -622,6 +581,7 @@ optional("gpu") {
}
public_defines = []
public_configs = []
+ public_deps = []
sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
@@ -657,22 +617,17 @@ optional("gpu") {
}
if (skia_use_vulkan) {
- public_defines += [ "SK_VULKAN" ]
+ # TODO: We should make this deps be //third_party/vulkan and then update clients to have a
+ # //third_party/vulkan directory in their trees so they can set up the vulkan library however
+ # they want. For example this would allow us to remove the fuchsia specific vulkan code in our
+ # vulkan files.
+ public_deps += [ "third_party/vulkan" ]
sources += skia_vk_sources
if (skia_enable_vulkan_debug_layers) {
public_defines += [ "SK_ENABLE_VK_LAYERS" ]
}
- if (skia_vulkan_header != "") {
- public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
- } else if (skia_moltenvk_path != "") {
- public_defines += [ "SK_VULKAN_HEADER=<MoltenVK/mvk_vulkan.h>" ]
- } else if (is_skia_dev_build) {
- public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
- }
- if (skia_moltenvk_path != "") {
- public_configs += [ ":moltenvk" ]
- }
}
+
if (skia_use_legacy_gpu_pixel_ops) {
public_defines += [ "SK_LEGACY_GPU_PIXEL_OPS" ]
}
@@ -890,7 +845,6 @@ component("skia") {
":fontmgr_empty",
":fontmgr_fontconfig",
":fontmgr_fuchsia",
- ":gpu",
":heif",
":hsw",
":jpeg",
@@ -907,6 +861,12 @@ component("skia") {
":xml",
]
+ # We need the public deps here for Vulkan. Our third_party/vulkan target sets some defines that
+ # need to get propagated up to the tools that depend on :skia and thus :gpu.
+ public_deps = [
+ ":gpu",
+ ]
+
# This file (and all GN files in Skia) are designed to work with an
# empty sources assignment filter; we handle all that explicitly.
# We clear the filter here for clients who may have set up a global filter.
diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn
index 15b10ca3b4..e5440b9b76 100644
--- a/gn/BUILDCONFIG.gn
+++ b/gn/BUILDCONFIG.gn
@@ -33,6 +33,9 @@ declare_args() {
win_toolchain_version = ""
clang_win = ""
+
+ skia_vulkan_sdk = getenv("VULKAN_SDK")
+ skia_moltenvk_path = ""
}
declare_args() {
is_debug = !is_official_build
diff --git a/third_party/vulkan/BUILD.gn b/third_party/vulkan/BUILD.gn
new file mode 100644
index 0000000000..425ccdabcb
--- /dev/null
+++ b/third_party/vulkan/BUILD.gn
@@ -0,0 +1,69 @@
+# Copyright 2018 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+if (is_fuchsia) {
+ import("//build/vulkan/config.gni")
+}
+
+declare_args() {
+ skia_vulkan_header = ""
+ skia_tools_vulkan_header_dir = ""
+
+ # When buliding on Android we get the header via the NDK so no need for any extra path.
+ if (is_fuchsia) {
+ skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
+ } else if (is_linux || is_win) {
+ skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
+ }
+}
+
+config("moltenvk") {
+ if (is_ios) {
+ moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
+ } else {
+ moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
+ }
+ cflags = [
+ "-F$moltenvk_framework_path",
+ "-isystem$skia_moltenvk_path/MoltenVK/include", # for <vulkan/vulkan.h>
+ ]
+ ldflags = [ "-F$moltenvk_framework_path" ]
+ libs = [
+ "MoltenVK.framework",
+ "Metal.framework",
+ "IOSurface.framework",
+ "QuartzCore.framework",
+ "Foundation.framework",
+ ]
+ if (is_ios) {
+ libs += [ "UIKit.framework" ]
+ } else {
+ libs += [ "IOKit.framework" ]
+ }
+ defines = [ "SK_MOLTENVK" ]
+}
+
+config("vulkan_config") {
+ include_dirs = []
+ configs = []
+
+ if (skia_tools_vulkan_header_dir != "") {
+ include_dirs += [ skia_tools_vulkan_header_dir ]
+ }
+ defines = [ "SK_VULKAN" ]
+ if (skia_vulkan_header != "") {
+ defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
+ } else if (defined(is_skia_standalone) && is_skia_standalone &&
+ !is_official_build) {
+ defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
+ }
+ if (skia_moltenvk_path != "") {
+ configs += [ ":moltenvk" ]
+ }
+}
+
+source_set("vulkan") {
+ public_configs = [ ":vulkan_config" ]
+}
diff --git a/tools/gpu/vk/GrVulkanDefines.h b/tools/gpu/vk/GrVulkanDefines.h
index 2052341dbb..78d09545be 100644
--- a/tools/gpu/vk/GrVulkanDefines.h
+++ b/tools/gpu/vk/GrVulkanDefines.h
@@ -10,26 +10,29 @@
#include "SkTypes.h"
-#if defined(SK_BUILD_FOR_WIN)
-# if !defined(VK_USE_PLATFORM_WIN32_KHR)
-# define VK_USE_PLATFORM_WIN32_KHR
-# endif
-#elif defined(SK_BUILD_FOR_ANDROID)
-# if !defined(VK_USE_PLATFORM_ANDROID_KHR)
-# define VK_USE_PLATFORM_ANDROID_KHR
-# endif
-#elif defined(SK_BUILD_FOR_UNIX)
-# if !defined(VK_USE_PLATFORM_XCB_KHR)
-# define VK_USE_PLATFORM_XCB_KHR
-# endif
-#endif
-
-// We create our own function table and never directly call any functions via vk*(). So no need to
-// include the prototype functions.
-#if !defined(VK_NO_PROTOTYPES)
-#define VK_NO_PROTOTYPES
-#endif
+ #ifdef SK_MOLTENVK
+ #include <MoltenVk/mvk_vulkan.h>
+ #else
+ #if defined(SK_BUILD_FOR_WIN)
+ # if !defined(VK_USE_PLATFORM_WIN32_KHR)
+ # define VK_USE_PLATFORM_WIN32_KHR
+ # endif
+ #elif defined(SK_BUILD_FOR_ANDROID)
+ # if !defined(VK_USE_PLATFORM_ANDROID_KHR)
+ # define VK_USE_PLATFORM_ANDROID_KHR
+ # endif
+ #elif defined(SK_BUILD_FOR_UNIX)
+ # if !defined(VK_USE_PLATFORM_XCB_KHR)
+ # define VK_USE_PLATFORM_XCB_KHR
+ # endif
+ #endif
-#include <vulkan/vulkan.h> // IWYU pragma: export
+ // We create our own function table and never directly call any functions via vk*(). So no
+ // need to include the prototype functions.
+ #if !defined(VK_NO_PROTOTYPES)
+ #define VK_NO_PROTOTYPES
+ #endif
+ #include <vulkan/vulkan.h> // IWYU pragma: export
+ #endif
#endif