54struct ProgramSettings;
59 std::vector<std::unique_ptr<ProgramElement>>
fElements;
71 inline static constexpr const char FRAGCOLOR_NAME[] =
"sk_FragColor";
72 inline static constexpr const char RTADJUST_NAME[] =
"sk_RTAdjust";
73 inline static constexpr const char POSITION_NAME[] =
"sk_Position";
74 inline static constexpr const char POISON_TAG[] =
"<POISON>";
83 std::array<float, 4>
result;
100 std::array<float, 2>
result;
101 result[0] = flipY ? rtHeight : 0.f;
102 result[1] = flipY ? -1.f : 1.f;
124 std::unique_ptr<Program> convertProgram(
ProgramKind kind,
125 std::string programSource,
128 void handleError(std::string_view msg,
Position pos);
130 std::string errorText(
bool showCount =
true);
136 void writeErrorCount();
140 this->errorReporter().resetErrorCount();
148 return fGlobalSymbols.get();
155 std::unique_ptr<Module> compileModule(
ProgramKind kind,
157 std::string moduleSource,
158 const Module* parentModule,
162 bool optimizeModuleBeforeMinifying(
ProgramKind kind,
Module& module,
bool shrinkSymbols);
167 void runInliner(
Program& program);
175 void handleError(std::string_view msg, Position
pos)
override {
176 fCompiler.handleError(msg,
pos);
194 void cleanupContext();
200 std::unique_ptr<SkSL::Program> releaseProgram(
201 std::unique_ptr<std::string>
source,
202 std::vector<std::unique_ptr<SkSL::ProgramElement>> programElements);
208 bool finalize(Program& program);
211 bool optimizeModuleAfterLoading(
ProgramKind kind, Module& module);
214 bool runInliner(Inliner* inliner,
215 const std::vector<std::unique_ptr<ProgramElement>>& elements,
217 ProgramUsage*
usage);
219 CompilerErrorReporter fErrorReporter;
221 std::unique_ptr<SymbolTable> fGlobalSymbols;
222 std::unique_ptr<ProgramConfig> fConfig;
223 std::unique_ptr<Pool> fPool;
225 std::string fErrorText;
231 friend class ThreadContext;
static SkTileMode optimize(SkTileMode tm, int dimension)
constexpr int SK_SAMPLEMASK_BUILTIN
constexpr int SK_WORKGROUPID_BUILTIN
constexpr int SK_CLOCKWISE_BUILTIN
constexpr int SK_VERTEXID_BUILTIN
constexpr int SK_FRAGCOLOR_BUILTIN
constexpr int SK_LASTFRAGCOLOR_BUILTIN
constexpr int SK_GLOBALINVOCATIONID_BUILTIN
constexpr int SK_POSITION_BUILTIN
constexpr int SK_LOCALINVOCATIONID_BUILTIN
constexpr int SK_INSTANCEID_BUILTIN
constexpr int SK_SECONDARYFRAGCOLOR_BUILTIN
constexpr int SK_NUMWORKGROUPS_BUILTIN
constexpr int SK_POINTSIZE_BUILTIN
constexpr int SK_FRAGCOORD_BUILTIN
constexpr int SK_LOCALINVOCATIONINDEX_BUILTIN
constexpr int SK_SAMPLEMASKIN_BUILTIN
static std::array< float, 2 > GetRTFlipVector(int rtHeight, bool flipY)
static void EnableInliner(OverrideFlag flag)
static void EnableOptimizer(OverrideFlag flag)
Context & context() const
Compiler(const Compiler &)=delete
SymbolTable * symbolTable()
static std::array< float, 4 > GetRTAdjustVector(SkISize rtDims, bool flipY)
Compiler & operator=(const Compiler &)=delete
ErrorReporter & errorReporter()
SymbolTable * globalSymbols()
FlutterSemanticsFlag flag
static void usage(char *argv0)
constexpr int32_t width() const
constexpr int32_t height() const
std::vector< std::unique_ptr< ProgramElement > > fElements
std::unique_ptr< SymbolTable > fSymbols