diff --git a/tools/shaderc/shaderc_metal.cpp b/tools/shaderc/shaderc_metal.cpp index 5c51c9ebf..6260ef1ef 100644 --- a/tools/shaderc/shaderc_metal.cpp +++ b/tools/shaderc/shaderc_metal.cpp @@ -819,7 +819,17 @@ namespace bgfx { namespace metal opt.SetMessageConsumer(print_msg_to_stderr); opt.RegisterLegalizationPasses(); - if (!opt.Run(spirv.data(), spirv.size(), &spirv)) + + spvtools::ValidatorOptions validatorOptions; + validatorOptions.SetBeforeHlslLegalization(true); + + if (!opt.Run( + spirv.data() + , spirv.size() + , &spirv + , validatorOptions + , false + ) ) { compiled = false; } @@ -862,7 +872,7 @@ namespace bgfx { namespace metal } spirv_cross::CompilerMSL msl(std::move(spirv)); - + auto executionModel = msl.get_execution_model(); spirv_cross::MSLResourceBinding newBinding; newBinding.stage = executionModel; @@ -911,7 +921,7 @@ namespace bgfx { namespace metal std::string name = msl.get_name(resource.id); if (name.size() > 7 && 0 == bx::strCmp(name.c_str() + name.length() - 7, "Texture") ) msl.set_name(resource.id, name.substr(0, name.length() - 7)); - + unsigned set = msl.get_decoration( resource.id, spv::DecorationDescriptorSet ); unsigned binding = msl.get_decoration( resource.id, spv::DecorationBinding ); newBinding.desc_set = set; @@ -920,13 +930,13 @@ namespace bgfx { namespace metal newBinding.msl_sampler = binding - textureBindingOffset; msl.add_msl_resource_binding( newBinding ); } - + for (auto &resource : resources.storage_images) { std::string name = msl.get_name(resource.id); if (name.size() > 7 && 0 == bx::strCmp(name.c_str() + name.length() - 7, "Texture") ) msl.set_name(resource.id, name.substr(0, name.length() - 7)); - + unsigned set = msl.get_decoration( resource.id, spv::DecorationDescriptorSet ); unsigned binding = msl.get_decoration( resource.id, spv::DecorationBinding ); newBinding.desc_set = set; @@ -935,7 +945,7 @@ namespace bgfx { namespace metal newBinding.msl_sampler = binding - textureBindingOffset; msl.add_msl_resource_binding( newBinding ); } - + std::string source = msl.compile(); if ('c' == _options.shaderType) diff --git a/tools/shaderc/shaderc_spirv.cpp b/tools/shaderc/shaderc_spirv.cpp index b81749e31..002d67719 100644 --- a/tools/shaderc/shaderc_spirv.cpp +++ b/tools/shaderc/shaderc_spirv.cpp @@ -983,7 +983,13 @@ namespace bgfx { namespace spirv spvtools::ValidatorOptions validatorOptions; validatorOptions.SetBeforeHlslLegalization(true); - if (!opt.Run(spirv.data(), spirv.size(), &spirv, validatorOptions, false) ) + if (!opt.Run( + spirv.data() + , spirv.size() + , &spirv + , validatorOptions + , false + ) ) { compiled = false; }