Vulkan: Roll loader/validation layers SDK. (2/2)

This hasn't been updated in a while, so there are many changes.
It should also include better validation for memory barriers.

Also includes updated builds for SPIRV Tools and glslang.
A few pull requests need to land before landing this in ANGLE.

This second step re-enables Vulkan and includes the updated build.

Includes a workaround for parameter_validation.h no longer being
auto-generated, and the stale file clobbering the build.

Also includes a fix for an incorrect memory barrier.

Bug: angleproject:2237
Change-Id: Iae611764870281ed6aa7b187ec0c4e44226c722a
Reviewed-on: https://chromium-review.googlesource.com/759197
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
This commit is contained in:
Jamie Madill 2017-12-13 15:02:24 -05:00 коммит произвёл Commit Bot
Родитель 9d4d7f06fa
Коммит f15f9cec31
5 изменённых файлов: 255 добавлений и 66 удалений

Просмотреть файл

@ -29,17 +29,13 @@ if (is_win) {
angle_enable_d3d11 = true
angle_enable_gl = true
angle_enable_gl_null = true
# TODO(jmadill): Re-enable after roll.
# angle_enable_vulkan = true
angle_enable_vulkan = true
import("//build/config/win/visual_studio_version.gni")
} else if (is_linux && use_x11 && !is_chromeos) {
angle_enable_gl = true
angle_enable_gl_null = true
# TODO(jmadill): Re-enable after roll.
# angle_enable_vulkan = true
angle_enable_vulkan = true
} else if (is_mac || ozone_platform_gbm) {
angle_enable_gl = true
angle_enable_gl_null = true

Просмотреть файл

@ -29,8 +29,13 @@ for json_fname in glob.glob(os.path.join(source_dir, "*.json")):
data = json.load(infile)
# update the path
prev_name = os.path.basename(data['layer']['library_path'])
data['layer']['library_path'] = prev_name
if not 'layer' in data:
raise Exception("Could not find a layer key in " + json_fname)
# The standard validation layer has no library path.
if 'library_path' in data['layer']:
prev_name = os.path.basename(data['layer']['library_path'])
data['layer']['library_path'] = prev_name
target_fname = os.path.join(target_dir, os.path.basename(json_fname))
with open(target_fname, "w") as outfile:

Просмотреть файл

@ -0,0 +1,25 @@
#!/usr/bin/python2
#
# Copyright 2017 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.
#
# remove_file_if_exists.py:
# This special action is needed to remove generated headers.
# Otherwise ANGLE will pick up the old file(s) and the build will fail.
#
import sys
import os
if len(sys.argv) < 3:
print("Usage: " + sys.argv[0] + " <remove_file> <stamp_file>")
remove_file = sys.argv[1]
if os.path.isfile(remove_file):
os.remove(remove_file)
# touch a dummy file to keep a timestamp
with open(sys.argv[2], "w") as f:
f.write("blah")
f.close()

Просмотреть файл

@ -211,7 +211,7 @@ vk::Error BufferVk::setDataImpl(ContextVk *contextVk,
bufferBarrier.size = static_cast<VkDeviceSize>(size);
commandBuffer->singleBufferBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, bufferBarrier);
VK_PIPELINE_STAGE_TRANSFER_BIT, 0, bufferBarrier);
VkBufferCopy copyRegion = {offset, 0, size};
commandBuffer->copyBuffer(stagingBuffer.getBuffer(), mBuffer, 1, &copyRegion);

Просмотреть файл

