From e698633e2295df658788b301782e6cddee53f6f2 Mon Sep 17 00:00:00 2001 From: Chip Davis Date: Tue, 11 Oct 2022 01:25:16 -0700 Subject: MSL: Account for composite types when assigning locations. In tessellation shaders, we call `add_plain_member_variable_to_interface_block()` on composite types, since we are using buffers for I/O and can use nested structs/arrays here. In those cases, we need to make sure the next location is incremented by the total amount consumed by the entire composite. Fixes six more tests in the CTS, under `dEQP-VK.tessellation.user_defined_io.per_vertex_block.*`. --- spirv_msl.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 07d23262..bc51447a 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -2994,7 +2994,7 @@ void CompilerMSL::add_plain_member_variable_to_interface_block(StorageClass stor { set_member_decoration(ib_type.self, ib_mbr_idx, DecorationLocation, location); mark_location_as_used_by_shader(location, get(mbr_type_id), storage); - location++; + location += type_to_location_count(get(mbr_type_id)); } else if (has_member_decoration(var_type.self, mbr_idx, DecorationLocation)) { @@ -3011,7 +3011,7 @@ void CompilerMSL::add_plain_member_variable_to_interface_block(StorageClass stor } set_member_decoration(ib_type.self, ib_mbr_idx, DecorationLocation, location); mark_location_as_used_by_shader(location, get(mbr_type_id), storage); - location++; + location += type_to_location_count(get(mbr_type_id)); } else if (has_decoration(var.self, DecorationLocation)) { @@ -3027,21 +3027,21 @@ void CompilerMSL::add_plain_member_variable_to_interface_block(StorageClass stor } set_member_decoration(ib_type.self, ib_mbr_idx, DecorationLocation, location); mark_location_as_used_by_shader(location, get(mbr_type_id), storage); - location++; + location += type_to_location_count(get(mbr_type_id)); } else if (is_builtin && is_tessellation_shader() && storage == StorageClassInput && inputs_by_builtin.count(builtin)) { location = inputs_by_builtin[builtin].location; set_member_decoration(ib_type.self, ib_mbr_idx, DecorationLocation, location); mark_location_as_used_by_shader(location, get(mbr_type_id), storage); - location++; + location += type_to_location_count(get(mbr_type_id)); } else if (is_builtin && capture_output_to_buffer && storage == StorageClassOutput && outputs_by_builtin.count(builtin)) { location = outputs_by_builtin[builtin].location; set_member_decoration(ib_type.self, ib_mbr_idx, DecorationLocation, location); mark_location_as_used_by_shader(location, get(mbr_type_id), storage); - location++; + location += type_to_location_count(get(mbr_type_id)); } // Copy the component location, if present. -- cgit v1.2.3