Adding attribute types to SkVertices

Adds structure to the per-vertex (now custom) data.
Attributes currently just have a type, but the next
step is to augment that with semantic flags to handle
transformation logic in the vertex shader.

Added unit tests and GMs that exercise attributes of
varying float counts, as well as normalized bytes.

Bug: skia:9984
Change-Id: I02402d40b66a6e15b39f71125004efb98bc06295
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280338
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 4a94695..31dfff1 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1992,9 +1992,17 @@
     // If the vertices contain custom attributes, ensure they line up with the paint's shader
     const SkRuntimeEffect* effect =
             paint.getShader() ? as_SB(paint.getShader())->asRuntimeEffect() : nullptr;
-    if (vertices->priv().perVertexDataCount() != (effect ? effect->varyingCount() : 0)) {
+    if ((size_t)vertices->priv().attributeCount() != (effect ? effect->varyings().count() : 0)) {
         return;
     }
+    if (effect) {
+        int attrIndex = 0;
+        for (const auto& v : effect->varyings()) {
+            if (vertices->priv().attributes()[attrIndex++].channelCount() != v.fWidth) {
+                return;
+            }
+        }
+    }
 
     this->onDrawVerticesObject(vertices, mode, paint);
 }