@ -31,10 +31,21 @@ if (is_win) {
vulkan_gen_dir = "$target_gen_dir/angle/vulkan"
raw_vulkan_gen_dir = rebase_path(vulkan_gen_dir, root_build_dir)
raw_spirv_tools_dir = rebase_path(spirv_tools_dir, root_build_dir)
# Vulkan helper scripts
# ---------------------
# Copy vk_validation_error_messages.h from source to build dir for the scripts.
copy("vulkan_validation_error_messages") {
sources = [
"$vulkan_layers_dir/layers/vk_validation_error_messages.h",
]
outputs = [
"$root_out_dir/vk_validation_error_messages.h",
]
}
helper_script_and_deps = [
[
"vulkan_gen_dispatch_table_helper_h",
@ -46,6 +57,11 @@ helper_script_and_deps = [
"vk_enum_string_helper.h",
"helper_file_generator.py",
],
[
"vulkan_gen_extension_helper",
"vk_extension_helper.h",
"helper_file_generator.py",
],
[
"vulkan_gen_layer_dispatch_table_h",
"vk_layer_dispatch_table.h",
@ -61,6 +77,11 @@ helper_script_and_deps = [
"vk_loader_extensions.h",
"loader_extension_generator.py",
],
[
"vulkan_gen_object_types_h",
"vk_object_types.h",
"helper_file_generator.py",
],
[
"vulkan_gen_safe_struct_cpp",
"vk_safe_struct.cpp",
@ -87,8 +108,18 @@ helper_script_and_deps = [
"threading_generator.py",
],
[
"vulkan_gen_parameter_validation_helper",
"parameter_validation.h",
"vulkan_gen_typemap_helper",
"vk_typemap_helper.h",
"helper_file_generator.py",
],
[
"vulkan_gen_object_tracker_cpp",
"object_tracker.cpp",
"object_tracker_generator.py",
],
[
"vulkan_gen_parameter_validation_cpp",
"parameter_validation.cpp",
"parameter_validation_generator.py",
],
[
@ -104,6 +135,9 @@ foreach(script_and_dep, helper_script_and_deps) {
dep = script_and_dep[2]
target("action", target_name) {
script = "$vulkan_layers_dir/scripts/lvl_genvk.py"
deps = [
":vulkan_validation_error_messages",
]
inputs = [
"$vulkan_layers_dir/scripts/$dep",
"$vulkan_layers_dir/scripts/generator.py",
@ -124,6 +158,23 @@ foreach(script_and_dep, helper_script_and_deps) {
}
}
# This could be generalized to a foreach if other revisions are added.
action("spirv_tools_external_revision_generate") {
script = "$vulkan_layers_dir/scripts/external_revision_generator.py"
inputs = [
"$spirv_tools_dir/.git/HEAD",
"$spirv_tools_dir/.git/index",
]
outputs = [
"$vulkan_gen_dir/spirv_tools_commit_id.h",
]
args = [
"$raw_spirv_tools_dir",
"SPIRV_TOOLS_COMMIT_ID",
"$raw_vulkan_gen_dir/spirv_tools_commit_id.h",
]
}
config("vulkan_generate_helper_files_config") {
include_dirs = [
vulkan_gen_dir,
@ -132,7 +183,9 @@ config("vulkan_generate_helper_files_config") {
}
group("vulkan_generate_helper_files") {
public_deps = []
public_deps = [
":spirv_tools_external_revision_generate",
]
public_configs = [ ":vulkan_generate_helper_files_config" ]
foreach(script_and_dep, helper_script_and_deps) {
target_name = script_and_dep[0]
@ -212,6 +265,9 @@ static_library("vulkan_loader") {
"$vulkan_layers_dir/loader/murmurhash.h",
"$vulkan_layers_dir/loader/phys_dev_ext.c",
"$vulkan_layers_dir/loader/trampoline.c",
# TODO(jmadill): Use assembler where available.
"$vulkan_layers_dir/loader/unknown_ext_chain.c",
"$vulkan_layers_dir/loader/vk_loader_platform.h",
"$vulkan_layers_dir/loader/wsi.c",
"$vulkan_layers_dir/loader/wsi.h",
@ -256,43 +312,77 @@ raw_spirv_source_dir = rebase_path(spirv_source_dir, root_build_dir)
raw_spirv_include_dir = rebase_path(spirv_include_dir, root_build_dir)
raw_spirv_headers_dir = rebase_path(spirv_headers_dir, root_build_dir)
action("spirv_tools_gen_tables_1_0") {
script = "$spirv_tools_dir/utils/generate_grammar_tables.py"
grammar_processing_script = "$spirv_tools_dir/utils/generate_grammar_tables.py"
action("spirv_tools_gen_enum_string_mapping") {
script = grammar_processing_script
sources = [
"$spirv_include_dir/1.2/spirv.core.grammar.json",
]
outputs = [
"$vulkan_gen_dir/extension_enum.inc",
"$vulkan_gen_dir/enum_string_mapping.inc",
]
args = [
"--spirv-core-grammar=$raw_spirv_include_dir/1.2/spirv.core.grammar.json",
"--extension-enum-output=$raw_vulkan_gen_dir/extension_enum.inc",
"--enum-string-mapping-output=$raw_vulkan_gen_dir/enum_string_mapping.inc",
]
}
spvtools_core_tables = [
"1.0",
"1.1",
"1.2",
]
foreach(version, spvtools_core_tables) {
action("spirv_tools_gen_core_tables_" + version) {
script = grammar_processing_script
sources = [
"$spirv_include_dir/$version/spirv.core.grammar.json",
]
outputs = [
"$vulkan_gen_dir/core.insts-$version.inc",
"$vulkan_gen_dir/operand.kinds-$version.inc",
]
args = [
"--spirv-core-grammar=$raw_spirv_include_dir/$version/spirv.core.grammar.json",
"--core-insts-output=$raw_vulkan_gen_dir/core.insts-$version.inc",
"--operand-kinds-output=$raw_vulkan_gen_dir/operand.kinds-$version.inc",
]
}
}
action("spirv_tools_gen_glsl_tables") {
script = grammar_processing_script
sources = [
"$spirv_include_dir/1.0/extinst.glsl.std.450.grammar.json",
"$spirv_include_dir/1.0/spirv.core.grammar.json",
"$spirv_source_dir/extinst-1.0.opencl.std.grammar.json",
]
outputs = [
"$vulkan_gen_dir/core.insts-1.0.inc",
"$vulkan_gen_dir/glsl.std.450.insts-1.0.inc",
"$vulkan_gen_dir/opencl.std.insts-1.0.inc",
"$vulkan_gen_dir/operand.kinds-1.0.inc",
]
args = [
"--spirv-core-grammar=$raw_spirv_include_dir/1.0/spirv.core.grammar.json",
"--extinst-glsl-grammar=$raw_spirv_include_dir/1.0/extinst.glsl.std.450.grammar.json",
"--extinst-opencl-grammar=$raw_spirv_source_dir/extinst-1.0.opencl.std.grammar.json",
"--core-insts-output=$raw_vulkan_gen_dir/core.insts-1.0.inc",
"--glsl-insts-output=$raw_vulkan_gen_dir/glsl.std.450.insts-1.0.inc",
"--opencl-insts-output=$raw_vulkan_gen_dir/opencl.std.insts-1.0.inc",
"--operand-kinds-output=$raw_vulkan_gen_dir/operand.kinds-1.0.inc",
]
}
action("spirv_tools_gen_tables_1_1") {
script = "$spirv_tools_dir/utils/generate_grammar_tables.py"
action("spirv_tools_gen_opencl_tables") {
script = grammar_processing_script
sources = [
"$spirv_include_dir/1.1/spirv.core.grammar.json",
"$spirv_include_dir/1.0/extinst.opencl.std.100.grammar.json",
"$spirv_include_dir/1.0/spirv.core.grammar.json",
]
outputs = [
"$vulkan_gen_dir/core.insts-1.1.inc",
"$vulkan_gen_dir/operand.kinds-1.1.inc",
"$vulkan_gen_dir/opencl.std.insts-1.0.inc",
]
args = [
"--spirv-core-grammar=$raw_spirv_include_dir/1.1/spirv.core.grammar.json",
"--core-insts-output=$raw_vulkan_gen_dir/core.insts-1.1.inc",
"--operand-kinds-output=$raw_vulkan_gen_dir/operand.kinds-1.1.inc",
"--spirv-core-grammar=$raw_spirv_include_dir/1.0/spirv.core.grammar.json",
"--extinst-opencl-grammar=$raw_spirv_include_dir/1.0/extinst.opencl.std.100.grammar.json",
"--opencl-insts-output=$raw_vulkan_gen_dir/opencl.std.insts-1.0.inc",
]
}
@ -310,6 +400,35 @@ action("spirv_tools_gen_generators_inc") {
]
}
spvtools_vendor_tables = [
"spv-amd-shader-explicit-vertex-parameter",
"spv-amd-shader-trinary-minmax",
"spv-amd-gcn-shader",
"spv-amd-shader-ballot",
]
foreach(target_name, spvtools_vendor_tables) {
insts_file = "$target_name.insts.inc"
grammar_file = "extinst.$target_name.grammar.json"
action(target_name) {
script = grammar_processing_script
sources = [
"$spirv_source_dir/$grammar_file",
]
outputs = [
"$vulkan_gen_dir/$insts_file",
]
args = [
"--extinst-vendor-grammar=$raw_spirv_source_dir/$grammar_file",
"--vendor-insts-output=$raw_vulkan_gen_dir/$insts_file",
]
}
}
config("spirv_tools_config") {
include_dirs = [ "$spirv_tools_dir/include" ]
if (is_win) {
@ -326,9 +445,13 @@ config("spirv_tools_config") {
static_library("spirv_tools") {
deps = [
":spirv_tools_gen_core_tables_1.0",
":spirv_tools_gen_core_tables_1.1",
":spirv_tools_gen_core_tables_1.2",
":spirv_tools_gen_enum_string_mapping",
":spirv_tools_gen_generators_inc",
":spirv_tools_gen_tables_1_0",
":spirv_tools_gen_tables_1_1",
":spirv_tools_gen_glsl_tables",
":spirv_tools_gen_opencl_tables",
]
include_dirs = [
vulkan_gen_dir,
@ -363,12 +486,17 @@ static_library("spirv_tools") {
# TODO(jmadill): Determine if this is ever needed.
#"$spirv_tools_dir/source/software_version.cpp",
"$spirv_tools_dir/source/enum_string_mapping.cpp",
"$spirv_tools_dir/source/extensions.cpp",
"$spirv_tools_dir/source/extensions.h",
"$spirv_tools_dir/source/spirv_constant.h",
"$spirv_tools_dir/source/spirv_definition.h",
"$spirv_tools_dir/source/spirv_endian.cpp",
"$spirv_tools_dir/source/spirv_endian.h",
"$spirv_tools_dir/source/spirv_target_env.cpp",
"$spirv_tools_dir/source/spirv_target_env.h",
"$spirv_tools_dir/source/spirv_validator_options.cpp",
"$spirv_tools_dir/source/spirv_validator_options.h",
"$spirv_tools_dir/source/table.cpp",
"$spirv_tools_dir/source/table.h",
"$spirv_tools_dir/source/text.cpp",
@ -379,6 +507,8 @@ static_library("spirv_tools") {
"$spirv_tools_dir/source/util/hex_float.h",
"$spirv_tools_dir/source/util/parse_number.cpp",
"$spirv_tools_dir/source/util/parse_number.h",
"$spirv_tools_dir/source/util/string_utils.cpp",
"$spirv_tools_dir/source/util/string_utils.h",
"$spirv_tools_dir/source/val/basic_block.cpp",
"$spirv_tools_dir/source/val/construct.cpp",
"$spirv_tools_dir/source/val/function.cpp",
@ -386,13 +516,26 @@ static_library("spirv_tools") {
"$spirv_tools_dir/source/val/validation_state.cpp",
"$spirv_tools_dir/source/validate.cpp",
"$spirv_tools_dir/source/validate.h",
"$spirv_tools_dir/source/validate_arithmetics.cpp",
"$spirv_tools_dir/source/validate_bitwise.cpp",
"$spirv_tools_dir/source/validate_capability.cpp",
"$spirv_tools_dir/source/validate_cfg.cpp",
"$spirv_tools_dir/source/validate_conversion.cpp",
"$spirv_tools_dir/source/validate_datarules.cpp",
"$spirv_tools_dir/source/validate_decorations.cpp",
"$spirv_tools_dir/source/validate_derivatives.cpp",
"$spirv_tools_dir/source/validate_id.cpp",
"$spirv_tools_dir/source/validate_image.cpp",
"$spirv_tools_dir/source/validate_instruction.cpp",
"$spirv_tools_dir/source/validate_layout.cpp",
"$spirv_tools_dir/source/validate_logicals.cpp",
"$spirv_tools_dir/source/validate_type_unique.cpp",
]
public_configs = [ ":spirv_tools_config" ]
foreach(target_name, spvtools_vendor_tables) {
deps += [ ":$target_name" ]
}
}
# glslang
@ -488,9 +631,7 @@ static_library("glslang") {
"$glslang_dir/glslang/MachineIndependent/preprocessor/PpAtom.cpp",
"$glslang_dir/glslang/MachineIndependent/preprocessor/PpContext.cpp",
"$glslang_dir/glslang/MachineIndependent/preprocessor/PpContext.h",
"$glslang_dir/glslang/MachineIndependent/preprocessor/PpMemory.cpp",
"$glslang_dir/glslang/MachineIndependent/preprocessor/PpScanner.cpp",
"$glslang_dir/glslang/MachineIndependent/preprocessor/PpSymbols.cpp",
"$glslang_dir/glslang/MachineIndependent/preprocessor/PpTokens.cpp",
"$glslang_dir/glslang/MachineIndependent/preprocessor/PpTokens.h",
"$glslang_dir/glslang/MachineIndependent/propagateNoContraction.cpp",
@ -499,21 +640,6 @@ static_library("glslang") {
"$glslang_dir/glslang/MachineIndependent/reflection.h",
"$glslang_dir/glslang/OSDependent/osinclude.h",
"$glslang_dir/glslang/Public/ShaderLang.h",
"$glslang_dir/hlsl/hlslAttributes.cpp",
"$glslang_dir/hlsl/hlslAttributes.h",
"$glslang_dir/hlsl/hlslGrammar.cpp",
"$glslang_dir/hlsl/hlslGrammar.h",
"$glslang_dir/hlsl/hlslOpMap.cpp",
"$glslang_dir/hlsl/hlslOpMap.h",
"$glslang_dir/hlsl/hlslParseHelper.cpp",
"$glslang_dir/hlsl/hlslParseHelper.h",
"$glslang_dir/hlsl/hlslParseables.cpp",
"$glslang_dir/hlsl/hlslParseables.h",
"$glslang_dir/hlsl/hlslScanContext.cpp",
"$glslang_dir/hlsl/hlslScanContext.h",
"$glslang_dir/hlsl/hlslTokenStream.cpp",
"$glslang_dir/hlsl/hlslTokenStream.h",
"$glslang_dir/hlsl/hlslTokens.h",
]
public_configs = [ ":glslang_config" ]
configs += [ ":glslang_internal_config" ]
@ -561,6 +687,8 @@ source_set("vulkan_layer_table") {
}
core_validation_sources = [
# This file is manually included in the layer
# "$vulkan_gen_dir/vk_safe_struct.cpp",
"$vulkan_gen_dir/vk_safe_struct.h",
"$vulkan_layers_dir/layers/buffer_validation.cpp",
"$vulkan_layers_dir/layers/buffer_validation.h",
@ -568,24 +696,30 @@ core_validation_sources = [
"$vulkan_layers_dir/layers/core_validation.h",
"$vulkan_layers_dir/layers/descriptor_sets.cpp",
"$vulkan_layers_dir/layers/descriptor_sets.h",
"$vulkan_layers_dir/layers/shader_validation.cpp",
"$vulkan_layers_dir/layers/shader_validation.h",
"$vulkan_layers_dir/layers/xxhash.c",
"$vulkan_layers_dir/layers/xxhash.h",
]
object_tracker_sources = [
"$vulkan_layers_dir/layers/object_tracker.cpp",
"$vulkan_gen_dir/object_tracker.cpp",
"$vulkan_layers_dir/layers/object_tracker.h",
"$vulkan_layers_dir/layers/object_tracker_utils.cpp",
]
parameter_validation_sources = [
"$vulkan_gen_dir/parameter_validation.h",
"$vulkan_layers_dir/layers/parameter_validation.cpp",
]
swapchain_sources = [
"$vulkan_layers_dir/layers/swapchain.cpp",
"$vulkan_layers_dir/layers/swapchain.h",
"$vulkan_gen_dir/parameter_validation.cpp",
"$vulkan_layers_dir/layers/parameter_validation.h",
"$vulkan_layers_dir/layers/parameter_validation_utils.cpp",
]
threading_sources = [
"$vulkan_gen_dir/thread_check.h",
"$vulkan_layers_dir/layers/threading.cpp",
"$vulkan_layers_dir/layers/threading.h",
]
unique_objects_sources = [
"$vulkan_gen_dir/unique_objects_wrappers.h",
@ -605,17 +739,12 @@ layers = [
[
"object_tracker",
object_tracker_sources,
"",
":vulkan_gen_object_tracker_cpp",
],
[
"parameter_validation",
parameter_validation_sources,
":vulkan_gen_parameter_validation_helper",
],
[
"swapchain",
swapchain_sources,
"",
":vulkan_gen_parameter_validation",
],
[
"threading",
@ -633,7 +762,6 @@ vulkan_gen_json_files_outputs = [
"$root_out_dir/$data_dir/VkLayer_core_validation.json",
"$root_out_dir/$data_dir/VkLayer_object_tracker.json",
"$root_out_dir/$data_dir/VkLayer_parameter_validation.json",
"$root_out_dir/$data_dir/VkLayer_swapchain.json",
"$root_out_dir/$data_dir/VkLayer_threading.json",
"$root_out_dir/$data_dir/VkLayer_unique_objects.json",
]
@ -645,7 +773,6 @@ action("vulkan_gen_json_files") {
"$vulkan_layers_dir/layers/windows/VkLayer_core_validation.json",
"$vulkan_layers_dir/layers/windows/VkLayer_object_tracker.json",
"$vulkan_layers_dir/layers/windows/VkLayer_parameter_validation.json",
"$vulkan_layers_dir/layers/windows/VkLayer_swapchain.json",
"$vulkan_layers_dir/layers/windows/VkLayer_threading.json",
"$vulkan_layers_dir/layers/windows/VkLayer_unique_objects.json",
]
@ -656,7 +783,6 @@ action("vulkan_gen_json_files") {
"$vulkan_layers_dir/layers/linux/VkLayer_core_validation.json",
"$vulkan_layers_dir/layers/linux/VkLayer_object_tracker.json",
"$vulkan_layers_dir/layers/linux/VkLayer_parameter_validation.json",
"$vulkan_layers_dir/layers/linux/VkLayer_swapchain.json",
"$vulkan_layers_dir/layers/linux/VkLayer_threading.json",
"$vulkan_layers_dir/layers/linux/VkLayer_unique_objects.json",
]
@ -671,6 +797,8 @@ action("vulkan_gen_json_files") {
source_set("vulkan_layer_utils") {
sources = [
"$vulkan_layers_dir/layers/vk_format_utils.cpp",
"$vulkan_layers_dir/layers/vk_format_utils.h",
"$vulkan_layers_dir/layers/vk_layer_config.cpp",
"$vulkan_layers_dir/layers/vk_layer_config.h",
"$vulkan_layers_dir/layers/vk_layer_extension_utils.cpp",
@ -686,6 +814,9 @@ source_set("vulkan_layer_utils") {
public_deps = [
":vulkan_generate_helper_files",
]
deps = [
":vulkan_validation_error_messages",
]
configs -= vulkan_undefine_configs
}
@ -700,6 +831,38 @@ source_set("vulkan_core_validation_glslang") {
public_configs = [ ":vulkan_core_validation_config" ]
}
config("vulkan_parameter_validation_config") {
if (is_clang) {
cflags_cc = [ "-Wno-unused-const-variable" ]
}
}
# This special action is needed to remove the generated param header.
# Otherwise the param gen cpp file will pick up the old file and the
# build will fail. It's a bit unfortunate but necessary.
action("vulkan_clean_parameter_gen_header") {
script = "$angle_root/scripts/remove_file_if_exists.py"
inputs = parameter_validation_sources
deps = [
":vulkan_gen_parameter_validation_cpp",
]
outputs = [
"$vulkan_gen_dir/parameter_validation_h_is_removed",
]
args = [
"$raw_vulkan_gen_dir/parameter_validation.h",
"$raw_vulkan_gen_dir/parameter_validation_h_is_removed",
]
}
source_set("vulkan_gen_parameter_validation") {
deps = [
":vulkan_clean_parameter_gen_header",
":vulkan_gen_parameter_validation_cpp",
]
public_configs = [ ":vulkan_parameter_validation_config" ]
}
foreach(layer_info, layers) {
name = layer_info[0]
shared_library("VkLayer_$name") {