blob: 32842301c6606913c59bdb41d8de608ab48e579b [file] [log] [blame]
ethannicholasd598f792016-07-25 10:08:54 -07001/*
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 Nicholas0df1b042017-03-31 13:56:23 -04007
ethannicholasd598f792016-07-25 10:08:54 -07008#ifndef SKSL_CONTEXT
9#define SKSL_CONTEXT
10
John Stilesfbd050b2020-08-03 13:21:46 -040011#include <memory>
12
John Stilesac01aca2021-01-15 11:12:46 -050013#include "src/sksl/SkSLBuiltinTypes.h"
John Stilesc1a98b82021-02-24 13:35:02 -050014#include "src/sksl/SkSLUtil.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050015#include "src/sksl/ir/SkSLType.h"
ethannicholasd598f792016-07-25 10:08:54 -070016
17namespace SkSL {
18
John Stiles2dda4b62021-09-16 13:18:10 -040019class ErrorReporter;
20class Mangler;
21class ModifiersPool;
John Stiles270cec22021-02-17 12:59:36 -050022struct ProgramConfig;
John Stilesdbd4e6f2021-02-16 13:29:15 -050023
ethannicholasd598f792016-07-25 10:08:54 -070024/**
25 * Contains compiler-wide objects, which currently means the core types.
26 */
27class Context {
28public:
John Stiles2dda4b62021-09-16 13:18:10 -040029 Context(ErrorReporter& errors, const ShaderCapsClass& caps, Mangler& mangler);
30 ~Context();
Ethan Nicholas624a5292021-04-16 14:54:43 -040031
John Stiles54e7c052021-01-11 14:22:36 -050032 // The Context holds all of the built-in types.
33 BuiltinTypes fTypes;
Brian Salomon2a51de82016-11-16 12:06:01 -050034
John Stilesc1a98b82021-02-24 13:35:02 -050035 // The Context holds a reference to our shader caps bits.
36 const ShaderCapsClass& fCaps;
37
John Stiles10d39d92021-05-04 16:13:14 -040038 // The Context holds a pointer to our pool of modifiers.
39 ModifiersPool* fModifiersPool = nullptr;
40
John Stiles270cec22021-02-17 12:59:36 -050041 // The Context holds a pointer to the configuration of the program being compiled.
42 ProgramConfig* fConfig = nullptr;
Ethan Nicholas8d116542021-08-11 13:27:16 -040043
John Stiles2dda4b62021-09-16 13:18:10 -040044 // The Context holds a pointer to our error reporter.
Ethan Nicholas313c9482021-08-23 10:35:08 -040045 ErrorReporter* fErrors;
John Stiles2dda4b62021-09-16 13:18:10 -040046
47 // The Context holds a pointer to the shared name-mangler.
48 Mangler* fMangler = nullptr;
ethannicholasd598f792016-07-25 10:08:54 -070049};
50
John Stilesa6841be2020-08-06 14:11:56 -040051} // namespace SkSL
ethannicholasd598f792016-07-25 10:08:54 -070052
53#endif