blob: 53630c8c162bcf533c494ec3ca220d03ceeeee62 [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:
Olli Etuaho3d0d9a42015-06-01 12:16:36 +030021
22 FlagStd140Structs()
23 : TIntermTraverser(true, false, false)
24 {
25 }
26
Jamie Madill570e04d2013-06-21 09:15:33 -040027 const std::vector<TIntermTyped *> getFlaggedNodes() const { return mFlaggedNodes; }
28
29 protected:
30 virtual bool visitBinary(Visit visit, TIntermBinary *binaryNode);
31 virtual void visitSymbol(TIntermSymbol *symbol);
32
33 private:
34 bool isInStd140InterfaceBlock(TIntermTyped *node) const;
35
36 std::vector<TIntermTyped *> mFlaggedNodes;
37};
38
39std::vector<TIntermTyped *> FlagStd140ValueStructs(TIntermNode *node);
40
41}
42
Geoff Lang0a73dd82014-11-19 16:18:08 -050043#endif // COMPILER_TRANSLATOR_FLAGSTD140STRUCTS_H_