Add `ivec` GLSL type aliases to runtime effects

Also add unit test of all GLSL type aliases.

Bug: skia:10679
Change-Id: I93e21621c11adfe3f114d0c55fb8043518e62696
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395718
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/gn/sksl_tests.gni b/gn/sksl_tests.gni
index d01f404..e23755c 100644
--- a/gn/sksl_tests.gni
+++ b/gn/sksl_tests.gni
@@ -558,6 +558,7 @@
   "/sksl/runtime/ArrayIndexing.rte",
   "/sksl/runtime/ConstPreservation.rte",
   "/sksl/runtime/ConversionConstructors.rte",
+  "/sksl/runtime/GLSLTypeNames.rte",
   "/sksl/runtime/GlobalVariables.rte",
   "/sksl/runtime/LoopInt.rte",
   "/sksl/runtime/LoopFloat.rte",
diff --git a/resources/sksl/runtime/GLSLTypeNames.rte b/resources/sksl/runtime/GLSLTypeNames.rte
new file mode 100644
index 0000000..24a99b0
--- /dev/null
+++ b/resources/sksl/runtime/GLSLTypeNames.rte
@@ -0,0 +1,14 @@
+// Ensure that GLSL type aliases compile without error
+uniform float f;
+uniform int i;
+uniform bool b;
+
+vec4 main(vec2 coords) {
+    vec4  fv =  vec4( vec3( vec2(f), f), f);
+    ivec4 iv = ivec4(ivec3(ivec2(i), i), i);
+    bvec4 bv = bvec4(bvec3(bvec2(b), b), b);
+
+    mat4 m = mat4(mat3(mat2(f)));
+
+    return fv;
+}
diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp
index 952555b..faed9d2 100644
--- a/src/sksl/SkSLCompiler.cpp
+++ b/src/sksl/SkSLCompiler.cpp
@@ -251,6 +251,10 @@
         fRuntimeEffectModule.fSymbols->addAlias("vec3", fContext->fTypes.fFloat3.get());
         fRuntimeEffectModule.fSymbols->addAlias("vec4", fContext->fTypes.fFloat4.get());
 
+        fRuntimeEffectModule.fSymbols->addAlias("ivec2", fContext->fTypes.fInt2.get());
+        fRuntimeEffectModule.fSymbols->addAlias("ivec3", fContext->fTypes.fInt3.get());
+        fRuntimeEffectModule.fSymbols->addAlias("ivec4", fContext->fTypes.fInt4.get());
+
         fRuntimeEffectModule.fSymbols->addAlias("bvec2", fContext->fTypes.fBool2.get());
         fRuntimeEffectModule.fSymbols->addAlias("bvec3", fContext->fTypes.fBool3.get());
         fRuntimeEffectModule.fSymbols->addAlias("bvec4", fContext->fTypes.fBool4.get());
diff --git a/tests/SkRuntimeEffectTest.cpp b/tests/SkRuntimeEffectTest.cpp
index 5305ba7..0326ece 100644
--- a/tests/SkRuntimeEffectTest.cpp
+++ b/tests/SkRuntimeEffectTest.cpp
@@ -226,10 +226,6 @@
     effect.build("half4 main(float2 p) { return float4(p - 0.5, 0, 1); }");
     effect.test(0xFF000000, 0xFF0000FF, 0xFF00FF00, 0xFF00FFFF);
 
-    // ... and support GLSL type names
-    effect.build("half4 main(float2 p) { return vec4(p - 0.5, 0, 1); }");
-    effect.test(0xFF000000, 0xFF0000FF, 0xFF00FF00, 0xFF00FFFF);
-
     // ... and support *returning* float4 (aka vec4), not just half4
     effect.build("float4 main(float2 p) { return float4(p - 0.5, 0, 1); }");
     effect.test(0xFF000000, 0xFF0000FF, 0xFF00FF00, 0xFF00FFFF);
diff --git a/tests/sksl/runtime/GLSLTypeNames.skvm b/tests/sksl/runtime/GLSLTypeNames.skvm
new file mode 100644
index 0000000..177be22
--- /dev/null
+++ b/tests/sksl/runtime/GLSLTypeNames.skvm
@@ -0,0 +1,7 @@
+1 registers, 5 instructions:
+0	r0 = uniform32 ptr0 4
+loop:
+1	    store32 ptr1 r0
+2	    store32 ptr2 r0
+3	    store32 ptr3 r0
+4	    store32 ptr4 r0
diff --git a/tests/sksl/runtime/GLSLTypeNames.stage b/tests/sksl/runtime/GLSLTypeNames.stage
new file mode 100644
index 0000000..9bd7788
--- /dev/null
+++ b/tests/sksl/runtime/GLSLTypeNames.stage
@@ -0,0 +1,11 @@
+uniform float f;
+uniform int i;
+uniform bool b;
+float4 main(float2 coords)
+{
+	float4 fv = float4(float2(f), f, f);
+	;
+	;
+	;
+	return half4(fv);
+}