Add proj() intrinsic (XY / Z), fix bug with perspective matrix sampling

Previously, we'd declare a new temporary variable using the matrix
expression. For GrSkSLFP in particular, that would happen *before*
any other code had been emitted, so if the expression referred to
local variables, it would produce SkSL that used a not-yet-defined
variable, and not compile.

Change-Id: I1cdd8920b0c659b905809c126d10c01b996e6a55
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299778
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
3 files changed