Metal: Fix ToposortStructs validation == failures ToposortStructs would convert mat, vec, struct == to ANGLE_equals() calls. However, the functions called were not in AST. This would cause "Found node calling previously undeclared function <validateFunctionCall>" validation error and ASSERT. Mat, vec equality calls would use prelude ANGLE_equals implementations. The MSL emit already does the conversion from == to ANGLE_equals for these builtins. For user-defined structs the logic would be: - collect struct decls, structs, create equality functions - toposort - for each sorted struct: - insert struct decl - insert equality function Move the equality function creation after the toposort: - collect struct decls, structs - toposort - for each sorted struct: - insert struct decl - create equality function - insert equality function This way the sort ensures that nested struct equality functions can refer to previously introduced equality functions. Bug: angleproject:375352601 Change-Id: I59efed98bca6d99b198abc2b5c7577cf5d1d5d83 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5961281 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>