Add setXi and setXiv in GrGLSLProgramDataManager.

Previously, X = 1; this CL adds X = [2, 3, 4] to match the equivalent
vector support for floats.

It currently does not define any methods for setting unsigned integers
or for setting explicitly lower bit count integers.

Bug: skia:
Change-Id: Iaa1e9a6b979208a8c30b07b8ccb0792b3dd64c97
Reviewed-on: https://skia-review.googlesource.com/150261
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/vk/GrVkPipelineStateDataManager.cpp b/src/gpu/vk/GrVkPipelineStateDataManager.cpp
index d236b5b..71f2c98 100644
--- a/src/gpu/vk/GrVkPipelineStateDataManager.cpp
+++ b/src/gpu/vk/GrVkPipelineStateDataManager.cpp
@@ -110,6 +110,33 @@
     }
 }
 
+void GrVkPipelineStateDataManager::set2i(UniformHandle u, int32_t i0, int32_t i1) const {
+    const Uniform& uni = fUniforms[u.toIndex()];
+    SkASSERT(uni.fType == kInt2_GrSLType || uni.fType == kShort2_GrSLType);
+    SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount);
+    void* buffer = this->getBufferPtrAndMarkDirty(uni);
+    int32_t v[2] = { i0, i1 };
+    memcpy(buffer, v, 2 * sizeof(int32_t));
+}
+
+void GrVkPipelineStateDataManager::set2iv(UniformHandle u,
+                                          int arrayCount,
+                                          const int32_t v[]) const {
+    const Uniform& uni = fUniforms[u.toIndex()];
+    SkASSERT(uni.fType == kInt2_GrSLType || uni.fType == kShort2_GrSLType);
+    SkASSERT(arrayCount > 0);
+    SkASSERT(arrayCount <= uni.fArrayCount ||
+             (1 == arrayCount && GrShaderVar::kNonArray == uni.fArrayCount));
+
+    void* buffer = this->getBufferPtrAndMarkDirty(uni);
+    SkASSERT(sizeof(int32_t) == 4);
+    for (int i = 0; i < arrayCount; ++i) {
+        const int32_t* curVec = &v[2 * i];
+        memcpy(buffer, curVec, 2 * sizeof(int32_t));
+        buffer = static_cast<char*>(buffer) + 4*sizeof(int32_t);
+    }
+}
+
 void GrVkPipelineStateDataManager::set2f(UniformHandle u, float v0, float v1) const {
     const Uniform& uni = fUniforms[u.toIndex()];
     SkASSERT(uni.fType == kFloat2_GrSLType || uni.fType == kHalf2_GrSLType);
@@ -138,6 +165,36 @@
     }
 }
 
+void GrVkPipelineStateDataManager::set3i(UniformHandle u,
+                                         int32_t i0,
+                                         int32_t i1,
+                                         int32_t i2) const {
+    const Uniform& uni = fUniforms[u.toIndex()];
+    SkASSERT(uni.fType == kInt3_GrSLType || uni.fType == kShort3_GrSLType);
+    SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount);
+    void* buffer = this->getBufferPtrAndMarkDirty(uni);
+    int32_t v[3] = { i0, i1, i2 };
+    memcpy(buffer, v, 3 * sizeof(int32_t));
+}
+
+void GrVkPipelineStateDataManager::set3iv(UniformHandle u,
+                                          int arrayCount,
+                                          const int32_t v[]) const {
+    const Uniform& uni = fUniforms[u.toIndex()];
+    SkASSERT(uni.fType == kInt3_GrSLType || uni.fType == kShort3_GrSLType);
+    SkASSERT(arrayCount > 0);
+    SkASSERT(arrayCount <= uni.fArrayCount ||
+             (1 == arrayCount && GrShaderVar::kNonArray == uni.fArrayCount));
+
+    void* buffer = this->getBufferPtrAndMarkDirty(uni);
+    SkASSERT(sizeof(int32_t) == 4);
+    for (int i = 0; i < arrayCount; ++i) {
+        const int32_t* curVec = &v[3 * i];
+        memcpy(buffer, curVec, 3 * sizeof(int32_t));
+        buffer = static_cast<char*>(buffer) + 4*sizeof(int32_t);
+    }
+}
+
 void GrVkPipelineStateDataManager::set3f(UniformHandle u, float v0, float v1, float v2) const {
     const Uniform& uni = fUniforms[u.toIndex()];
     SkASSERT(uni.fType == kFloat3_GrSLType || uni.fType == kHalf3_GrSLType);
@@ -166,6 +223,37 @@
     }
 }
 
+void GrVkPipelineStateDataManager::set4i(UniformHandle u,
+                                         int32_t i0,
+                                         int32_t i1,
+                                         int32_t i2,
+                                         int32_t i3) const {
+    const Uniform& uni = fUniforms[u.toIndex()];
+    SkASSERT(uni.fType == kInt4_GrSLType || uni.fType == kShort4_GrSLType);
+    SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount);
+    void* buffer = this->getBufferPtrAndMarkDirty(uni);
+    int32_t v[4] = { i0, i1, i2, i3 };
+    memcpy(buffer, v, 4 * sizeof(int32_t));
+}
+
+void GrVkPipelineStateDataManager::set4iv(UniformHandle u,
+                                          int arrayCount,
+                                          const int32_t v[]) const {
+    const Uniform& uni = fUniforms[u.toIndex()];
+    SkASSERT(uni.fType == kInt4_GrSLType || uni.fType == kShort4_GrSLType);
+    SkASSERT(arrayCount > 0);
+    SkASSERT(arrayCount <= uni.fArrayCount ||
+             (1 == arrayCount && GrShaderVar::kNonArray == uni.fArrayCount));
+
+    void* buffer = this->getBufferPtrAndMarkDirty(uni);
+    SkASSERT(sizeof(int32_t) == 4);
+    for (int i = 0; i < arrayCount; ++i) {
+        const int32_t* curVec = &v[4 * i];
+        memcpy(buffer, curVec, 4 * sizeof(int32_t));
+        buffer = static_cast<char*>(buffer) + 4*sizeof(int32_t);
+    }
+}
+
 void GrVkPipelineStateDataManager::set4f(UniformHandle u,
                                          float v0,
                                          float v1,