Olli Etuaho | 3d932d8 | 2016-04-12 11:10:30 +0300 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2016 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 | // DeferGlobalInitializers is an AST traverser that moves global initializers into a function, and |
| 7 | // adds a function call to that function in the beginning of main(). |
| 8 | // This enables initialization of globals with uniforms or non-constant globals, as allowed by |
| 9 | // the WebGL spec. Some initializers referencing non-constants may need to be unfolded into if |
| 10 | // statements in HLSL - this kind of steps should be done after DeferGlobalInitializers is run. |
| 11 | // |
| 12 | |
| 13 | #ifndef COMPILER_TRANSLATOR_DEFERGLOBALINITIALIZERS_H_ |
| 14 | #define COMPILER_TRANSLATOR_DEFERGLOBALINITIALIZERS_H_ |
| 15 | |
Olli Etuaho | 6d40bbd | 2016-09-30 13:49:38 +0100 | [diff] [blame] | 16 | class TIntermBlock; |
Olli Etuaho | 3d932d8 | 2016-04-12 11:10:30 +0300 | [diff] [blame] | 17 | |
Jamie Madill | 45bcc78 | 2016-11-07 13:58:48 -0500 | [diff] [blame^] | 18 | namespace sh |
| 19 | { |
Olli Etuaho | 6d40bbd | 2016-09-30 13:49:38 +0100 | [diff] [blame] | 20 | void DeferGlobalInitializers(TIntermBlock *root); |
Jamie Madill | 45bcc78 | 2016-11-07 13:58:48 -0500 | [diff] [blame^] | 21 | } // namespace sh |
Olli Etuaho | 3d932d8 | 2016-04-12 11:10:30 +0300 | [diff] [blame] | 22 | |
| 23 | #endif // COMPILER_TRANSLATOR_DEFERGLOBALINITIALIZERS_H_ |