Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkSLModuleLoader.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SKSL_MODULELOADER
9#define SKSL_MODULELOADER
10
12#include <memory>
13
14namespace SkSL {
15
16class Compiler;
17struct Module;
18class Type;
19
20using BuiltinTypePtr = const std::unique_ptr<Type> BuiltinTypes::*;
21
23private:
24 struct Impl;
25 Impl& fModuleLoader;
26
27public:
30
31 // Acquires a mutex-locked reference to the singleton ModuleLoader. When the ModuleLoader is
32 // allowed to fall out of scope, the mutex will be released.
33 static ModuleLoader Get();
34
35 // The built-in types and root module are universal, immutable, and shared by every Compiler.
36 // They are created when the ModuleLoader is instantiated and never change.
38 const Module* rootModule();
39
40 // These modules are loaded on demand; once loaded, they are kept for the lifetime of the
41 // process.
51
54
55 // This updates an existing Module's symbol table to match Runtime Effect rules. GLSL types like
56 // `vec4` are added; SkSL private types like `sampler2D` are replaced with an invalid type.
57 void addPublicTypeAliases(const SkSL::Module* module);
58
59 // This unloads every module. It's useful primarily for benchmarking purposes.
60 void unloadModules();
61};
62
63} // namespace SkSL
64
65#endif // SKSL_MODULELOADER
const Module * loadComputeModule(SkSL::Compiler *compiler)
const Module * loadPublicModule(SkSL::Compiler *compiler)
const Module * loadGPUModule(SkSL::Compiler *compiler)
const Module * loadSharedModule(SkSL::Compiler *compiler)
const Module * rootModule()
const Module * loadPrivateRTShaderModule(SkSL::Compiler *compiler)
const BuiltinTypes & builtinTypes()
const Module * loadGraphiteFragmentES2Module(SkSL::Compiler *compiler)
void addPublicTypeAliases(const SkSL::Module *module)
const Module * loadGraphiteFragmentModule(SkSL::Compiler *compiler)
const Module * loadGraphiteVertexModule(SkSL::Compiler *compiler)
static ModuleLoader Get()
const Module * loadFragmentModule(SkSL::Compiler *compiler)
const Module * loadGraphiteVertexES2Module(SkSL::Compiler *compiler)
const Module * loadVertexModule(SkSL::Compiler *compiler)
const std::unique_ptr< Type > BuiltinTypes::* BuiltinTypePtr