Fix #119195: Ensure Metal uses correct attribute conversion mode

Resolves custom attribute types for ints and booleans by ensuring
conversion mode is correct. Previously, the attribute declarations
were assumed to be linear. However, patch ensures the correct
attribute index is now fetched, ensuring the conversion mode
is correctly specified for non-linear attribute ID's.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/119569
This commit is contained in:
Jason Fielder 2024-03-18 13:38:09 +01:00 committed by Jeroen Bakker
parent 5ba581bd0a
commit 661d12aef7

@ -3166,10 +3166,11 @@ std::string MSLGeneratorInterface::generate_msl_vertex_attribute_input_populatio
&do_attribute_conversion_on_read, this->vertex_input_attributes[attribute].type);
if (do_attribute_conversion_on_read) {
out << "\t" << attribute_conversion_func_name << "(MTL_AttributeConvert" << attribute
<< ", v_in." << this->vertex_input_attributes[attribute].name << ", "
<< shader_stage_inst_name << "." << this->vertex_input_attributes[attribute].name
<< ");" << std::endl;
BLI_assert(this->vertex_input_attributes[attribute].layout_location >= 0);
out << "\t" << attribute_conversion_func_name << "(MTL_AttributeConvert"
<< this->vertex_input_attributes[attribute].layout_location << ", v_in."
<< this->vertex_input_attributes[attribute].name << ", " << shader_stage_inst_name
<< "." << this->vertex_input_attributes[attribute].name << ");" << std::endl;
}
else {
out << "\t" << shader_stage_inst_name << "."