aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-09-14 06:12:09 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-14 06:12:09 -0700
commit6ef6999017febaf0039b83c1ff4da1efe9c0e85d (patch)
tree6387a4f0642e2f2658ae048eb6d6517458be9ae7
parent4ff7871ed368cf0b1f28da9096314a1f827f79e4 (diff)
GN: Android Vulkan support
Android's the easiest place to start supporting Vulkan, so it's up first. ndk_api becomes user-specifiable so that the Vulkan bots can kick it up to 24, the first release supporting Vulkan. The defaults remain the same: 18 for 32-bit and 21 for 64-bit, the first release supporting 64-bit. To test this, I set ndk_api=24 and skia_use_vulkan=true in GN, then $ ninja -C out dm; and droid out/dm --config vk --src gm Seems to work! Bot scripts to follow. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2336343002 Review-Url: https://codereview.chromium.org/2336343002
-rw-r--r--BUILD.gn14
-rw-r--r--gn/BUILDCONFIG.gn23
-rw-r--r--gn/shared_sources.gni1
3 files changed, 31 insertions, 7 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 258bf2d226..8d53e51f2a 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -16,6 +16,7 @@ declare_args() {
skia_use_libpng = true
skia_use_libwebp = !is_fuchsia
skia_use_sfntly = !is_fuchsia
+ skia_use_vulkan = false
skia_use_zlib = true
}
@@ -205,6 +206,7 @@ template("optional") {
[
"public_defines",
"deps",
+ "libs",
"sources",
"sources_when_disabled",
])
@@ -339,6 +341,13 @@ optional("typeface_freetype") {
]
}
+optional("vulkan") {
+ enabled = skia_use_vulkan
+ public_defines = [ "SK_VULKAN" ]
+ libs = [ "vulkan" ]
+ sources = skia_vk_sources
+}
+
optional("webp") {
enabled = skia_use_libwebp
public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
@@ -390,6 +399,7 @@ component("skia") {
":sse42",
":ssse3",
":typeface_freetype",
+ ":vulkan",
":webp",
":xml",
]
@@ -604,6 +614,10 @@ if (skia_enable_tools) {
} else if (is_mac) {
sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
}
+
+ if (skia_use_vulkan) {
+ sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
+ }
}
test_lib("flags") {
diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn
index 1ef121a823..e6a8b695ff 100644
--- a/gn/BUILDCONFIG.gn
+++ b/gn/BUILDCONFIG.gn
@@ -9,6 +9,7 @@ declare_args() {
is_debug = true
is_component_build = false
ndk = ""
+ ndk_api = 0 # 0 == picked automatically for target_cpu.
sanitize = ""
}
@@ -45,7 +46,15 @@ if (is_android) {
ndk_target = ""
ndk_platform = ""
ndk_stdlib = ""
- nkd_gccdir = ""
+ ndk_gccdir = ""
+
+ if (ndk_api == 0) {
+ ndk_api = 18
+ if (target_cpu == "arm64" || target_cpu == "mips64el" ||
+ target_cpu == "x64") {
+ ndk_api = 21
+ }
+ }
if (host_os == "linux") {
ndk_host = "linux-x86_64"
@@ -55,32 +64,32 @@ if (is_android) {
if (target_cpu == "arm64") {
ndk_target = "aarch64-linux-android"
- ndk_platform = "android-21/arch-arm64"
+ ndk_platform = "android-${ndk_api}/arch-arm64"
ndk_stdlib = "arm64-v8a"
ndk_gccdir = ndk_target
} else if (target_cpu == "arm") {
ndk_target = "arm-linux-androideabi"
- ndk_platform = "android-18/arch-arm"
+ ndk_platform = "android-${ndk_api}/arch-arm"
ndk_stdlib = "armeabi-v7a"
ndk_gccdir = ndk_target
} else if (target_cpu == "mips64el") {
ndk_target = "mips64el-linux-android"
- ndk_platform = "android-21/arch-mips64"
+ ndk_platform = "android-${ndk_api}/arch-mips64"
ndk_stdlib = "mips64"
ndk_gccdir = ndk_target
} else if (target_cpu == "mipsel") {
ndk_target = "mipsel-linux-android"
- ndk_platform = "android-18/arch-mips"
+ ndk_platform = "android-${ndk_api}/arch-mips"
ndk_stdlib = "mips"
ndk_gccdir = ndk_target
} else if (target_cpu == "x64") {
ndk_target = "x86_64-linux-android"
- ndk_platform = "android-21/arch-x86_64"
+ ndk_platform = "android-${ndk_api}/arch-x86_64"
ndk_stdlib = "x86_64"
ndk_gccdir = ndk_stdlib
} else if (target_cpu == "x86") {
ndk_target = "i686-linux-android"
- ndk_platform = "android-18/arch-x86"
+ ndk_platform = "android-${ndk_api}/arch-x86"
ndk_stdlib = "x86"
ndk_gccdir = ndk_stdlib
}
diff --git a/gn/shared_sources.gni b/gn/shared_sources.gni
index 9a4af74538..71c3b548d2 100644
--- a/gn/shared_sources.gni
+++ b/gn/shared_sources.gni
@@ -44,6 +44,7 @@ _gpu_gypi = exec_script("gypi_to_gn.py",
[ "../gyp/gpu.gypi" ])
skia_gpu_sources = _gpu_gypi.skgpu_sources
skia_null_gpu_sources = _gpu_gypi.skgpu_null_gl_sources
+skia_vk_sources = _gpu_gypi.skgpu_vk_sources
# Opts.
#