remove misleading Uniforms apis

There's no really good reason to push uniforms in bulk
if there's no supported way to use them as an array.

Change-Id: Iaad133b96067fd570889ed1510705e4e98a351a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268646
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/src/core/SkColorFilter_Matrix.cpp b/src/core/SkColorFilter_Matrix.cpp
index 8d2c7df..cf4d61d 100644
--- a/src/core/SkColorFilter_Matrix.cpp
+++ b/src/core/SkColorFilter_Matrix.cpp
@@ -88,8 +88,7 @@
     if (fDomain == Domain::kRGBA) {
         p->unpremul(r,g,b,*a);
 
-        skvm::Builder::Uniform u = uniforms->pushF(fMatrix, 20);
-        auto m = [&](int i) { return p->uniformF(u.ptr, u.offset + 4*i); };
+        auto m = [&](int i) { return p->uniformF(uniforms->pushF(fMatrix[i])); };
 
         skvm::F32 rgba[4];
         for (int j = 0; j < 4; j++) {
diff --git a/src/core/SkVM.h b/src/core/SkVM.h
index 0503d1f..53ce6e5 100644
--- a/src/core/SkVM.h
+++ b/src/core/SkVM.h
@@ -575,29 +575,30 @@
 
     // Helper to streamline allocating and working with uniforms.
     struct Uniforms {
-        Arg              ptr;
+        Arg              base;
         std::vector<int> buf;
 
-        explicit Uniforms(int init) : ptr(Arg{0}), buf(init) {}
+        explicit Uniforms(int init) : base(Arg{0}), buf(init) {}
 
-        Builder::Uniform push(const int* vals, int n) {
-            int offset = sizeof(int)*buf.size();
-            buf.insert(buf.end(), vals, vals+n);
-            return {ptr, offset};
-        }
-        Builder::Uniform pushF(const float* vals, int n) {
-            return this->push((const int*)vals, n);
+        Builder::Uniform push(int val) {
+            buf.push_back(val);
+            return {base, (int)( sizeof(int)*(buf.size() - 1) )};
         }
 
-        Builder::Uniform push (int   val) { return this->push (&val, 1); }
-        Builder::Uniform pushF(float val) { return this->pushF(&val, 1); }
+        Builder::Uniform pushF(float val) {
+            int bits;
+            memcpy(&bits, &val, sizeof(int));
+            return this->push(bits);
+        }
 
         Builder::Uniform pushPtr(const void* ptr) {
-            union {
-                const void* ptr;
-                int   ints[sizeof(const void*) / sizeof(int)];
-            } pun = {ptr};
-            return this->push(pun.ints, SK_ARRAY_COUNT(pun.ints));
+            // Jam the pointer into 1 or 2 ints.
+            int ints[sizeof(ptr) / sizeof(int)];
+            memcpy(ints, &ptr, sizeof(ptr));
+            for (int bits : ints) {
+                buf.push_back(bits);
+            }
+            return {base, (int)( sizeof(int)*(buf.size() - SK_ARRAY_COUNT(ints)) )};
         }
     };
 
diff --git a/src/core/SkVMBlitter.cpp b/src/core/SkVMBlitter.cpp
index 3929ed2..3c2cfeb 100644
--- a/src/core/SkVMBlitter.cpp
+++ b/src/core/SkVMBlitter.cpp
@@ -120,9 +120,9 @@
                 const SkShaderBase* shader = as_SB(params.shader);
                 skvm::Builder p;
 
-                skvm::I32 dx = p.sub(p.uniform32(uniforms->ptr, offsetof(BlitterUniforms, right)),
+                skvm::I32 dx = p.sub(p.uniform32(uniforms->base, offsetof(BlitterUniforms, right)),
                                      p.index()),
-                          dy = p.uniform32(uniforms->ptr, offsetof(BlitterUniforms, y));
+                          dy = p.uniform32(uniforms->base, offsetof(BlitterUniforms, y));
                 skvm::F32 x = p.add(p.to_f32(dx), p.splat(0.5f)),
                           y = p.add(p.to_f32(dy), p.splat(0.5f));
 
@@ -167,7 +167,7 @@
 
         Builder(const Params& params, skvm::Uniforms* uniforms, SkArenaAlloc* alloc) {
             // First two arguments are always uniforms and the destination buffer.
-            uniforms->ptr     = uniform();
+            uniforms->base    = uniform();
             skvm::Arg dst_ptr = arg(SkColorTypeBytesPerPixel(params.colorType));
             // Other arguments depend on params.coverage:
             //    - Full:      (no more arguments)
@@ -176,9 +176,9 @@
             //    - MaskLCD16: 565 coverage varying
             //    - UniformA8: 8-bit coverage uniform
 
-            skvm::I32 dx = sub(uniform32(uniforms->ptr, offsetof(BlitterUniforms, right)),
+            skvm::I32 dx = sub(uniform32(uniforms->base, offsetof(BlitterUniforms, right)),
                                index()),
-                      dy = uniform32(uniforms->ptr, offsetof(BlitterUniforms, y));
+                      dy = uniform32(uniforms->base, offsetof(BlitterUniforms, y));
             skvm::F32 x = add(to_f32(dx), splat(0.5f)),
                       y = add(to_f32(dy), splat(0.5f));