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 | |
Jamie Madill | 45bcc78 | 2016-11-07 13:58:48 -0500 | [diff] [blame] | 17 | namespace sh |
| 18 | { |
| 19 | |
Geoff Lang | 91dbc18 | 2015-06-17 16:19:29 -0700 | [diff] [blame] | 20 | // Traverses the intermediate tree to determine which GLSL extensions are required |
| 21 | // to support the shader. |
| 22 | class TExtensionGLSL : public TIntermTraverser |
| 23 | { |
| 24 | public: |
| 25 | TExtensionGLSL(ShShaderOutput output); |
| 26 | |
| 27 | const std::set<std::string> &getEnabledExtensions() const; |
| 28 | const std::set<std::string> &getRequiredExtensions() const; |
| 29 | |
| 30 | bool visitUnary(Visit visit, TIntermUnary *node) override; |
| 31 | bool visitAggregate(Visit visit, TIntermAggregate *node) override; |
| 32 | |
| 33 | private: |
| 34 | void checkOperator(TIntermOperator *node); |
| 35 | |
| 36 | int mTargetVersion; |
| 37 | |
| 38 | std::set<std::string> mEnabledExtensions; |
| 39 | std::set<std::string> mRequiredExtensions; |
| 40 | }; |
| 41 | |
Jamie Madill | 45bcc78 | 2016-11-07 13:58:48 -0500 | [diff] [blame] | 42 | } // namespace sh |
| 43 | |
Geoff Lang | 91dbc18 | 2015-06-17 16:19:29 -0700 | [diff] [blame] | 44 | #endif // COMPILER_TRANSLATOR_EXTENSIONGLSL_H_ |