blob: 261ec90018cf30b4f49cb02dcf2d330c809213c0 [file] [log] [blame]
Olli Etuaho3d932d82016-04-12 11:10:30 +03001//
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 Etuaho6d40bbd2016-09-30 13:49:38 +010016class TIntermBlock;
Olli Etuaho3d932d82016-04-12 11:10:30 +030017
Jamie Madill45bcc782016-11-07 13:58:48 -050018namespace sh
19{
Olli Etuaho6d40bbd2016-09-30 13:49:38 +010020void DeferGlobalInitializers(TIntermBlock *root);
Jamie Madill45bcc782016-11-07 13:58:48 -050021} // namespace sh
Olli Etuaho3d932d82016-04-12 11:10:30 +030022
23#endif // COMPILER_TRANSLATOR_DEFERGLOBALINITIALIZERS_H_