• 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
9 // separate uniform sampler declarations. This allows the struct to be stored in the
10 // default uniform block. It also requires that we rewrite any functions that take the
11 // struct as an argument. The struct is split into two arguments.
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 ANGLE_NO_DISCARD bool RewriteStructSamplers(TCompiler *compiler,
33                                             TIntermBlock *root,
34                                             TSymbolTable *symbolTable,
35                                             int *removedUniformsCountOut);
36 ANGLE_NO_DISCARD bool RewriteStructSamplersOld(TCompiler *compier,
37                                                TIntermBlock *root,
38                                                TSymbolTable *symbolTable,
39                                                int *removedUniformsCountOut);
40 }  // namespace sh
41 
42 #endif  // COMPILER_TRANSLATOR_TREEOPS_REWRITESTRUCTSAMPLERS_H_
43