Skip to content

Commit

Permalink
Enable Vulkan support by default
Browse files Browse the repository at this point in the history
Currently, building with Vulkan support is behind a gn flag
(enable_vulkan). It would be easy to not build & test with this flag. As
a result, it would also be easy to allow Vulkan support to bitrot.

Enabling Vulkan building by default would keep the Vulkan code
buildable. This patch does that.

(You still need a command line parameter of --enable-vulkan when running
Chrome to actually use the Vulkan codepath. This is just for the
building.)

BUG=848100

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I26fa03f9f6e2dc924691db913f723661b510f272
Reviewed-on: https://chromium-review.googlesource.com/1098117
Reviewed-by: Brian Salomon <bsalomon@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Chris Blume <cblume@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567307}
  • Loading branch information
ProgramMax authored and Commit Bot committed Jun 14, 2018
1 parent 2520b39 commit 3273266
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 71 deletions.
98 changes: 43 additions & 55 deletions gpu/vulkan/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,60 +14,57 @@ buildflag_header("buildflags") {
}

if (enable_vulkan) {
vulkan_lib_dir = getenv("VULKAN_SDK") + "/lib"
component("vulkan") {
output_name = "vulkan_wrapper"

if (is_linux) {
sources = [
"vulkan_command_buffer.cc",
"vulkan_command_buffer.h",
"vulkan_command_pool.cc",
"vulkan_command_pool.h",
"vulkan_descriptor_layout.cc",
"vulkan_descriptor_layout.h",
"vulkan_descriptor_pool.cc",
"vulkan_descriptor_pool.h",
"vulkan_descriptor_set.cc",
"vulkan_descriptor_set.h",
"vulkan_device_queue.cc",
"vulkan_device_queue.h",
"vulkan_export.h",
"vulkan_function_pointers.cc",
"vulkan_function_pointers.h",
"vulkan_image_view.cc",
"vulkan_image_view.h",
"vulkan_implementation.cc",
"vulkan_implementation.h",
"vulkan_instance.cc",
"vulkan_instance.h",
"vulkan_render_pass.cc",
"vulkan_render_pass.h",
"vulkan_sampler.cc",
"vulkan_sampler.h",
"vulkan_shader_module.cc",
"vulkan_shader_module.h",
"vulkan_surface.cc",
"vulkan_surface.h",
"vulkan_swap_chain.cc",
"vulkan_swap_chain.h",
]
sources = [
"vulkan_command_buffer.cc",
"vulkan_command_buffer.h",
"vulkan_command_pool.cc",
"vulkan_command_pool.h",
"vulkan_descriptor_layout.cc",
"vulkan_descriptor_layout.h",
"vulkan_descriptor_pool.cc",
"vulkan_descriptor_pool.h",
"vulkan_descriptor_set.cc",
"vulkan_descriptor_set.h",
"vulkan_device_queue.cc",
"vulkan_device_queue.h",
"vulkan_export.h",
"vulkan_function_pointers.cc",
"vulkan_function_pointers.h",
"vulkan_image_view.cc",
"vulkan_image_view.h",
"vulkan_implementation.cc",
"vulkan_implementation.h",
"vulkan_instance.cc",
"vulkan_instance.h",
"vulkan_render_pass.cc",
"vulkan_render_pass.h",
"vulkan_sampler.cc",
"vulkan_sampler.h",
"vulkan_shader_module.cc",
"vulkan_shader_module.h",
"vulkan_surface.cc",
"vulkan_surface.h",
"vulkan_swap_chain.cc",
"vulkan_swap_chain.h",
]

configs += [ "//build/config:precompiled_headers" ]
configs += [ "//build/config:precompiled_headers" ]

defines = [ "VULKAN_IMPLEMENTATION" ]
defines = [ "VULKAN_IMPLEMENTATION" ]

if (use_x11) {
defines += [ "VK_USE_PLATFORM_XLIB_KHR" ]
}
if (use_x11) {
defines += [ "VK_USE_PLATFORM_XLIB_KHR" ]
}

all_dependent_configs = [ "//third_party/vulkan:vulkan_config" ]
all_dependent_configs = [ "//third_party/vulkan:vulkan_config" ]

deps = [
"//base",
"//ui/gfx",
]
}
deps = [
"//base",
"//ui/gfx",
]
}

test("vulkan_tests") {
Expand All @@ -79,15 +76,6 @@ if (enable_vulkan) {
"tests/vulkan_tests_main.cc",
]

if (current_cpu == "x64") {
lib_dirs = [
"/usr/lib/x86_64-linux-gnu",
vulkan_lib_dir,
]
} else {
assert(false, "Unsupported vulkan target: " + current_cpu)
}

deps = [
"//base/test:test_support",
"//gpu/vulkan/init",
Expand Down
4 changes: 3 additions & 1 deletion gpu/vulkan/features.gni
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/ui.gni")

# Features used by targets inside and outside of |gpu/vulkan|.
# For details see declare_args() in build/config/BUILDCONFIG.gn.
declare_args() {
# Enable experimental vulkan backend.
enable_vulkan = false
enable_vulkan = is_linux && use_x11
}
5 changes: 1 addition & 4 deletions skia/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ skia_support_pdf = !is_ios && enable_basic_printing

declare_args() {
skia_whitelist_serialized_typefaces = false
if (enable_vulkan) {
vulkan_sdk_path = getenv("VULKAN_SDK")
}
}

# External-facing config for dependent code.
Expand All @@ -49,7 +46,7 @@ config("skia_config") {
]
if (enable_vulkan) {
include_dirs += [
"$vulkan_sdk_path/include",
"//third_party/vulkan/include",
"//third_party/skia/third_party/vulkanmemoryallocator",
]
configs = [ "//third_party/vulkan:vulkan_config" ]
Expand Down
11 changes: 0 additions & 11 deletions third_party/vulkan/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,4 @@
config("vulkan_config") {
defines = [ "VK_NO_PROTOTYPES" ]
include_dirs = [ "include" ]
vulkan_lib_dir = getenv("VULKAN_SDK") + "/lib"
libs = [ "vulkan" ]

if (current_cpu == "x64") {
lib_dirs = [
"/usr/lib/x86_64-linux-gnu",
vulkan_lib_dir,
]
} else {
assert(false, "Unsupported vulkan target: " + current_cpu)
}
}

0 comments on commit 3273266

Please sign in to comment.