1 // 2 // Copyright 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/preprocessor/Macro.h" 14 #include "compiler/translator/ExtensionBehavior.h" 15 #include "compiler/translator/Pragma.h" 16 17 namespace sh 18 { 19 class TDiagnostics; 20 21 class TDirectiveHandler : public angle::pp::DirectiveHandler, angle::NonCopyable 22 { 23 public: 24 TDirectiveHandler(TExtensionBehavior &extBehavior, 25 TDiagnostics &diagnostics, 26 int &shaderVersion, 27 sh::GLenum shaderType); 28 ~TDirectiveHandler() override; 29 pragma()30 const TPragma &pragma() const { return mPragma; } extensionBehavior()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, 45 int version, 46 ShShaderSpec spec, 47 angle::pp::MacroSet *macro_set) override; 48 49 private: 50 TPragma mPragma; 51 TExtensionBehavior &mExtensionBehavior; 52 TDiagnostics &mDiagnostics; 53 int &mShaderVersion; 54 sh::GLenum mShaderType; 55 }; 56 57 } // namespace sh 58 59 #endif // COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_ 60