diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2023-10-16 12:19:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-16 12:19:24 +0200 |
commit | 2de1265fca722929785d9acdec4ab728c47a0254 (patch) | |
tree | 61b9424b5157d6cf470bbe9d7283692d48c71415 /spirv_msl.cpp | |
parent | 105d5a8a79c3b6c538579bcd50deba9ee8b88e52 (diff) | |
parent | a4b85539820acde132b5b3a7c210cd8c809c70fc (diff) | |
download | SPIRV-Cross-upstream.tar.gz SPIRV-Cross-upstream.tar.bz2 SPIRV-Cross-upstream.zip |
Merge pull request #2218 from KhronosGroup/pr-2217upstream/1.3.268upstream
Merge PR 2217
Diffstat (limited to 'spirv_msl.cpp')
-rw-r--r-- | spirv_msl.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 9f9fcfc3..5605d172 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -13262,8 +13262,13 @@ void CompilerMSL::entry_point_args_discrete_descriptors(string &ep_args) { if (!ep_args.empty()) ep_args += ", "; - ep_args += - get_argument_address_space(var) + " " + type_to_glsl(type) + "& " + to_restrict(var_id, true) + r.name; + ep_args += get_argument_address_space(var) + " "; + + if (recursive_inputs.count(type.self)) + ep_args += string("void* ") + to_restrict(var_id, true) + r.name + "_vp"; + else + ep_args += type_to_glsl(type) + "& " + to_restrict(var_id, true) + r.name; + ep_args += " [[buffer(" + convert_to_string(r.index) + ")"; if (interlocked_resources.count(var_id)) ep_args += ", raster_order_group(0)"; @@ -13446,6 +13451,19 @@ void CompilerMSL::fix_up_shader_inputs_outputs() }); } } + + if (msl_options.replace_recursive_inputs && type_contains_recursion(type) && + (var.storage == StorageClassUniform || var.storage == StorageClassUniformConstant || + var.storage == StorageClassPushConstant || var.storage == StorageClassStorageBuffer)) + { + recursive_inputs.insert(type.self); + entry_func.fixup_hooks_in.push_back([this, &type, &var, var_id]() { + auto addr_space = get_argument_address_space(var); + auto var_name = to_name(var_id); + statement(addr_space, " auto& ", to_restrict(var_id, true), var_name, + " = *(", addr_space, " ", type_to_glsl(type), "*)", var_name, "_vp;"); + }); + } }); // Builtin variables |