1 // 2 // Copyright 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/tree_util/IntermTraverse.h" 16 17 namespace sh 18 { 19 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 42 } // namespace sh 43 44 #endif // COMPILER_TRANSLATOR_EXTENSIONGLSL_H_ 45