Merge pull request #2347 from billhollings/arg-buff-runtime-array

MSL: Support a runtime array with dynamic offset in an argument buffer.
This commit is contained in:
Hans-Kristian Arntzen 2024-06-19 23:25:34 +02:00 committed by GitHub
commit 6fd1f75636
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1361,14 +1361,14 @@ void CompilerMSL::emit_entry_point_declarations()
if (is_array(type))
{
if (!type.array[type.array.size() - 1])
SPIRV_CROSS_THROW("Runtime arrays with dynamic offsets are not supported yet.");
is_using_builtin_array = true;
statement(get_argument_address_space(var), " ", type_to_glsl(type), "* ", to_restrict(var_id, true), name,
type_to_array_glsl(type, var_id), " =");
uint32_t array_size = to_array_size_literal(type);
uint32_t array_size = get_resource_array_size(type, var_id);
if (array_size == 0)
SPIRV_CROSS_THROW("Size of runtime array with dynamic offset could not be determined from resource bindings.");
begin_scope();
for (uint32_t i = 0; i < array_size; i++)