[Impeller] sort all vertex inputs by location. (flutter/engine#42664)

Fixes https://github.com/flutter/flutter/issues/128283

Why doesn't this happen elsewhere? might depend on how spirv compiles shaders or the order they run in. Long term fix is https://github.com/flutter/engine/pull/42628 which computes all offset data in the compiler

![flutter_04](https://github.com/flutter/engine/assets/8975114/645c5db6-4f2f-42f7-af8f-6230bba72b2b)
This commit is contained in:
Jonah Williams
2023-06-08 10:23:52 -07:00
committed by GitHub
parent 108840bd57
commit e448fff0da

View File

@@ -17,6 +17,14 @@ bool VertexDescriptor::SetStageInputs(
for (size_t i = 0; i < count; i++) {
inputs_.emplace_back(*stage_inputs[i]);
}
// TODO(jonahwilliams): vulkan shader stage needed sorting too. Remove once
// autogenerated headers include offset information.
// See: https://github.com/flutter/flutter/issues/116168
auto compare_locations = [](ShaderStageIOSlot a, ShaderStageIOSlot b) {
return a.location < b.location;
};
std::sort(inputs_.begin(), inputs_.end(), compare_locations);
return true;
}