Lines Matching refs:SkSL

51 static std::unique_ptr<SkWStream> as_SkWStream(SkSL::OutputStream& s) {
54 Adapter(SkSL::OutputStream& out) : fOut(out), fBytesWritten(0) {}
65 SkSL::OutputStream& fOut;
75 static SkSL::String base_name(const SkSL::String& fpPath, const char* prefix, const char* suffix) {
76 SkSL::String result;
90 // Given a string containing an SkSL program, searches for a #pragma settings comment, like so:
93 static bool detect_shader_settings(const SkSL::String& text,
94 SkSL::Program::Settings* settings,
95 const SkSL::ShaderCapsClass** caps,
96 std::unique_ptr<SkSL::SkVMDebugInfo>* debugInfo) {
97 using Factory = SkSL::ShaderCapsFactory;
109 SkSL::String settingsText{settingsPtr, size_t(settingsEnd - settingsPtr)};
221 *debugInfo = std::make_unique<SkSL::SkVMDebugInfo>();
253 ResultCode processCommand(std::vector<SkSL::String>& args) {
257 const SkSL::String& settingsArg = args[3];
272 SkSL::ProgramKind kind;
273 const SkSL::String& inputPath = args[1];
275 kind = SkSL::ProgramKind::kVertex;
277 kind = SkSL::ProgramKind::kFragment;
279 kind = SkSL::ProgramKind::kRuntimeBlender;
281 kind = SkSL::ProgramKind::kRuntimeColorFilter;
283 kind = SkSL::ProgramKind::kRuntimeShader;
291 SkSL::String text((std::istreambuf_iterator<char>(in)),
298 SkSL::Program::Settings settings;
299 SkSL::StandaloneShaderCaps standaloneCaps;
300 const SkSL::ShaderCapsClass* caps = &standaloneCaps;
301 std::unique_ptr<SkSL::SkVMDebugInfo> debugInfo;
315 const SkSL::String& outputPath = args[2];
316 auto emitCompileError = [&](SkSL::FileOutputStream& out, const char* errorText) {
319 SkSL::FileOutputStream errorStream(outputPath);
328 SkSL::FileOutputStream out(outputPath);
329 SkSL::Compiler compiler(caps);
334 std::unique_ptr<SkSL::Program> program = compiler.convertProgram(kind, text, settings);
348 [](SkSL::Compiler& compiler, SkSL::Program& program, SkSL::OutputStream& out) {
353 [](SkSL::Compiler& compiler, SkSL::Program& program, SkSL::OutputStream& out) {
355 SkSL::StringStream assembly;
361 const SkSL::String& spirv(assembly.str());
373 [](SkSL::Compiler& compiler, SkSL::Program& program, SkSL::OutputStream& out) {
378 [](SkSL::Compiler& compiler, SkSL::Program& program, SkSL::OutputStream& out) {
383 [&](SkSL::Compiler&, SkSL::Program& program, SkSL::OutputStream& out) {
385 if (!SkSL::testingOnly_ProgramToSkVMShader(program, &builder,
399 [](SkSL::Compiler&, SkSL::Program& program, SkSL::OutputStream& out) {
400 class Callbacks : public SkSL::PipelineStage::Callbacks {
402 using String = SkSL::String;
408 String declareUniform(const SkSL::VarDeclaration* decl) override {
432 return "child_" + SkSL::to_string(index) + ".eval(" + coords + ")";
436 return "child_" + SkSL::to_string(index) + ".eval(" + color + ")";
440 return "child_" + SkSL::to_string(index) + ".eval(" + src + ", " +
446 // The .stage output looks almost like valid SkSL, but not quite.
447 // The PipelineStageGenerator bridges the gap between the SkSL in `program`,
451 // The input color and coords have names in the original SkSL (as parameters to
454 // when the new SkSL is emitted inside the FP - references to those variables
458 SkSL::PipelineStage::ConvertProgram(program, "_coords", "_inColor",
464 SkSL::FileOutputStream out(outputPath);
465 SkSL::Compiler compiler(caps);
470 SkSL::LoadedModule module =
471 compiler.loadModule(kind, SkSL::Compiler::MakeModulePath(inputPath.c_str()),
473 SkSL::Dehydrator dehydrator;
476 SkSL::String baseName = base_name(inputPath, "", ".sksl");
477 SkSL::StringStream buffer;
479 const SkSL::String& data = buffer.str();
503 SkSL::String inputPath(worklistPath);
513 std::vector<SkSL::String> args = {"skslc"};
515 for (SkSL::String line; std::getline(in, line); ) {
555 std::vector<SkSL::String> args;