Revive SkSLFPTestbed for basic verification of CPP/H codegen.

This brings back the basics from SkSLFPTest.cpp. This file was removed
entirely in http://review.skia.org/319029 but, in retrospect, it's still
a good idea for dm to verify that CPPCodeGen and HCodeGen can do their
jobs. And, like SkSLGLSLTestbed, this gives us a good place to attach
the debugger in dm for testing CPP/H-specific code generation bugs.

Change-Id: I514192bacd63021708dbd02a0276a3d55a43195f
Bug: skia:10684
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329370
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/gn/tests.gni b/gn/tests.gni
index c5201f5..187601d 100644
--- a/gn/tests.gni
+++ b/gn/tests.gni
@@ -264,6 +264,7 @@
   "$_tests/SkResourceCacheTest.cpp",
   "$_tests/SkRuntimeEffectTest.cpp",
   "$_tests/SkSLCross.cpp",
+  "$_tests/SkSLFPTestbed.cpp",
   "$_tests/SkSLGLSLTestbed.cpp",
   "$_tests/SkSLInterpreterTest.cpp",
   "$_tests/SkSLMemoryLayoutTest.cpp",
diff --git a/tests/SkSLFPTestbed.cpp b/tests/SkSLFPTestbed.cpp
new file mode 100644
index 0000000..ffbe39b
--- /dev/null
+++ b/tests/SkSLFPTestbed.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2020 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/sksl/SkSLCompiler.h"
+#include "src/sksl/SkSLStringStream.h"
+
+#include "tests/Test.h"
+
+static void test(skiatest::Reporter* r, const GrShaderCaps& caps, const char* src) {
+    SkSL::Program::Settings settings;
+    settings.fCaps = &caps;
+    settings.fRemoveDeadFunctions = false;
+    SkSL::Compiler compiler;
+    SkSL::StringStream output;
+    std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
+                                                             SkSL::Program::kFragmentProcessor_Kind,
+                                                             SkSL::String(src),
+                                                             settings);
+    if (!program) {
+        SkDebugf("Unexpected error compiling %s\n%s", src, compiler.errorText().c_str());
+        return;
+    }
+    REPORTER_ASSERT(r, program);
+    bool success = compiler.toH(*program, "Test", output);
+    if (!success) {
+        SkDebugf("Unexpected error generating .h file for %s\n%s",
+                 src, compiler.errorText().c_str());
+    }
+    REPORTER_ASSERT(r, success);
+    output.reset();
+    success = compiler.toCPP(*program, "Test", output);
+    if (!success) {
+        SkDebugf("Unexpected error generating .cpp file for %s\n%s",
+                 src, compiler.errorText().c_str());
+    }
+    REPORTER_ASSERT(r, success);
+}
+
+DEF_TEST(SkSLFPTestbed, r) {
+    test(r,
+         *SkSL::ShaderCapsFactory::Default(),
+         R"__SkSL__(
+             void main(float2 coord) {
+                 sk_OutColor = half4(0);
+             }
+         )__SkSL__");
+}