blob: 3a9bb55dd12ec0cc7216d3a8a728946f7d91dffc [file] [log] [blame]
Olli Etuaho822fa842015-04-16 14:26:10 +03001//
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 Madilld7b1ab52016-12-12 14:42:19 -05006// The SeparateArrayInitialization function splits each array initialization into a declaration and
7// an assignment.
Olli Etuaho822fa842015-04-16 14:26:10 +03008// Example:
9// type[n] a = initializer;
10// will effectively become
11// type[n] a;
12// a = initializer;
Olli Etuahob1edc4f2015-11-02 17:20:03 +020013//
Olli Etuaho18b9deb2015-11-05 12:14:50 +020014// 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 Etuaho822fa842015-04-16 14:26:10 +030018
19#ifndef COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_
20#define COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_
21
Jamie Madill45bcc782016-11-07 13:58:48 -050022namespace sh
23{
Olli Etuaho822fa842015-04-16 14:26:10 +030024class TIntermNode;
25
26void SeparateArrayInitialization(TIntermNode *root);
Jamie Madill45bcc782016-11-07 13:58:48 -050027} // namespace sh
Olli Etuaho822fa842015-04-16 14:26:10 +030028
29#endif // COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_