* Copyright 2022 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SKSL_MODULELOADER
#define SKSL_MODULELOADER
#include "src/sksl/SkSLBuiltinTypes.h"
#include <memory>
namespace SkSL {
class Compiler;
struct Module;
class Type;
using BuiltinTypePtr = const std::unique_ptr<Type> BuiltinTypes::*;
* Documentation for modules in SkSL: http://go/modules-in-sksl
* https://docs.google.com/document/d/1P8LkkimNr-nPlxMimUsz3K_7qMM7-tZOxDCWZejPcWg/edit?usp=sharing
*/
class ModuleLoader {
private:
struct Impl;
Impl& fModuleLoader;
public:
ModuleLoader(ModuleLoader::Impl&);
~ModuleLoader();
static ModuleLoader Get();
const BuiltinTypes& builtinTypes();
const Module* rootModule();
const Module* loadSharedModule(SkSL::Compiler* compiler);
const Module* loadGPUModule(SkSL::Compiler* compiler);
const Module* loadVertexModule(SkSL::Compiler* compiler);
const Module* loadFragmentModule(SkSL::Compiler* compiler);
const Module* loadComputeModule(SkSL::Compiler* compiler);
const Module* loadGraphiteVertexModule(SkSL::Compiler* compiler);
const Module* loadGraphiteFragmentModule(SkSL::Compiler* compiler);
const Module* loadPublicModule(SkSL::Compiler* compiler);
const Module* loadPrivateRTShaderModule(SkSL::Compiler* compiler);
void addPublicTypeAliases(const SkSL::Module* module);
void unloadModules();
};
}
#endif