Commit f22f16d3 by Tobin Ehlis Committed by Commit Bot

Reland "Vulkan: Use VK repos' internal BUILD.gn files"

This is a reland of 552f5fcb There was a missing build dependence causing a build no-op issue which has now been fixed in the upstream Vulkan Validation Layer repo. Primary workaround that need to be re-visted and fixed are: 1. Disabled validation layers on 32-bit Windows 2. Disabled validation layers on 32-bit Android 3. Disabled DebugUtils on Android, using DebugReport instead 4. Using custom VK Loader branch to avoid WDK dependence Original change's description: > Vulkan: Use VK repos' internal BUILD.gn files > > This retires custom BUILD.gn files for the Vulkan Headers, Tools, > Validation-Layers, and Loader repos. They now have integrated BUILD.gn > files so switched ANGLE to use those by default. > Also Validation Layer, Loader, and Tools repos no longer uses codegen > so this speeds up the build overall. > Switched over from old VK_LAYER_LUNARG_standard_validation meta-layer > to VK_LAYER_KHRONOS_validation unified layer. > > This changes includes a temporary workaround to the Vulkan-Loader repo > to remove its Window's build dependence on WDK. There are plans to > remove that depenedence in Loader master, but until then we can use > our custom branch workaround. > It also includes a custom branch for validation layers that includes > some build fixes for ANGLE. > Finally, the layers were crashing on Android when attempting to use > DebugUtils extension so forcing DebugReport on Android for now. > > Bug: angleproject:2449 > Bug: angleproject:3320 > Bug: angleproject:3852 > Bug: angleproject:3924 > Bug: angleproject:3925 > Bug: angleproject:3946 > Bug: chromium:997009 > Bug: chromium:997016 > Change-Id: I48b36acefcc7f2bc930eb72d6fdbc87bca24f833 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1610438 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Tobin Ehlis <tobine@google.com> Bug: angleproject:2449, angleproject:3320, angleproject:3852 Change-Id: I373ada091a1329db5e304874079428d01ba21d52 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1778302Reviewed-by: 's avatarTobin Ehlis <tobine@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
parent 377b1679
......@@ -556,6 +556,9 @@ if (angle_enable_vulkan) {
if (is_android) {
libs = [ "vulkan" ]
}
if (angle_enable_vulkan_validation_layers) {
defines += [ "ANGLE_ENABLE_VULKAN_VALIDATION_LAYERS_BY_DEFAULT" ]
}
}
if (angle_swiftshader) {
......@@ -611,16 +614,16 @@ if (angle_enable_vulkan) {
# Use this target to include everything ANGLE needs for Vulkan.
group("angle_vulkan") {
public_deps = [
"$angle_root/third_party/vulkan-headers:vulkan_headers",
"$angle_root/third_party/vulkan-headers/src:vulkan_headers",
]
public_configs = [ ":vulkan_config" ]
deps = []
data_deps = []
if (!is_android && !is_fuchsia) {
deps += [ "$angle_root/third_party/vulkan-loader:libvulkan" ]
data_deps += [ "$angle_root/third_party/vulkan-tools:VkICD_mock_icd" ]
deps += [ "$angle_root/third_party/vulkan-loader/src:libvulkan" ]
data_deps += [ "$angle_root/third_party/vulkan-tools/src:VkICD_mock_icd" ]
public_configs +=
[ "$angle_root/third_party/vulkan-loader:vulkan_loader_config" ]
[ "$angle_root/third_party/vulkan-loader/src:vulkan_loader_config" ]
}
if (is_fuchsia) {
public_deps += [
......@@ -634,9 +637,9 @@ if (angle_enable_vulkan) {
if (is_fuchsia) {
deps += [ "//third_party/fuchsia-sdk:vulkan_validation" ]
} else {
data_deps += [ "$angle_root/third_party/vulkan-validation-layers:vulkan_validation_layers" ]
data_deps += [ "$angle_root/third_party/vulkan-validation-layers/src:vulkan_validation_layers" ]
if (!is_android) {
data_deps += [ "$angle_root/third_party/vulkan-validation-layers:vulkan_gen_json_files" ]
data_deps += [ "$angle_root/third_party/vulkan-validation-layers/src:vulkan_gen_json_files" ]
}
}
}
......@@ -770,7 +773,8 @@ angle_source_set("libANGLE_base") {
"${angle_glslang_dir}:glslang_sources",
"${angle_spirv_tools_dir}:spvtools_val",
]
public_deps += [ "$angle_root/third_party/vulkan-headers:vulkan_headers" ]
public_deps +=
[ "$angle_root/third_party/vulkan-headers/src:vulkan_headers" ]
# Include generated shaders.
import("src/libANGLE/renderer/vulkan/vk_internal_shaders_autogen.gni")
......@@ -1302,8 +1306,9 @@ if (!is_component_build && is_android && symbol_level != 0) {
if (angle_enable_vulkan_validation_layers) {
foreach(_layer, vulkan_validation_layers) {
deps +=
[ "${angle_root}/third_party/vulkan-validation-layers:${_layer}" ]
deps += [
"${angle_root}/third_party/vulkan-validation-layers/src:${_layer}",
]
}
}
......
......@@ -30,16 +30,16 @@ vars = {
'spirv_tools_revision': '85c67b5e08eea1818767f174515612464740a53c',
# Current revision of Khronos Vulkan-Headers.
'vulkan_headers_revision': '982f0f84dccf6f281b48318c77261a9028000126',
'vulkan_headers_revision': '5b44df19e040fca0048ab30c553a8c2d2cb9623e',
# Current revision of Khronos Vulkan-Loader.
'vulkan_loader_revision': '2f0abfcf9eb04018e6e92125a70bc28665aa17fe',
'vulkan_loader_revision': 'b5a0995324fa9fb2a6152197b442400e7d7be5b6',
# Current revision of Khronos Vulkan-Tools.
'vulkan_tools_revision': 'f392e71b994036c92b896c2a62cc63d042b7f9b1',
'vulkan_tools_revision': '40cd2166a44647a4283517e31af4589410c654eb',
# Current revision of Khronos Vulkan-ValidationLayers.
'vulkan_validation_revision': 'ff80a937c8a505abbdddb95d8ffaa446820c8391',
'vulkan_validation_revision': '9fba37afae13a11bd49ae942bf82e5bf1098e381',
}
deps = {
......
......@@ -5,13 +5,7 @@
import("//build/config/android/rules.gni")
import("//third_party/angle/gni/angle.gni")
vulkan_validation_layers = [
"VkLayer_core_validation",
"VkLayer_object_lifetimes",
"VkLayer_stateless_validation",
"VkLayer_thread_safety",
"VkLayer_unique_objects",
]
vulkan_validation_layers = [ "VkLayer_khronos_validation" ]
angle_libraries = [
"libEGL",
......
# Copyright 2019 The ANGLE Project 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("//gni/angle.gni")
vulkan_headers_dir = "//third_party/vulkan-headers/src"
vulkan_gen_subdir = "angle/vulkan"
vulkan_loader_shared = angle_shared_libvulkan
# Copyright 2019 The ANGLE Project 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("//gni/angle.gni")
vulkan_headers_dir = "//third_party/vulkan-headers/src"
vulkan_data_subdir = angle_data_dir
vulkan_gen_subdir = "angle/vulkan"
# Copyright 2019 The ANGLE Project 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("//gni/angle.gni")
vulkan_headers_dir = "//third_party/vulkan-headers/src"
vvl_spirv_tools_dir = "//third_party/spirv-tools/src"
vvl_glslang_dir = "//third_party/glslang/src"
vulkan_data_subdir = angle_data_dir
vulkan_gen_subdir = "angle/vulkan"
......@@ -8,9 +8,10 @@
angle_dotfile_settings = {
exec_script_whitelist = [
get_path_info("BUILD.gn", "abspath"),
get_path_info("third_party/vulkan-headers/BUILD.gn", "abspath"),
get_path_info("third_party/vulkan-loader/BUILD.gn", "abspath"),
get_path_info("third_party/vulkan-tools/BUILD.gn", "abspath"),
get_path_info("third_party/vulkan-validation-layers/BUILD.gn", "abspath"),
get_path_info("third_party/vulkan-headers/src/BUILD.gn", "abspath"),
get_path_info("third_party/vulkan-loader/src/BUILD.gn", "abspath"),
get_path_info("third_party/vulkan-tools/src/BUILD.gn", "abspath"),
get_path_info("third_party/vulkan-validation-layers/src/BUILD.gn",
"abspath"),
]
}
......@@ -8,5 +8,5 @@
"src/libANGLE/renderer/vulkan/vk_mandatory_format_support_table_autogen.cpp":
"d20e549634ef32d6ad4e9f0b28e52acf",
"third_party/vulkan-headers/src/registry/vk.xml":
"8af0f992bd45c2d9500eb5ed60c256d6"
"db16f42dab8a7a1ee88c42a90f0c02c2"
}
\ No newline at end of file
......@@ -306,12 +306,12 @@ bool ShouldUseDebugLayers(const egl::AttributeMap &attribs)
EGLAttrib debugSetting =
attribs.get(EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED_ANGLE, EGL_DONT_CARE);
// Prefer to enable debug layers if compiling in Debug, and disabled in Release.
#if defined(ANGLE_ENABLE_ASSERTS)
// Prefer to enable debug layers when available.
#if defined(ANGLE_ENABLE_VULKAN_VALIDATION_LAYERS_BY_DEFAULT)
return (debugSetting != EGL_FALSE);
#else
return (debugSetting == EGL_TRUE);
#endif // defined(ANGLE_ENABLE_ASSERTS)
#endif // defined(ANGLE_ENABLE_VULKAN_VALIDATION_LAYERS_BY_DEFAULT)
}
bool ShouldUseVirtualizedContexts(const egl::AttributeMap &attribs, bool defaultValue)
......
......@@ -119,6 +119,14 @@ constexpr const char *kSkippedMessages[] = {
"UNASSIGNED-CoreValidation-Shader-PointSizeMissing",
// http://anglebug.com/3832
"VUID-VkPipelineInputAssemblyStateCreateInfo-topology-00428",
// http://anglebug.com/3450
"VUID-vkDestroySemaphore-semaphore-parameter",
// http://anglebug.com/3924
"UNASSIGNED-Threading-Info",
// http://anglebug.com/3925
"VUID-vkDestroyDescriptorPool-descriptorPool-parameter",
"VUID-vkDestroyBuffer-buffer-parameter",
"VUID-vkDestroyImage-image-parameter",
};
// Suppress validation errors that are known
......@@ -603,7 +611,13 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
const egl::AttributeMap &attribs = mDisplay->getAttributeMap();
ScopedVkLoaderEnvironment scopedEnvironment(ShouldUseDebugLayers(attribs),
ChooseICDFromAttribs(attribs));
#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_WIN64)
// TODO: Re-enable validation layers on 32bit Windows
// http://anglebug.com/3946, http://anglebug.com/3924
mEnableValidationLayers = false;
#else
mEnableValidationLayers = scopedEnvironment.canEnableValidationLayers();
#endif
mEnabledICD = scopedEnvironment.getEnabledICD();
// Gather global layer properties.
......@@ -671,10 +685,15 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
ExtensionNameList enabledInstanceExtensions;
enabledInstanceExtensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
enabledInstanceExtensions.push_back(wsiExtension);
#if defined(ANGLE_PLATFORM_ANDROID)
// TODO: Enable DebugUtils on Android
// http://anglebug.com/3852
bool enableDebugUtils = false;
#else
bool enableDebugUtils =
mEnableValidationLayers &&
ExtensionFound(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, instanceExtensionNames);
#endif
bool enableDebugReport =
mEnableValidationLayers && !enableDebugUtils &&
ExtensionFound(VK_EXT_DEBUG_REPORT_EXTENSION_NAME, instanceExtensionNames);
......@@ -740,7 +759,16 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
enabledInstanceExtensions.empty() ? nullptr : enabledInstanceExtensions.data();
instanceInfo.enabledLayerCount = static_cast<uint32_t>(enabledInstanceLayerNames.size());
instanceInfo.ppEnabledLayerNames = enabledInstanceLayerNames.data();
#if defined(ANGLE_PLATFORM_ANDROID) && !defined(ANGLE_IS_64_BIT_CPU)
// TODO: Re-enable validation layers on 32-bit Android
// http://anglebug.com/3924
VkValidationFeatureDisableEXT vkValFeaturesDisable = VK_VALIDATION_FEATURE_DISABLE_ALL_EXT;
VkValidationFeaturesEXT validationFeatures = {};
validationFeatures.sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT;
validationFeatures.disabledValidationFeatureCount = 1;
validationFeatures.pDisabledValidationFeatures = &vkValFeaturesDisable;
instanceInfo.pNext = &validationFeatures;
#endif
ANGLE_VK_TRY(displayVk, vkCreateInstance(&instanceInfo, nullptr, &mInstance));
if (enableDebugUtils)
......
......@@ -52,9 +52,10 @@ egl::Error ToEGL(Result result, rx::DisplayVk *displayVk, EGLint errorCode)
namespace rx
{
// Mirrors std_validation_str in loader.c
const char *g_VkStdValidationLayerName = "VK_LAYER_LUNARG_standard_validation";
const char *g_VkValidationLayerNames[] = {
// Unified layer that includes full validation layer stack
const char *g_VkKhronosValidationLayerName = "VK_LAYER_KHRONOS_validation";
const char *g_VkStandardValidationLayerName = "VK_LAYER_LUNARG_standard_validation";
const char *g_VkValidationLayerNames[] = {
"VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation",
"VK_LAYER_LUNARG_object_tracker", "VK_LAYER_LUNARG_core_validation",
"VK_LAYER_GOOGLE_unique_objects"};
......@@ -72,9 +73,14 @@ bool HasValidationLayer(const std::vector<VkLayerProperties> &layerProps, const
return false;
}
bool HasKhronosValidationLayer(const std::vector<VkLayerProperties> &layerProps)
{
return HasValidationLayer(layerProps, g_VkKhronosValidationLayerName);
}
bool HasStandardValidationLayer(const std::vector<VkLayerProperties> &layerProps)
{
return HasValidationLayer(layerProps, g_VkStdValidationLayerName);
return HasValidationLayer(layerProps, g_VkStandardValidationLayerName);
}
bool HasValidationLayers(const std::vector<VkLayerProperties> &layerProps)
......@@ -215,9 +221,14 @@ bool GetAvailableValidationLayers(const std::vector<VkLayerProperties> &layerPro
bool mustHaveLayers,
VulkanLayerVector *enabledLayerNames)
{
if (HasStandardValidationLayer(layerProps))
// Favor unified Khronos layer, but fallback to standard validation
if (HasKhronosValidationLayer(layerProps))
{
enabledLayerNames->push_back(g_VkKhronosValidationLayerName);
}
else if (HasStandardValidationLayer(layerProps))
{
enabledLayerNames->push_back(g_VkStdValidationLayerName);
enabledLayerNames->push_back(g_VkStandardValidationLayerName);
}
else if (HasValidationLayers(layerProps))
{
......
......@@ -41,8 +41,12 @@ EGLint PlatformParameters::getRenderer() const
void PlatformParameters::initDefaultParameters()
{
#if defined(ANGLE_ENABLE_VULKAN_VALIDATION_LAYERS_BY_DEFAULT)
// Default debug layers to enabled in tests.
eglParameters.debugLayersEnabled = EGL_TRUE;
#else
eglParameters.debugLayersEnabled = EGL_FALSE;
#endif // defined(ANGLE_ENABLE_VULKAN_VALIDATION_LAYERS_BY_DEFAULT)
}
bool operator<(const PlatformParameters &a, const PlatformParameters &b)
......
# Copyright 2018 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# BUILD settings for Vulkan Headers
# Headers repo is at
# https://github.com/KhronosGroup/Vulkan-Headers
import("../../gni/angle.gni")
config("vulkan_headers_config") {
include_dirs = [ "src/include" ]
if (is_win) {
defines = [ "VK_USE_PLATFORM_WIN32_KHR" ]
}
if (is_linux) {
defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
}
if (is_android) {
defines = [ "VK_USE_PLATFORM_ANDROID_KHR" ]
}
if (is_fuchsia) {
defines = [ "VK_USE_PLATFORM_FUCHSIA" ]
}
}
# Vulkan headers only, no compiled sources.
source_set("vulkan_headers") {
sources = [
"src/include/vulkan/vk_icd.h",
"src/include/vulkan/vk_layer.h",
"src/include/vulkan/vk_platform.h",
"src/include/vulkan/vk_sdk_platform.h",
"src/include/vulkan/vulkan.h",
"src/include/vulkan/vulkan.hpp",
"src/include/vulkan/vulkan_core.h",
]
public_configs = [ ":vulkan_headers_config" ]
}
# Copyright 2018 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
raw_vulkan_headers_registry_dir = rebase_path("src/registry")
# Common scripts & input used by multiple other repos
vulkan_registry_script_files = [
"$raw_vulkan_headers_registry_dir/cgenerator.py",
"$raw_vulkan_headers_registry_dir/generator.py",
"$raw_vulkan_headers_registry_dir/reg.py",
"$raw_vulkan_headers_registry_dir/vk.xml",
]
# Copyright 2018 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# BUILD settings for Vulkan Tools where Mock ICD is located
# Tools repo is at
# https://github.com/KhronosGroup/Vulkan-Tools
import("../../gni/angle.gni")
import("$angle_root/third_party/vulkan-headers/vulkan_headers_script_deps.gni")
# Vulkan-tools isn't ported to Fuchsia yet.
# TODO(spang): Port mock ICD to Fuchsia.
assert(!is_fuchsia)
vulkan_undefine_configs = []
if (is_win) {
vulkan_undefine_configs += [
"//build/config/win:nominmax",
"//build/config/win:unicode",
]
}
raw_vulkan_icd_dir = rebase_path("src", root_build_dir)
raw_vulkan_headers_dir =
rebase_path("$angle_root/third_party/vulkan-headers/src", root_build_dir)
vulkan_gen_dir = "$target_gen_dir/angle/vulkan"
raw_vulkan_gen_dir = rebase_path(vulkan_gen_dir, root_build_dir)
# Vulkan helper scripts
# ---------------------
helper_script_and_deps = [
[
"vulkan_gen_typemap_helper",
"vk_typemap_helper.h",
"vulkan_tools_helper_file_generator.py",
],
[
"vulkan_mock_icd_cpp",
"mock_icd.cpp",
"mock_icd_generator.py",
],
[
"vulkan_mock_icd_h",
"mock_icd.h",
"mock_icd_generator.py",
],
]
# Python scripts needed for codegen, copy them to a temp dir
# so that all dependencies are together
copy("python_gen_deps") {
sources = vulkan_registry_script_files + [
"src/scripts/common_codegen.py",
"src/scripts/kvt_genvk.py",
"src/scripts/mock_icd_generator.py",
"src/scripts/vulkan_tools_helper_file_generator.py",
]
outputs = [
"$vulkan_gen_dir/{{source_file_part}}",
]
}
foreach(script_and_dep, helper_script_and_deps) {
target_name = script_and_dep[0]
file = script_and_dep[1]
dep = script_and_dep[2]
target("action", target_name) {
public_deps = [
":python_gen_deps",
]
script = "$vulkan_gen_dir/kvt_genvk.py"
inputs = [
"$vulkan_gen_dir/$dep",
"$vulkan_gen_dir/common_codegen.py",
]
outputs = [
"$vulkan_gen_dir/$file",
]
args = [
"-o",
raw_vulkan_gen_dir,
"-registry",
"$raw_vulkan_headers_dir/registry/vk.xml",
"-scripts",
"$raw_vulkan_headers_dir/registry",
"$file",
"-quiet",
]
}
}
config("vulkan_generated_files_config") {
include_dirs = [ vulkan_gen_dir ]
}
group("vulkan_generate_helper_files") {
public_deps = [
"$angle_root/third_party/vulkan-headers:vulkan_headers",
]
public_configs = [ ":vulkan_generated_files_config" ]
foreach(script_and_dep, helper_script_and_deps) {
target_name = script_and_dep[0]
public_deps += [ ":$target_name" ]
}
}
config("vulkan_internal_config") {
defines = [ "VULKAN_NON_CMAKE_BUILD" ]
if (is_clang || !is_win) {
cflags = [ "-Wno-unused-function" ]
}
if (is_linux) {
defines += [
"SYSCONFDIR=\"/etc\"",
"FALLBACK_CONFIG_DIRS=\"/etc/xdg\"",
"FALLBACK_DATA_DIRS=\"/usr/local/share:/usr/share\"",
]
}
}
# Copy icd header to gen dir
copy("icd_header_dep") {
sources = [
"$angle_root/third_party/vulkan-headers/src/include/vulkan/vk_icd.h",
]
outputs = [
"$vulkan_gen_dir/vk_icd.h",
]
}
if (!is_android) {
# Vulkan Mock ICD
# ---------------
group("vulkan_generate_mock_icd_files") {
public_deps = [
":icd_header_dep",
":vulkan_generate_helper_files",
":vulkan_mock_icd_cpp",
":vulkan_mock_icd_h",
]
}
mock_icd_sources = [
"$vulkan_gen_dir/mock_icd.cpp",
"$vulkan_gen_dir/mock_icd.h",
]
shared_library("VkICD_mock_icd") {
configs -= vulkan_undefine_configs
public_configs = [ "$angle_root:vulkan_config" ]
deps = [
":vulkan_generate_mock_icd_files",
]
data_deps = [
":vulkan_gen_icd_json_file",
]
sources = mock_icd_sources
if (is_win) {
sources += [ "src/icd/VkICD_mock_icd.def" ]
}
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
action("vulkan_gen_icd_json_file") {
script = "$angle_root/scripts/generate_vulkan_layers_json.py"
sources = [
"../vulkan-headers/src/include/vulkan/vulkan_core.h",
]
args = [ "--icd" ]
if (is_win) {
sources += [ "src/icd/windows/VkICD_mock_icd.json" ]
args += [ "$raw_vulkan_icd_dir/icd/windows" ]
}
if (is_linux) {
sources += [ "src/icd/linux/VkICD_mock_icd.json" ]
args += [ "$raw_vulkan_icd_dir/icd/linux" ]
}
# The layer JSON files are part of the necessary data deps.
outputs = [
"$root_out_dir/$angle_data_dir/VkICD_mock_icd.json",
]
data = outputs
args += [ rebase_path("$root_out_dir/$angle_data_dir", root_build_dir) ] +
rebase_path(sources, root_build_dir)
}
}
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This file is a dummy file to enable building SPIRV tools when git is absent.
#pragma once
#define SPIRV_TOOLS_COMMIT_ID "0000000000000000000000000000000000000000"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment