Reduce usage of GrProgramDesc::KeyHeader

Ideally the GrProgramDesc would be a simple program key. We currently can't remove usage of the KeyHeader for "hasPointSize" but this, at least, removes the other uses.

Bug: skia:9455
Change-Id: Ie9e15997ee79c6ffe62b5cd2c96885ca06204383
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247597
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrProgramDesc.h b/src/gpu/GrProgramDesc.h
index 25a7895..391bfe1 100644
--- a/src/gpu/GrProgramDesc.h
+++ b/src/gpu/GrProgramDesc.h
@@ -25,18 +25,20 @@
     GrProgramDesc() {}
 
     /**
-    * Builds a program descriptor. Before the descriptor can be used, the client must call finalize
-    * on the filled in GrProgramDesc.
-    *
-    * @param desc          The built and finalized descriptor
-    * @param renderTarget  The target of the draw
-    * @param programInfo   Program information need to build the key
-    * @param primitiveType Controls whether the shader will output a point size.
-    * @param gpu           Pointer to the GrGpu object the program will be used with.
-    **/
+     * Builds a program descriptor. Before the descriptor can be used, the client must call finalize
+     * on the filled in GrProgramDesc.
+     *
+     * @param desc          The built and finalized descriptor
+     * @param renderTarget  The target of the draw
+     * @param programInfo   Program information need to build the key
+     * @param primitiveType Controls whether the shader will output a point size.
+     * @param gpu           Pointer to the GrGpu object the program will be used with.
+     **/
     static bool Build(GrProgramDesc*, const GrRenderTarget*, const GrProgramInfo&,
                       GrPrimitiveType, GrGpu*);
 
+    // This is strictly an OpenGL call since the other backends have additional data in their
+    // keys
     static bool BuildFromData(GrProgramDesc* desc, const void* keyData, size_t keyLength) {
         if (!SkTFitsIn<int>(keyLength)) {
             return false;
@@ -85,10 +87,12 @@
         return !(*this == other);
     }
 
-    struct KeyHeader {
-        bool hasPointSize() const { return fHasPointSize; }
+    // TODO: remove this use of the header
+    bool hasPointSize() const { return this->header().fHasPointSize; }
 
-        // Set to uniquely idenitify any swizzling of the shader's output color(s).
+protected:
+    struct KeyHeader {
+        // Set to uniquely identify any swizzling of the shader's output color(s).
         uint16_t fOutputSwizzle;
         uint8_t fColorFragmentProcessorCnt; // Can be packed into 4 bits if required.
         uint8_t fCoverageFragmentProcessorCnt;
@@ -101,10 +105,8 @@
     };
     GR_STATIC_ASSERT(sizeof(KeyHeader) == 6);
 
-    // This should really only be used internally, base classes should return their own headers
     const KeyHeader& header() const { return *this->atOffset<KeyHeader, kHeaderOffset>(); }
 
-protected:
     template<typename T, size_t OFFSET> T* atOffset() {
         return reinterpret_cast<T*>(reinterpret_cast<intptr_t>(fKey.begin()) + OFFSET);
     }