Loosen ES3 restrictions in Runtime Effects for debugging.

This CL adds a RuntimeEffect option flag which skips over the various
`strictES2Mode` checks sprinkled throughout IR generation.

Runtime Effects still won't allow a lot of ES3 things (the Pipeline
stage will reject unsupported statement types, SkVM doesn't support most
non-ES2 constructs, etc). However, this change will give us the ability
to test many more features involving arrays and structs that previously
were off-limits due to ES2 restrictions, and will shore up some
legitimate gaps in our testing. This is a useful starting point to allow
for improved test coverage.

Change-Id: I4a5bc43914e65fc7e59f1cecb76a0ec5a7f05f2f
Bug: skia:11209
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402157
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/tests/SkRuntimeEffectTest.cpp b/tests/SkRuntimeEffectTest.cpp
index 77f66b7..a6ba883 100644
--- a/tests/SkRuntimeEffectTest.cpp
+++ b/tests/SkRuntimeEffectTest.cpp
@@ -75,11 +75,23 @@
             "unknown identifier 'sk_Caps'");
 }
 
+DEF_TEST(SkRuntimeEffectCanDisableES2Restrictions, r) {
+    auto test_valid_es3 = [](skiatest::Reporter* r, const char* sksl) {
+        SkRuntimeEffect::Options opt;
+        opt.enforceES2Restrictions = false;
+        auto [effect, errorText] = SkRuntimeEffect::MakeForShader(SkString(sksl), opt);
+        REPORTER_ASSERT(r, effect, "%s", errorText.c_str());
+    };
+
+    test_invalid_effect(r, "float f[2] = float[2](0, 1);" EMPTY_MAIN, "construction of array type");
+    test_valid_es3     (r, "float f[2] = float[2](0, 1);" EMPTY_MAIN);
+}
+
 DEF_TEST(SkRuntimeEffectForColorFilter, r) {
     // Tests that the color filter factory rejects or accepts certain SkSL constructs
     auto test_valid = [r](const char* sksl) {
         auto [effect, errorText] = SkRuntimeEffect::MakeForColorFilter(SkString(sksl));
-        REPORTER_ASSERT(r, effect, errorText.c_str());
+        REPORTER_ASSERT(r, effect, "%s", errorText.c_str());
     };
 
     auto test_invalid = [r](const char* sksl, const char* expected) {
@@ -131,7 +143,7 @@
     // Tests that the shader factory rejects or accepts certain SkSL constructs
     auto test_valid = [r](const char* sksl) {
         auto [effect, errorText] = SkRuntimeEffect::MakeForShader(SkString(sksl));
-        REPORTER_ASSERT(r, effect, errorText.c_str());
+        REPORTER_ASSERT(r, effect, "%s", errorText.c_str());
     };
 
     auto test_invalid = [r](const char* sksl, const char* expected) {