SPIRV: Track function signatures by SpvId(s), rather than display name

It's possible for two types that look distinct (float4 vs half4) to
resolve to the same type ID in the SPIRV. If two function signatures
differ only in that way ("half4 foo(half4)" vs. "half4 bar(float4)"),
we'd end up generating two identical function type declarations, which
is a validation error.

Instead, key the declarations that we've already emitted by resolved
SPIRV Id, so we notice that those functions can share a single type
declaration.

Change-Id: Iea27101612f8990b3750424ca265ba04306f1f25
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279217
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp
index dede8a5..f0e14ec 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.cpp
+++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp
@@ -580,12 +580,12 @@
 }
 
 SpvId SPIRVCodeGenerator::getFunctionType(const FunctionDeclaration& function) {
-    String key = function.fReturnType.displayName() + "(";
+    String key = to_string(this->getType(function.fReturnType)) + "(";
     String separator;
     for (size_t i = 0; i < function.fParameters.size(); i++) {
         key += separator;
         separator = ", ";
-        key += function.fParameters[i]->fType.displayName();
+        key += to_string(this->getType(function.fParameters[i]->fType));
     }
     key += ")";
     auto entry = fTypeMap.find(key);