| 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 | namespace sh |
| 25 | { |
| 26 | class TIntermBlock; |
| 27 | class TSymbolTable; |
| 28 | int RewriteStructSamplers(TIntermBlock *root, TSymbolTable *symbolTable); |
| 29 | } // namespace sh |
| 30 | |
| 31 | #endif // COMPILER_TRANSLATOR_TREEOPS_REWRITESTRUCTSAMPLERS_H_ |
| 32 | |