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:
parent
51fd66e3dd
commit
9a9b837519
10
DEPS
10
DEPS
|
@ -50,25 +50,25 @@ deps = {
|
||||||
|
|
||||||
# SPIRV-Cross
|
# SPIRV-Cross
|
||||||
'third_party/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',
|
'condition': 'dawn_standalone',
|
||||||
},
|
},
|
||||||
|
|
||||||
# SPIRV compiler dependencies: SPIRV-Tools, SPIRV-headers, glslang and shaderc
|
# SPIRV compiler dependencies: SPIRV-Tools, SPIRV-headers, glslang and shaderc
|
||||||
'third_party/SPIRV-Tools': {
|
'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',
|
'condition': 'dawn_standalone',
|
||||||
},
|
},
|
||||||
'third_party/spirv-headers': {
|
'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',
|
'condition': 'dawn_standalone',
|
||||||
},
|
},
|
||||||
'third_party/glslang': {
|
'third_party/glslang': {
|
||||||
'url': '{chromium_git}/external/github.com/KhronosGroup/glslang@0ac199df32687fe17b38cd2d0da64c3742e24fef',
|
'url': '{chromium_git}/external/github.com/KhronosGroup/glslang@ef807f4bc543e061f25dbbee6cb64dd5053b2adc',
|
||||||
'condition': 'dawn_standalone',
|
'condition': 'dawn_standalone',
|
||||||
},
|
},
|
||||||
'third_party/shaderc': {
|
'third_party/shaderc': {
|
||||||
'url': '{chromium_git}/external/github.com/google/shaderc@634dd3545cbccb9362f16f41b3b75703f290a9fd',
|
'url': '{chromium_git}/external/github.com/google/shaderc@ff9ae40e3734a264a56bba02191f5ae18c7e5e03',
|
||||||
'condition': 'dawn_standalone',
|
'condition': 'dawn_standalone',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include <spirv-cross/spirv_cross.hpp>
|
#include <spirv-cross/spirv_cross.hpp>
|
||||||
#include <spirv-tools/libspirv.hpp>
|
#include <spirv-tools/libspirv.hpp>
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
namespace dawn_native {
|
namespace dawn_native {
|
||||||
|
|
||||||
MaybeError ValidateShaderModuleDescriptor(DeviceBase*,
|
MaybeError ValidateShaderModuleDescriptor(DeviceBase*,
|
||||||
|
@ -153,7 +155,8 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in bindingInfo with the SPIRV bindings
|
// 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,
|
const spirv_cross::Compiler& compiler,
|
||||||
dawn::BindingType bindingType) {
|
dawn::BindingType bindingType) {
|
||||||
for (const auto& resource : resources) {
|
for (const auto& resource : resources) {
|
||||||
|
|
|
@ -60,8 +60,7 @@ namespace dawn_native { namespace metal {
|
||||||
|
|
||||||
// By default SPIRV-Cross will give MSL resources indices in increasing order.
|
// 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
|
// To make the MSL indices match the indices chosen in the PipelineLayout, we build
|
||||||
// a table of MSLResourceBinding to give to SPIRV-Cross
|
// a table of MSLResourceBinding to give to SPIRV-Cross.
|
||||||
std::vector<spirv_cross::MSLResourceBinding> mslBindings;
|
|
||||||
|
|
||||||
// Reserve index 0 for buffers for the push constants buffer.
|
// Reserve index 0 for buffers for the push constants buffer.
|
||||||
for (auto stage : IterateStages(kAllStages)) {
|
for (auto stage : IterateStages(kAllStages)) {
|
||||||
|
@ -71,7 +70,7 @@ namespace dawn_native { namespace metal {
|
||||||
binding.binding = spirv_cross::kPushConstBinding;
|
binding.binding = spirv_cross::kPushConstBinding;
|
||||||
binding.msl_buffer = 0;
|
binding.msl_buffer = 0;
|
||||||
|
|
||||||
mslBindings.push_back(binding);
|
compiler.add_msl_resource_binding(binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create one resource binding entry per stage per binding.
|
// Create one resource binding entry per stage per binding.
|
||||||
|
@ -87,7 +86,7 @@ namespace dawn_native { namespace metal {
|
||||||
mslBinding.binding = binding;
|
mslBinding.binding = binding;
|
||||||
mslBinding.msl_buffer = mslBinding.msl_texture = mslBinding.msl_sampler = index;
|
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
|
// SPIRV-Cross also supports re-ordering attributes but it seems to do the correct thing
|
||||||
// by default.
|
// by default.
|
||||||
std::string msl = compiler.compile(nullptr, &mslBindings);
|
std::string msl = compiler.compile();
|
||||||
NSString* mslSource = [NSString stringWithFormat:@"%s", msl.c_str()];
|
NSString* mslSource = [NSString stringWithFormat:@"%s", msl.c_str()];
|
||||||
|
|
||||||
auto mtlDevice = ToBackend(GetDevice())->GetMTLDevice();
|
auto mtlDevice = ToBackend(GetDevice())->GetMTLDevice();
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace {
|
||||||
DawnSPIRVCrossFuzzer::ExecuteWithSignalTrap([&compiler, &input]() {
|
DawnSPIRVCrossFuzzer::ExecuteWithSignalTrap([&compiler, &input]() {
|
||||||
// Using the options that are used by Dawn, they appear in ShaderModuleGL.cpp
|
// Using the options that are used by Dawn, they appear in ShaderModuleGL.cpp
|
||||||
shaderc_spvc::CompileOptions options;
|
shaderc_spvc::CompileOptions options;
|
||||||
options.SetOutputLanguageVersion(440);
|
options.SetGLSLLanguageVersion(440);
|
||||||
options.SetFixupClipspace(true);
|
options.SetFixupClipspace(true);
|
||||||
compiler.CompileSpvToGlsl(input.data(), input.size(), options);
|
compiler.CompileSpvToGlsl(input.data(), input.size(), options);
|
||||||
});
|
});
|
||||||
|
|
|
@ -70,6 +70,10 @@ static_library("spirv_cross") {
|
||||||
"${spirv_cross_dir}/spirv_common.hpp",
|
"${spirv_cross_dir}/spirv_common.hpp",
|
||||||
"${spirv_cross_dir}/spirv_cross.cpp",
|
"${spirv_cross_dir}/spirv_cross.cpp",
|
||||||
"${spirv_cross_dir}/spirv_cross.hpp",
|
"${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
|
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_common.hpp",
|
||||||
"${spirv_cross_dir}/spirv_cross.cpp",
|
"${spirv_cross_dir}/spirv_cross.cpp",
|
||||||
"${spirv_cross_dir}/spirv_cross.hpp",
|
"${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.cpp",
|
||||||
"${spirv_cross_dir}/spirv_glsl.hpp",
|
"${spirv_cross_dir}/spirv_glsl.hpp",
|
||||||
"${spirv_cross_dir}/spirv_hlsl.cpp",
|
"${spirv_cross_dir}/spirv_hlsl.cpp",
|
||||||
"${spirv_cross_dir}/spirv_hlsl.hpp",
|
"${spirv_cross_dir}/spirv_hlsl.hpp",
|
||||||
"${spirv_cross_dir}/spirv_msl.cpp",
|
"${spirv_cross_dir}/spirv_msl.cpp",
|
||||||
"${spirv_cross_dir}/spirv_msl.hpp",
|
"${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" ]
|
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||||
|
|
||||||
public_configs = [ ":glm_public_config" ]
|
public_configs = [ ":glm_public_config" ]
|
||||||
|
|
||||||
# GLM is header only but has too many files to list them.
|
# GLM is header only but has too many files to list them.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue