Add a few more SkRuntimeEffect unit tests

Validating that only certain types are allowed as in or uniform.

Change-Id: I941da448bffec06158e67fbf653833846d9fe3db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262222
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/core/SkRuntimeEffect.cpp b/src/core/SkRuntimeEffect.cpp
index 5d3e329..7da10c3 100644
--- a/src/core/SkRuntimeEffect.cpp
+++ b/src/core/SkRuntimeEffect.cpp
@@ -120,6 +120,32 @@
 
 #undef SET_TYPES
 
+                        switch (v.fType) {
+                            case Variable::Type::kBool:
+                            case Variable::Type::kInt:
+                                if (v.fQualifier == Variable::Qualifier::kUniform) {
+                                    RETURN_FAILURE("'uniform' variables may not have '%s' type",
+                                                   type->displayName().c_str());
+                                }
+                                break;
+
+                            case Variable::Type::kFloat:
+                                // Floats can be 'in' or 'uniform'
+                                break;
+
+                            case Variable::Type::kFloat2:
+                            case Variable::Type::kFloat3:
+                            case Variable::Type::kFloat4:
+                            case Variable::Type::kFloat2x2:
+                            case Variable::Type::kFloat3x3:
+                            case Variable::Type::kFloat4x4:
+                                if (v.fQualifier == Variable::Qualifier::kIn) {
+                                    RETURN_FAILURE("'in' variables may not have '%s' type",
+                                                   type->displayName().c_str());
+                                }
+                                break;
+                        }
+
                         if (v.fType != Variable::Type::kBool) {
                             offset = SkAlign4(offset);
                         }
diff --git a/tests/SkRuntimeEffectTest.cpp b/tests/SkRuntimeEffectTest.cpp
index ad2fa7a..45ba89a 100644
--- a/tests/SkRuntimeEffectTest.cpp
+++ b/tests/SkRuntimeEffectTest.cpp
@@ -31,4 +31,14 @@
 
     // 'in' variables can't be arrays
     test("in int Input[2];", "array");
+
+    // Type specific restrictions:
+
+    // 'bool', 'int' can't be 'uniform'
+    test("uniform bool Input;", "'uniform'");
+    test("uniform int Input;", "'uniform'");
+
+    // vector and matrix types can't be 'in'
+    test("in float2 Input;", "'in'");
+    test("in half3x3 Input;", "'in'");
 }