Add FunctionDefinition::Convert for creating function definitions.

A few nice properties fall out of this:
- IntrinsicSets become an implementation detail that most code never has
  to think about.
- The dehydrated data is marginally smaller because it no longer needs
  to store the IntrinsicSet array; it's re-derived when the
  FunctionDefinition is created via Convert.

finalizeFunction is largely unnecessary now, but it still had one
lingering use; it appends the sk_Position fixup to the end of main()
when compiling a vertex program. Added appendRTAdjustFixupToVertexMain
to IRGenerator to handle this case. This could be done in Convert as
well if the RTAdjust fields weren't buried inside of the IRGenerator.

Change-Id: I7451ea9c64112a376ad36902d36c29a9cf147504
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442817
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLRehydrator.cpp b/src/sksl/SkSLRehydrator.cpp
index 35ba922..101dd8a 100644
--- a/src/sksl/SkSLRehydrator.cpp
+++ b/src/sksl/SkSLRehydrator.cpp
@@ -275,15 +275,8 @@
             const FunctionDeclaration* decl = this->symbolRef<FunctionDeclaration>(
                                                                 Symbol::Kind::kFunctionDeclaration);
             std::unique_ptr<Statement> body = this->statement();
-            IntrinsicSet refs;
-            uint8_t refCount = this->readU8();
-            for (int i = 0; i < refCount; ++i) {
-                refs.insert(this->symbolRef<FunctionDeclaration>(
-                                                               Symbol::Kind::kFunctionDeclaration));
-            }
-            auto result = std::make_unique<FunctionDefinition>(/*offset=*/-1, decl,
-                                                               /*builtin=*/true, std::move(body),
-                                                               std::move(refs));
+            auto result = FunctionDefinition::Convert(fContext, /*offset=*/-1, *decl,
+                                                      std::move(body), /*builtin=*/true);
             decl->setDefinition(result.get());
             return std::move(result);
         }