Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChip Davis <chip@holochip.com>2022-10-11 11:25:16 +0300
committerChip Davis <chip@holochip.com>2022-10-19 01:04:50 +0300
commite698633e2295df658788b301782e6cddee53f6f2 (patch)
treee3a0524ab0beb76379ed7e5fd1e74b3d55c2bb73
parent0b679334e4cbc3e42e4ed9d3fb1df6b94c018628 (diff)
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.*`.
-rw-r--r--spirv_msl.cpp10
1 files 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<SPIRType>(mbr_type_id), storage);
- location++;
+ location += type_to_location_count(get<SPIRType>(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<SPIRType>(mbr_type_id), storage);
- location++;
+ location += type_to_location_count(get<SPIRType>(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<SPIRType>(mbr_type_id), storage);
- location++;
+ location += type_to_location_count(get<SPIRType>(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<SPIRType>(mbr_type_id), storage);
- location++;
+ location += type_to_location_count(get<SPIRType>(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<SPIRType>(mbr_type_id), storage);
- location++;
+ location += type_to_location_count(get<SPIRType>(mbr_type_id));
}
// Copy the component location, if present.