• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2018 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 // RewriteStructSamplers: Extract structs from samplers.
7 //
8 // This traverser is designed to strip out samplers from structs. It moves them into separate
9 // uniform sampler declarations. This allows the struct to be stored in the default uniform block.
10 // This transformation requires MonomorphizeUnsupportedFunctions to have been run so it
11 // wouldn't need to deal with functions that are passed such structs.
12 //
13 // For example:
14 //   struct S { sampler2D samp; int i; };
15 //   uniform S uni;
16 // Is rewritten as:
17 //   struct S { int i; };
18 //   uniform S uni;
19 //   uniform sampler2D uni_i;
20 
21 #ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITESTRUCTSAMPLERS_H_
22 #define COMPILER_TRANSLATOR_TREEOPS_REWRITESTRUCTSAMPLERS_H_
23 
24 #include "common/angleutils.h"
25 
26 namespace sh
27 {
28 class TCompiler;
29 class TIntermBlock;
30 class TSymbolTable;
31 
32 bool RewriteStructSamplers(TCompiler *compiler,
33                            TIntermBlock *root,
34                            TSymbolTable *symbolTable,
35                            int *removedUniformsCountOut);
36 }  // namespace sh
37 
38 #endif  // COMPILER_TRANSLATOR_TREEOPS_REWRITESTRUCTSAMPLERS_H_
39