diff options
author | Bill Hollings <bill.hollings@brenwill.com> | 2021-09-21 00:57:11 +0300 |
---|---|---|
committer | Bill Hollings <bill.hollings@brenwill.com> | 2021-09-23 16:56:04 +0300 |
commit | 548a23da341d9215efc89bca16cab3d0cf446db4 (patch) | |
tree | 2d1d5b1f78ce2359c82e761049b9c4236b997827 /spirv_msl.hpp | |
parent | fe1af2ae72d8de17954757a91bc4dfdf79209c30 (diff) |
MSL: Track location component to match vecsize between shader stages.
Matching output/input struct member types between shader stages could fail if
a location is shared between members, each using different components of that
location, because the member vecsize was only stored once for the location.
Add MSLShaderInput::component member.
Use LocationComponentPair to key inputs_by_location, instead of just location.
ensure_correct_input_type() pass component value as well as location.
Diffstat (limited to 'spirv_msl.hpp')
-rw-r--r-- | spirv_msl.hpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/spirv_msl.hpp b/spirv_msl.hpp index 9dc1a1a0..a2b1b551 100644 --- a/spirv_msl.hpp +++ b/spirv_msl.hpp @@ -60,6 +60,7 @@ enum MSLShaderInputFormat struct MSLShaderInput { uint32_t location = 0; + uint32_t component = 0; MSLShaderInputFormat format = MSL_SHADER_INPUT_FORMAT_OTHER; spv::BuiltIn builtin = spv::BuiltInMax; uint32_t vecsize = 0; @@ -837,7 +838,7 @@ protected: void mark_location_as_used_by_shader(uint32_t location, const SPIRType &type, spv::StorageClass storage, bool fallback = false); uint32_t ensure_correct_builtin_type(uint32_t type_id, spv::BuiltIn builtin); - uint32_t ensure_correct_input_type(uint32_t type_id, uint32_t location, + uint32_t ensure_correct_input_type(uint32_t type_id, uint32_t location, uint32_t component, uint32_t num_components, bool strip_array); void emit_custom_templates(); @@ -980,7 +981,7 @@ protected: Options msl_options; std::set<SPVFuncImpl> spv_function_implementations; // Must be ordered to ensure declarations are in a specific order. - std::map<uint32_t, MSLShaderInput> inputs_by_location; + std::map<LocationComponentPair, MSLShaderInput> inputs_by_location; std::unordered_map<uint32_t, MSLShaderInput> inputs_by_builtin; std::unordered_set<uint32_t> location_inputs_in_use; std::unordered_set<uint32_t> location_inputs_in_use_fallback; |