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 namespace SkSL { 12 13 class BuiltinTypes; 14 class ErrorReporter; 15 class ModifiersPool; 16 struct Module; 17 struct ProgramConfig; 18 struct ShaderCaps; 19 20 /** 21 * Contains compiler-wide objects, which currently means the core types. 22 */ 23 class Context { 24 public: 25 Context(const BuiltinTypes& types, const ShaderCaps* caps, ErrorReporter& errors); 26 ~Context(); 27 28 // The Context holds a reference to all of the built-in types. 29 const BuiltinTypes& fTypes; 30 31 // The Context holds a reference to our shader caps bits. 32 const ShaderCaps* fCaps; 33 34 // The Context holds a pointer to our pool of modifiers. 35 ModifiersPool* fModifiersPool = nullptr; 36 37 // The Context holds a pointer to the configuration of the program being compiled. 38 ProgramConfig* fConfig = nullptr; 39 40 // The Context holds a pointer to our error reporter. 41 ErrorReporter* fErrors; 42 43 // The Context holds a pointer to our module with built-in declarations. 44 const Module* fModule = nullptr; 45 }; 46 47 } // namespace SkSL 48 49 #endif 50