glsl: add a is_implicit_initializer flag
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 30 Apr 2020 13:06:08 +0000 (15:06 +0200)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tue, 5 May 2020 10:26:02 +0000 (12:26 +0200)
commit679421628bf89067b4cbfa85530f196ca2835717
tree4bf9e1620392ec778d876f94810a481ffdf7806a
parentfa6b22d36a915f27dee576063aead9e2c577f966
glsl: add a is_implicit_initializer flag

Shared globals and glsl_zero_init can cause linker errors if the
variable is only initialized in 1 place.

This commit adds a flag to variables that have been implicitely
initialized to be able in this situation to keep the explicit
initialization value.

Without this change the global-single-initializer-2-shaders piglit
test fails when using glsl_zero_init.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4607>
src/compiler/glsl/ast_to_hir.cpp
src/compiler/glsl/ir.cpp
src/compiler/glsl/ir.h
src/compiler/glsl/linker.cpp