Hash :
a16a84f3
Author :
Date :
2017-09-12T13:49:18
GLSL: Fix initializing globals declared after main() Initialize globals in a separate function instead of a block in the beginning of main(). This way it works also for globals declared after main(). BUG=chromium:764036 TEST=angle_end2end_tests Change-Id: I2fcbb97d046589301287757dc3dde5471172a3f6 Reviewed-on: https://chromium-review.googlesource.com/663158 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
//
// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// DeferGlobalInitializers is an AST traverser that moves global initializers into a separate
// function that is called in the beginning of main(). This enables initialization of globals with
// uniforms or non-constant globals, as allowed by the WebGL spec. Some initializers referencing
// non-constants may need to be unfolded into if statements in HLSL - this kind of steps should be
// done after DeferGlobalInitializers is run. Note that it's important that the function definition
// is at the end of the shader, as some globals may be declared after main().
//
// It can also initialize all uninitialized globals.
//
#ifndef COMPILER_TRANSLATOR_DEFERGLOBALINITIALIZERS_H_
#define COMPILER_TRANSLATOR_DEFERGLOBALINITIALIZERS_H_
namespace sh
{
class TIntermBlock;
class TSymbolTable;
void DeferGlobalInitializers(TIntermBlock *root,
bool initializeUninitializedGlobals,
TSymbolTable *symbolTable);
} // namespace sh
#endif // COMPILER_TRANSLATOR_DEFERGLOBALINITIALIZERS_H_