ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 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 | */ |
Ethan Nicholas | 0df1b04 | 2017-03-31 13:56:23 -0400 | [diff] [blame] | 7 | |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 8 | #ifndef SKSL_CONTEXT |
| 9 | #define SKSL_CONTEXT |
| 10 | |
John Stiles | fbd050b | 2020-08-03 13:21:46 -0400 | [diff] [blame] | 11 | #include <memory> |
| 12 | |
John Stiles | ac01aca | 2021-01-15 11:12:46 -0500 | [diff] [blame] | 13 | #include "src/sksl/SkSLBuiltinTypes.h" |
John Stiles | c1a98b8 | 2021-02-24 13:35:02 -0500 | [diff] [blame] | 14 | #include "src/sksl/SkSLUtil.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 15 | #include "src/sksl/ir/SkSLType.h" |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 16 | |
| 17 | namespace SkSL { |
| 18 | |
John Stiles | 2dda4b6 | 2021-09-16 13:18:10 -0400 | [diff] [blame^] | 19 | class ErrorReporter; |
| 20 | class Mangler; |
| 21 | class ModifiersPool; |
John Stiles | 270cec2 | 2021-02-17 12:59:36 -0500 | [diff] [blame] | 22 | struct ProgramConfig; |
John Stiles | dbd4e6f | 2021-02-16 13:29:15 -0500 | [diff] [blame] | 23 | |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 24 | /** |
| 25 | * Contains compiler-wide objects, which currently means the core types. |
| 26 | */ |
| 27 | class Context { |
| 28 | public: |
John Stiles | 2dda4b6 | 2021-09-16 13:18:10 -0400 | [diff] [blame^] | 29 | Context(ErrorReporter& errors, const ShaderCapsClass& caps, Mangler& mangler); |
| 30 | ~Context(); |
Ethan Nicholas | 624a529 | 2021-04-16 14:54:43 -0400 | [diff] [blame] | 31 | |
John Stiles | 54e7c05 | 2021-01-11 14:22:36 -0500 | [diff] [blame] | 32 | // The Context holds all of the built-in types. |
| 33 | BuiltinTypes fTypes; |
Brian Salomon | 2a51de8 | 2016-11-16 12:06:01 -0500 | [diff] [blame] | 34 | |
John Stiles | c1a98b8 | 2021-02-24 13:35:02 -0500 | [diff] [blame] | 35 | // The Context holds a reference to our shader caps bits. |
| 36 | const ShaderCapsClass& fCaps; |
| 37 | |
John Stiles | 10d39d9 | 2021-05-04 16:13:14 -0400 | [diff] [blame] | 38 | // The Context holds a pointer to our pool of modifiers. |
| 39 | ModifiersPool* fModifiersPool = nullptr; |
| 40 | |
John Stiles | 270cec2 | 2021-02-17 12:59:36 -0500 | [diff] [blame] | 41 | // The Context holds a pointer to the configuration of the program being compiled. |
| 42 | ProgramConfig* fConfig = nullptr; |
Ethan Nicholas | 8d11654 | 2021-08-11 13:27:16 -0400 | [diff] [blame] | 43 | |
John Stiles | 2dda4b6 | 2021-09-16 13:18:10 -0400 | [diff] [blame^] | 44 | // The Context holds a pointer to our error reporter. |
Ethan Nicholas | 313c948 | 2021-08-23 10:35:08 -0400 | [diff] [blame] | 45 | ErrorReporter* fErrors; |
John Stiles | 2dda4b6 | 2021-09-16 13:18:10 -0400 | [diff] [blame^] | 46 | |
| 47 | // The Context holds a pointer to the shared name-mangler. |
| 48 | Mangler* fMangler = nullptr; |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 49 | }; |
| 50 | |
John Stiles | a6841be | 2020-08-06 14:11:56 -0400 | [diff] [blame] | 51 | } // namespace SkSL |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 52 | |
| 53 | #endif |