Geoff Lang | 91dbc18 | 2015-06-17 16:19:29 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2015 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 | // ExtensionGLSL.h: Defines the TExtensionGLSL class that tracks GLSL extension requirements of |
| 7 | // shaders. |
| 8 | |
| 9 | #ifndef COMPILER_TRANSLATOR_EXTENSIONGLSL_H_ |
| 10 | #define COMPILER_TRANSLATOR_EXTENSIONGLSL_H_ |
| 11 | |
| 12 | #include <set> |
| 13 | #include <string> |
| 14 | |
| 15 | #include "compiler/translator/IntermNode.h" |
| 16 | |
| 17 | // Traverses the intermediate tree to determine which GLSL extensions are required |
| 18 | // to support the shader. |
| 19 | class TExtensionGLSL : public TIntermTraverser |
| 20 | { |
| 21 | public: |
| 22 | TExtensionGLSL(ShShaderOutput output); |
| 23 | |
| 24 | const std::set<std::string> &getEnabledExtensions() const; |
| 25 | const std::set<std::string> &getRequiredExtensions() const; |
| 26 | |
| 27 | bool visitUnary(Visit visit, TIntermUnary *node) override; |
| 28 | bool visitAggregate(Visit visit, TIntermAggregate *node) override; |
| 29 | |
| 30 | private: |
| 31 | void checkOperator(TIntermOperator *node); |
| 32 | |
| 33 | int mTargetVersion; |
| 34 | |
| 35 | std::set<std::string> mEnabledExtensions; |
| 36 | std::set<std::string> mRequiredExtensions; |
| 37 | }; |
| 38 | |
| 39 | #endif // COMPILER_TRANSLATOR_EXTENSIONGLSL_H_ |