Reland "Add SkSLCompiler::toHLSL, using SPIRV-Cross"

This reverts commit e3f57a4e62d9f447033dcc535e78c18cfd72b9d6.

Change-Id: I03293dbee19ef5c9802fc35de8438a87f627cf96
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272056
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp
index de8b735..92c0c03 100644
--- a/src/sksl/SkSLCompiler.cpp
+++ b/src/sksl/SkSLCompiler.cpp
@@ -16,6 +16,7 @@
 #include "src/sksl/SkSLMetalCodeGenerator.h"
 #include "src/sksl/SkSLPipelineStageCodeGenerator.h"
 #include "src/sksl/SkSLSPIRVCodeGenerator.h"
+#include "src/sksl/SkSLSPIRVtoHLSL.h"
 #include "src/sksl/ir/SkSLEnum.h"
 #include "src/sksl/ir/SkSLExpression.h"
 #include "src/sksl/ir/SkSLExpressionStatement.h"
@@ -1562,6 +1563,15 @@
     return result;
 }
 
+bool Compiler::toHLSL(Program& program, String* out) {
+    String spirv;
+    if (!this->toSPIRV(program, &spirv)) {
+        return false;
+    }
+
+    return SPIRVtoHLSL(spirv, out);
+}
+
 bool Compiler::toMetal(Program& program, OutputStream& out) {
     if (!this->optimize(program)) {
         return false;