diff options
author | Mike Klein <mtklein@google.com> | 2017-06-27 22:52:03 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-06-27 22:52:10 +0000 |
commit | 5ce397205528f82084fc650c2ce27d246c01da33 (patch) | |
tree | 3e359ae172fed10fce8204163d6d372b0c3f6207 /src/sksl/SkSLCompiler.cpp | |
parent | 3fe44544c93759e7791ee0df3e5d172cb0f268b6 (diff) |
Revert "Re-land sksl fragment processor support"
This reverts commit c070939fd1a954b7a492bc30f0cf64a664b90181.
Reason for revert:
This has some knock-on effects in the generation of Android.bp from our GN files. See gn/gn_to_bp.py? We're seeing things like "tmp/tmpsBVycx/gen/" end up in the include search path in Android.bp, which obviously don't exist there...
Original change's description:
> Re-land sksl fragment processor support
>
> This reverts commit ed50200682e0de72c3abecaa4d5324ebcd1ed9f9.
>
> Bug: skia:
> Change-Id: I9caa7454b391450620d6989dc472abb3cf7a2cab
> Reviewed-on: https://skia-review.googlesource.com/20965
> Reviewed-by: Ben Wagner <benjaminwagner@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
TBR=benjaminwagner@google.com,ethannicholas@google.com
Change-Id: I502486b5405923b322429219f4cc396a45a14cea
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/20990
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Diffstat (limited to 'src/sksl/SkSLCompiler.cpp')
-rw-r--r-- | src/sksl/SkSLCompiler.cpp | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp index 593397bd2a..39ac31532e 100644 --- a/src/sksl/SkSLCompiler.cpp +++ b/src/sksl/SkSLCompiler.cpp @@ -8,9 +8,7 @@ #include "SkSLCompiler.h" #include "SkSLCFGGenerator.h" -#include "SkSLCPPCodeGenerator.h" #include "SkSLGLSLCodeGenerator.h" -#include "SkSLHCodeGenerator.h" #include "SkSLIRGenerator.h" #include "SkSLSPIRVCodeGenerator.h" #include "ir/SkSLExpression.h" @@ -47,11 +45,6 @@ static const char* SKSL_GEOM_INCLUDE = #include "sksl_geom.include" ; -static const char* SKSL_FP_INCLUDE = -#include "sksl_fp.include" -; - - namespace SkSL { Compiler::Compiler() @@ -153,18 +146,12 @@ Compiler::Compiler() ADD_TYPE(SamplerCubeArrayShadow); ADD_TYPE(GSampler2DArrayShadow); ADD_TYPE(GSamplerCubeArrayShadow); - ADD_TYPE(ColorSpaceXform); String skCapsName("sk_Caps"); Variable* skCaps = new Variable(Position(), Modifiers(), skCapsName, *fContext.fSkCaps_Type, Variable::kGlobal_Storage); fIRGenerator->fSymbolTable->add(skCapsName, std::unique_ptr<Symbol>(skCaps)); - String skArgsName("sk_Args"); - Variable* skArgs = new Variable(Position(), Modifiers(), skArgsName, - *fContext.fSkArgs_Type, Variable::kGlobal_Storage); - fIRGenerator->fSymbolTable->add(skArgsName, std::unique_ptr<Symbol>(skArgs)); - Modifiers::Flag ignored1; std::vector<std::unique_ptr<ProgramElement>> ignored2; fIRGenerator->convertProgram(String(SKSL_INCLUDE), *fTypes, &ignored1, &ignored2); @@ -791,6 +778,7 @@ void Compiler::simplifyExpression(DefinitionMap& definitions, } } + // returns true if this statement could potentially execute a break at the current level (we ignore // nested loops and switches, since any breaks inside of them will merely break the loop / switch) static bool contains_break(Statement& s) { @@ -1109,9 +1097,6 @@ std::unique_ptr<Program> Compiler::convertProgram(Program::Kind kind, String tex case Program::kGeometry_Kind: fIRGenerator->convertProgram(String(SKSL_GEOM_INCLUDE), *fTypes, &ignored, &elements); break; - case Program::kFragmentProcessor_Kind: - fIRGenerator->convertProgram(String(SKSL_FP_INCLUDE), *fTypes, &ignored, &elements); - break; } fIRGenerator->fSymbolTable->markAllFunctionsBuiltin(); Modifiers::Flag defaultPrecision; @@ -1142,16 +1127,15 @@ bool Compiler::toSPIRV(const Program& program, OutputStream& out) { bool result = cg.generateCode(); if (result) { spvtools::SpirvTools tools(SPV_ENV_VULKAN_1_0); - const String& data = buffer.str(); - ASSERT(0 == data.size() % 4); + ASSERT(0 == buffer.size() % 4); auto dumpmsg = [](spv_message_level_t, const char*, const spv_position_t&, const char* m) { SkDebugf("SPIR-V validation error: %s\n", m); }; tools.SetMessageConsumer(dumpmsg); // Verify that the SPIR-V we produced is valid. If this assert fails, check the logs prior // to the failure to see the validation errors. - ASSERT_RESULT(tools.Validate((const uint32_t*) data.c_str(), data.size() / 4)); - out.write(data.c_str(), data.size()); + ASSERT_RESULT(tools.Validate((const uint32_t*) buffer.data(), buffer.size() / 4)); + out.write(buffer.data(), buffer.size()); } #else SPIRVCodeGenerator cg(&fContext, &program, this, &out); @@ -1165,7 +1149,7 @@ bool Compiler::toSPIRV(const Program& program, String* out) { StringStream buffer; bool result = this->toSPIRV(program, buffer); if (result) { - *out = buffer.str(); + *out = String(buffer.data(), buffer.size()); } return result; } @@ -1181,24 +1165,11 @@ bool Compiler::toGLSL(const Program& program, String* out) { StringStream buffer; bool result = this->toGLSL(program, buffer); if (result) { - *out = buffer.str(); + *out = String(buffer.data(), buffer.size()); } return result; } -bool Compiler::toCPP(const Program& program, String name, OutputStream& out) { - CPPCodeGenerator cg(&fContext, &program, this, name, &out); - bool result = cg.generateCode(); - this->writeErrorCount(); - return result; -} - -bool Compiler::toH(const Program& program, String name, OutputStream& out) { - HCodeGenerator cg(&program, this, name, &out); - bool result = cg.generateCode(); - this->writeErrorCount(); - return result; -} void Compiler::error(Position position, String msg) { fErrorCount++; |