blob: 672b20d392a2797e246835fef374b4064e5a43ff [file] [log] [blame]
Jamie Madill570e04d2013-06-21 09:15:33 -04001//
2// Copyright (c) 2013 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_FLAGSTD140STRUCTS_H_
8#define COMPILER_TRANSLATOR_FLAGSTD140STRUCTS_H_
Jamie Madill570e04d2013-06-21 09:15:33 -04009
Jamie Madillb1a85f42014-08-19 15:23:24 -040010#include "compiler/translator/IntermNode.h"
Jamie Madill570e04d2013-06-21 09:15:33 -040011
12namespace sh
13{
14
15// This class finds references to nested structs of std140 blocks that access
16// the nested struct "by value", where the padding added in the translator
17// conflicts with the "natural" unpadded type.
18class FlagStd140Structs : public TIntermTraverser
19{
20 public:
Jamie Madilld7b1ab52016-12-12 14:42:19 -050021 FlagStd140Structs() : TIntermTraverser(true, false, false) {}
Olli Etuaho3d0d9a42015-06-01 12:16:36 +030022
Jamie Madill570e04d2013-06-21 09:15:33 -040023 const std::vector<TIntermTyped *> getFlaggedNodes() const { return mFlaggedNodes; }
24
25 protected:
Corentin Walleze5a1f272015-08-21 02:58:25 +020026 bool visitBinary(Visit visit, TIntermBinary *binaryNode) override;
27 void visitSymbol(TIntermSymbol *symbol) override;
Jamie Madill570e04d2013-06-21 09:15:33 -040028
29 private:
30 bool isInStd140InterfaceBlock(TIntermTyped *node) const;
31
32 std::vector<TIntermTyped *> mFlaggedNodes;
33};
34
35std::vector<TIntermTyped *> FlagStd140ValueStructs(TIntermNode *node);
Jamie Madill570e04d2013-06-21 09:15:33 -040036}
37
Jamie Madilld7b1ab52016-12-12 14:42:19 -050038#endif // COMPILER_TRANSLATOR_FLAGSTD140STRUCTS_H_