1 /* 2 * Copyright 2016 Google Inc. 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_CONTEXT 9 #define SKSL_CONTEXT 10 11 #include <memory> 12 13 #include "src/sksl/SkSLBuiltinTypes.h" 14 #include "src/sksl/SkSLUtil.h" 15 #include "src/sksl/ir/SkSLType.h" 16 17 namespace SkSL { 18 19 class ErrorReporter; 20 class IntrinsicMap; 21 class Mangler; 22 class ModifiersPool; 23 struct ProgramConfig; 24 25 /** 26 * Contains compiler-wide objects, which currently means the core types. 27 */ 28 class Context { 29 public: 30 Context(ErrorReporter& errors, const ShaderCapsClass& caps, Mangler& mangler); 31 ~Context(); 32 33 // The Context holds all of the built-in types. 34 BuiltinTypes fTypes; 35 36 // The Context holds a reference to our shader caps bits. 37 const ShaderCapsClass& fCaps; 38 39 // The Context holds a pointer to our pool of modifiers. 40 ModifiersPool* fModifiersPool = nullptr; 41 42 // The Context holds a pointer to the configuration of the program being compiled. 43 ProgramConfig* fConfig = nullptr; 44 45 // The Context holds a pointer to our error reporter. 46 ErrorReporter* fErrors; 47 48 // The Context holds a pointer to the shared name-mangler. 49 Mangler* fMangler = nullptr; 50 51 // Symbols which have definitions in the include files. 52 IntrinsicMap* fIntrinsics = nullptr; 53 }; 54 55 } // namespace SkSL 56 57 #endif 58