Olli Etuaho | 822fa84 | 2015-04-16 14:26:10 +0300 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2002-2015 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 | // |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 6 | // The SeparateArrayInitialization function splits each array initialization into a declaration and |
| 7 | // an assignment. |
Olli Etuaho | 822fa84 | 2015-04-16 14:26:10 +0300 | [diff] [blame] | 8 | // Example: |
| 9 | // type[n] a = initializer; |
| 10 | // will effectively become |
| 11 | // type[n] a; |
| 12 | // a = initializer; |
Olli Etuaho | b1edc4f | 2015-11-02 17:20:03 +0200 | [diff] [blame] | 13 | // |
Olli Etuaho | 18b9deb | 2015-11-05 12:14:50 +0200 | [diff] [blame] | 14 | // Note that if the array is declared as const, the initialization may still be split, making the |
| 15 | // AST technically invalid. Because of that this transformation should only be used when subsequent |
| 16 | // stages don't care about const qualifiers. However, the initialization will not be split if the |
| 17 | // initializer can be written as a HLSL literal. |
Olli Etuaho | 822fa84 | 2015-04-16 14:26:10 +0300 | [diff] [blame] | 18 | |
| 19 | #ifndef COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_ |
| 20 | #define COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_ |
| 21 | |
Jamie Madill | 45bcc78 | 2016-11-07 13:58:48 -0500 | [diff] [blame] | 22 | namespace sh |
| 23 | { |
Olli Etuaho | 822fa84 | 2015-04-16 14:26:10 +0300 | [diff] [blame] | 24 | class TIntermNode; |
| 25 | |
| 26 | void SeparateArrayInitialization(TIntermNode *root); |
Jamie Madill | 45bcc78 | 2016-11-07 13:58:48 -0500 | [diff] [blame] | 27 | } // namespace sh |
Olli Etuaho | 822fa84 | 2015-04-16 14:26:10 +0300 | [diff] [blame] | 28 | |
| 29 | #endif // COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_ |