| 1 | // |
| 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | #ifndef COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_ |
| 8 | #define COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_ |
| 9 | |
| 10 | #include "GLSLANG/ShaderLang.h" |
| 11 | #include "common/angleutils.h" |
| 12 | #include "compiler/preprocessor/DirectiveHandlerBase.h" |
| 13 | #include "compiler/translator/ExtensionBehavior.h" |
| 14 | #include "compiler/translator/Pragma.h" |
| 15 | |
| 16 | namespace sh |
| 17 | { |
| 18 | class TDiagnostics; |
| 19 | |
| 20 | class TDirectiveHandler : public angle::pp::DirectiveHandler, angle::NonCopyable |
| 21 | { |
| 22 | public: |
| 23 | TDirectiveHandler(TExtensionBehavior &extBehavior, |
| 24 | TDiagnostics &diagnostics, |
| 25 | int &shaderVersion, |
| 26 | sh::GLenum shaderType, |
| 27 | bool debugShaderPrecisionSupported); |
| 28 | ~TDirectiveHandler() override; |
| 29 | |
| 30 | const TPragma &pragma() const { return mPragma; } |
| 31 | const TExtensionBehavior &extensionBehavior() const { return mExtensionBehavior; } |
| 32 | |
| 33 | void handleError(const angle::pp::SourceLocation &loc, const std::string &msg) override; |
| 34 | |
| 35 | void handlePragma(const angle::pp::SourceLocation &loc, |
| 36 | const std::string &name, |
| 37 | const std::string &value, |
| 38 | bool stdgl) override; |
| 39 | |
| 40 | void handleExtension(const angle::pp::SourceLocation &loc, |
| 41 | const std::string &name, |
| 42 | const std::string &behavior) override; |
| 43 | |
| 44 | void handleVersion(const angle::pp::SourceLocation &loc, int version) override; |
| 45 | |
| 46 | private: |
| 47 | TPragma mPragma; |
| 48 | TExtensionBehavior &mExtensionBehavior; |
| 49 | TDiagnostics &mDiagnostics; |
| 50 | int &mShaderVersion; |
| 51 | sh::GLenum mShaderType; |
| 52 | bool mDebugShaderPrecisionSupported; |
| 53 | }; |
| 54 | |
| 55 | } // namespace sh |
| 56 | |
| 57 | #endif // COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_ |
| 58 | |