Roll all SPIR-V dependencies together.

Function name changed in shaderc.
SPIRV-Cross split up into additional files.

BUG=chromium:951016

Change-Id: I49abb0a163fefdd61b7d6352e57e2a10f519abd9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6440
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Frank Henigman 2019-04-11 14:52:55 +00:00
parent 51fd66e3dd
commit 9a9b837519
5 changed files with 23 additions and 12 deletions

10
DEPS
View File

@ -50,25 +50,25 @@ deps = {
# SPIRV-Cross
'third_party/spirv-cross': {
'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Cross@a7697446b12666da353bb2bdafa792d988fb268c',
'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Cross@f07a4e16a60e1d0231dda5d3883550761bd70a47',
'condition': 'dawn_standalone',
},
# SPIRV compiler dependencies: SPIRV-Tools, SPIRV-headers, glslang and shaderc
'third_party/SPIRV-Tools': {
'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Tools@20b2e2b9f599413e6197a7b84ac71216d2ac4ad0',
'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Tools@12e4a7b649e6fe28683de9fc352200c82948a1f0',
'condition': 'dawn_standalone',
},
'third_party/spirv-headers': {
'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Headers@79b6681aadcb53c27d1052e5f8a0e82a981dbf2f',
'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Headers@111a25e4ae45e2b4d7c18415e1d6884712b958c4',
'condition': 'dawn_standalone',
},
'third_party/glslang': {
'url': '{chromium_git}/external/github.com/KhronosGroup/glslang@0ac199df32687fe17b38cd2d0da64c3742e24fef',
'url': '{chromium_git}/external/github.com/KhronosGroup/glslang@ef807f4bc543e061f25dbbee6cb64dd5053b2adc',
'condition': 'dawn_standalone',
},
'third_party/shaderc': {
'url': '{chromium_git}/external/github.com/google/shaderc@634dd3545cbccb9362f16f41b3b75703f290a9fd',
'url': '{chromium_git}/external/github.com/google/shaderc@ff9ae40e3734a264a56bba02191f5ae18c7e5e03',
'condition': 'dawn_standalone',
},

View File

@ -22,6 +22,8 @@
#include <spirv-cross/spirv_cross.hpp>
#include <spirv-tools/libspirv.hpp>
#include <sstream>
namespace dawn_native {
MaybeError ValidateShaderModuleDescriptor(DeviceBase*,
@ -153,7 +155,8 @@ namespace dawn_native {
}
// Fill in bindingInfo with the SPIRV bindings
auto ExtractResourcesBinding = [this](const std::vector<spirv_cross::Resource>& resources,
auto ExtractResourcesBinding = [this](const spirv_cross::SmallVector<spirv_cross::Resource>&
resources,
const spirv_cross::Compiler& compiler,
dawn::BindingType bindingType) {
for (const auto& resource : resources) {

View File

@ -60,8 +60,7 @@ namespace dawn_native { namespace metal {
// By default SPIRV-Cross will give MSL resources indices in increasing order.
// To make the MSL indices match the indices chosen in the PipelineLayout, we build
// a table of MSLResourceBinding to give to SPIRV-Cross
std::vector<spirv_cross::MSLResourceBinding> mslBindings;
// a table of MSLResourceBinding to give to SPIRV-Cross.
// Reserve index 0 for buffers for the push constants buffer.
for (auto stage : IterateStages(kAllStages)) {
@ -71,7 +70,7 @@ namespace dawn_native { namespace metal {
binding.binding = spirv_cross::kPushConstBinding;
binding.msl_buffer = 0;
mslBindings.push_back(binding);
compiler.add_msl_resource_binding(binding);
}
// Create one resource binding entry per stage per binding.
@ -87,7 +86,7 @@ namespace dawn_native { namespace metal {
mslBinding.binding = binding;
mslBinding.msl_buffer = mslBinding.msl_texture = mslBinding.msl_sampler = index;
mslBindings.push_back(mslBinding);
compiler.add_msl_resource_binding(mslBinding);
}
}
}
@ -103,7 +102,7 @@ namespace dawn_native { namespace metal {
{
// SPIRV-Cross also supports re-ordering attributes but it seems to do the correct thing
// by default.
std::string msl = compiler.compile(nullptr, &mslBindings);
std::string msl = compiler.compile();
NSString* mslSource = [NSString stringWithFormat:@"%s", msl.c_str()];
auto mtlDevice = ToBackend(GetDevice())->GetMTLDevice();

View File

@ -28,7 +28,7 @@ namespace {
DawnSPIRVCrossFuzzer::ExecuteWithSignalTrap([&compiler, &input]() {
// Using the options that are used by Dawn, they appear in ShaderModuleGL.cpp
shaderc_spvc::CompileOptions options;
options.SetOutputLanguageVersion(440);
options.SetGLSLLanguageVersion(440);
options.SetFixupClipspace(true);
compiler.CompileSpvToGlsl(input.data(), input.size(), options);
});

View File

@ -70,6 +70,10 @@ static_library("spirv_cross") {
"${spirv_cross_dir}/spirv_common.hpp",
"${spirv_cross_dir}/spirv_cross.cpp",
"${spirv_cross_dir}/spirv_cross.hpp",
"${spirv_cross_dir}/spirv_cross_parsed_ir.cpp",
"${spirv_cross_dir}/spirv_cross_parsed_ir.hpp",
"${spirv_cross_dir}/spirv_parser.cpp",
"${spirv_cross_dir}/spirv_parser.hpp",
]
need_glsl_cross = dawn_enable_opengl
@ -110,12 +114,16 @@ static_library("spirv_cross_full_for_fuzzers") {
"${spirv_cross_dir}/spirv_common.hpp",
"${spirv_cross_dir}/spirv_cross.cpp",
"${spirv_cross_dir}/spirv_cross.hpp",
"${spirv_cross_dir}/spirv_cross_parsed_ir.cpp",
"${spirv_cross_dir}/spirv_cross_parsed_ir.hpp",
"${spirv_cross_dir}/spirv_glsl.cpp",
"${spirv_cross_dir}/spirv_glsl.hpp",
"${spirv_cross_dir}/spirv_hlsl.cpp",
"${spirv_cross_dir}/spirv_hlsl.hpp",
"${spirv_cross_dir}/spirv_msl.cpp",
"${spirv_cross_dir}/spirv_msl.hpp",
"${spirv_cross_dir}/spirv_parser.cpp",
"${spirv_cross_dir}/spirv_parser.hpp",
]
}
@ -342,6 +350,7 @@ if (dawn_standalone) {
configs += [ "//build/config/compiler:no_chromium_code" ]
public_configs = [ ":glm_public_config" ]
# GLM is header only but has too many files to list them.
}