blob: 3c2dbe0746dbbe4f319b86028f012893e187bfe6 [file] [log] [blame]
Geoff Lang91dbc182015-06-17 16:19:29 -07001//
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 Madill45bcc782016-11-07 13:58:48 -050017namespace sh
18{
19
Geoff Lang91dbc182015-06-17 16:19:29 -070020// Traverses the intermediate tree to determine which GLSL extensions are required
21// to support the shader.
22class 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 Madill45bcc782016-11-07 13:58:48 -050042} // namespace sh
43
Geoff Lang91dbc182015-06-17 16:19:29 -070044#endif // COMPILER_TRANSLATOR_EXTENSIONGLSL_H_