added PLS support to SkSL

Bug: skia:
Change-Id: I77fb0861c8cba0f86e3d0521d2ad77e204487d21
Reviewed-on: https://skia-review.googlesource.com/c/99921
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp
index c231626..751947a 100644
--- a/src/sksl/SkSLGLSLCodeGenerator.cpp
+++ b/src/sksl/SkSLGLSLCodeGenerator.cpp
@@ -1112,6 +1112,15 @@
     if (modifiers.fFlags & Modifiers::kConst_Flag) {
         this->write("const ");
     }
+    if (modifiers.fFlags & Modifiers::kPLS_Flag) {
+        this->write("__pixel_localEXT ");
+    }
+    if (modifiers.fFlags & Modifiers::kPLSIn_Flag) {
+        this->write("__pixel_local_inEXT ");
+    }
+    if (modifiers.fFlags & Modifiers::kPLSOut_Flag) {
+        this->write("__pixel_local_outEXT ");
+    }
     if (usesPrecisionModifiers()) {
         if (modifiers.fFlags & Modifiers::kLowp_Flag) {
             this->write("lowp ");
@@ -1460,7 +1469,8 @@
                     this->writeVarDeclarations(decl, true);
                     this->writeLine();
                 } else if (builtin == SK_FRAGCOLOR_BUILTIN &&
-                           fProgram.fSettings.fCaps->mustDeclareFragmentShaderOutput()) {
+                           fProgram.fSettings.fCaps->mustDeclareFragmentShaderOutput() &&
+                           ((VarDeclaration&) *decl.fVars[0]).fVar->fWriteCount) {
                     if (fProgram.fSettings.fFragColorIsInOut) {
                         this->write("inout ");
                     } else {