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/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 ~TDirectiveHandler() override; 28 pragma()29 const TPragma &pragma() const { return mPragma; } extensionBehavior()30 const TExtensionBehavior &extensionBehavior() const { return mExtensionBehavior; } 31 32 void handleError(const angle::pp::SourceLocation &loc, const std::string &msg) override; 33 34 void handlePragma(const angle::pp::SourceLocation &loc, 35 const std::string &name, 36 const std::string &value, 37 bool stdgl) override; 38 39 void handleExtension(const angle::pp::SourceLocation &loc, 40 const std::string &name, 41 const std::string &behavior) override; 42 43 void handleVersion(const angle::pp::SourceLocation &loc, 44 int version, 45 ShShaderSpec spec) override; 46 47 private: 48 TPragma mPragma; 49 TExtensionBehavior &mExtensionBehavior; 50 TDiagnostics &mDiagnostics; 51 int &mShaderVersion; 52 sh::GLenum mShaderType; 53 }; 54 55 } // namespace sh 56 57 #endif // COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_ 58