blob: 70f6665367211e6d60a3809bbf1b592c0904e13f [file] [log] [blame]
alokp@chromium.org8b851c62012-06-15 16:25:11 +00001//
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
Geoff Lang0a73dd82014-11-19 16:18:08 -05007#ifndef COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_
8#define COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_
alokp@chromium.org8b851c62012-06-15 16:25:11 +00009
Geoff Lang17732822013-08-29 13:46:49 -040010#include "compiler/translator/ExtensionBehavior.h"
11#include "compiler/translator/Pragma.h"
daniel@transgaming.comb3077d02013-01-11 04:12:09 +000012#include "compiler/preprocessor/DirectiveHandlerBase.h"
alokp@chromium.org8b851c62012-06-15 16:25:11 +000013
14class TDiagnostics;
15
16class TDirectiveHandler : public pp::DirectiveHandler
17{
18 public:
19 TDirectiveHandler(TExtensionBehavior& extBehavior,
shannon.woods%transgaming.com@gtempaccount.com5524db02013-04-13 03:38:16 +000020 TDiagnostics& diagnostics,
Olli Etuaho853dc1a2014-11-06 17:25:48 +020021 int& shaderVersion,
22 bool debugShaderPrecisionSupported);
alokp@chromium.org8b851c62012-06-15 16:25:11 +000023 virtual ~TDirectiveHandler();
24
25 const TPragma& pragma() const { return mPragma; }
alokp@chromium.org73bc2982012-06-19 18:48:05 +000026 const TExtensionBehavior& extensionBehavior() const { return mExtensionBehavior; }
alokp@chromium.org8b851c62012-06-15 16:25:11 +000027
28 virtual void handleError(const pp::SourceLocation& loc,
29 const std::string& msg);
30
31 virtual void handlePragma(const pp::SourceLocation& loc,
32 const std::string& name,
Zhenyao Mo94ac7b72014-10-15 18:22:08 -070033 const std::string& value,
34 bool stdgl);
alokp@chromium.org8b851c62012-06-15 16:25:11 +000035
36 virtual void handleExtension(const pp::SourceLocation& loc,
37 const std::string& name,
38 const std::string& behavior);
39
40 virtual void handleVersion(const pp::SourceLocation& loc,
41 int version);
42
43 private:
44 TPragma mPragma;
alokp@chromium.org73bc2982012-06-19 18:48:05 +000045 TExtensionBehavior& mExtensionBehavior;
alokp@chromium.org8b851c62012-06-15 16:25:11 +000046 TDiagnostics& mDiagnostics;
shannon.woods%transgaming.com@gtempaccount.com5524db02013-04-13 03:38:16 +000047 int& mShaderVersion;
Olli Etuaho853dc1a2014-11-06 17:25:48 +020048 bool mDebugShaderPrecisionSupported;
alokp@chromium.org8b851c62012-06-15 16:25:11 +000049};
50
Geoff Lang0a73dd82014-11-19 16:18:08 -050051#endif // COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_