mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Fixed issue #1894.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user