Allow GenerateGlueCodeForEntry to emit code above main().

Previously, glue-code helpers only allowed appending into `main` and
there was no mechanism to insert code elsewhere. Now, glue-code emitter
functions take two strings, `preamble` and `mainBody`, and can write
into either one as desired. When generation is complete, `preamble` will
be inserted directly above `mainBody`.

This will allow us to insert standalone functions, global variables,
prototypes, etc. into the finished shader code.

Change-Id: I17b545cd326605ddf032f6dadd6164bb9c9b2c69
Bug: skia:13443
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550705
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2 files changed