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/SkSLErrorReporter.h" 15 #include "src/sksl/SkSLPool.h" 16 #include "src/sksl/SkSLUtil.h" 17 #include "src/sksl/ir/SkSLExpression.h" 18 #include "src/sksl/ir/SkSLType.h" 19 20 namespace SkSL { 21 22 struct ProgramConfig; 23 24 /** 25 * Contains compiler-wide objects, which currently means the core types. 26 */ 27 class Context { 28 public: 29 Context(ErrorReporter& errors, const ShaderCapsClass& caps); 30 ~Context()31 ~Context() { 32 SkASSERT(!Pool::IsAttached()); 33 } 34 35 // The Context holds all of the built-in types. 36 BuiltinTypes fTypes; 37 38 // The Context holds a reference to our error reporter. 39 ErrorReporter& fErrors; 40 41 // The Context holds a reference to our shader caps bits. 42 const ShaderCapsClass& fCaps; 43 44 // The Context holds a pointer to our pool of modifiers. 45 ModifiersPool* fModifiersPool = nullptr; 46 47 // The Context holds a pointer to the configuration of the program being compiled. 48 ProgramConfig* fConfig = nullptr; 49 }; 50 51 } // namespace SkSL 52 53 #endif 54