| Index: src/sksl/SkSLCompiler.cpp
|
| diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp
|
| index 0d65b107ecf28bc587bf03e1b9ee332eeb3bac1d..b6e5fa4df55dc340de701a24ad9c36a20903ed1e 100644
|
| --- a/src/sksl/SkSLCompiler.cpp
|
| +++ b/src/sksl/SkSLCompiler.cpp
|
| @@ -223,8 +223,7 @@ void Compiler::writeErrorCount() {
|
| }
|
| }
|
|
|
| -#include <fstream>
|
| -bool Compiler::toSPIRV(Program::Kind kind, std::string text, std::ostream& out) {
|
| +bool Compiler::toSPIRV(Program::Kind kind, const std::string& text, std::ostream& out) {
|
| auto program = this->convertProgram(kind, text);
|
| if (fErrorCount == 0) {
|
| SkSL::SPIRVCodeGenerator cg(&fContext);
|
| @@ -234,13 +233,34 @@ bool Compiler::toSPIRV(Program::Kind kind, std::string text, std::ostream& out)
|
| return fErrorCount == 0;
|
| }
|
|
|
| -bool Compiler::toSPIRV(Program::Kind kind, std::string text, std::string* out) {
|
| +bool Compiler::toSPIRV(Program::Kind kind, const std::string& text, std::string* out) {
|
| std::stringstream buffer;
|
| bool result = this->toSPIRV(kind, text, buffer);
|
| if (result) {
|
| *out = buffer.str();
|
| }
|
| + return result;
|
| +}
|
| +
|
| +bool Compiler::toGLSL(Program::Kind kind, const std::string& text, GLCaps caps,
|
| + std::ostream& out) {
|
| + auto program = this->convertProgram(kind, text);
|
| + if (fErrorCount == 0) {
|
| + SkSL::GLSLCodeGenerator cg(&fContext, caps);
|
| + cg.generateCode(*program.get(), out);
|
| + ASSERT(!out.rdstate());
|
| + }
|
| return fErrorCount == 0;
|
| }
|
|
|
| +bool Compiler::toGLSL(Program::Kind kind, const std::string& text, GLCaps caps,
|
| + std::string* out) {
|
| + std::stringstream buffer;
|
| + bool result = this->toGLSL(kind, text, caps, buffer);
|
| + if (result) {
|
| + *out = buffer.str();
|
| + }
|
| + return result;
|
| +}
|
| +
|
| } // namespace
|
|
|