apply_layout_qualifier_to_variable(&this->type->qualifier, var, state,
&loc);
- if ((var->data.mode == ir_var_auto || var->data.mode == ir_var_temporary
- || var->data.mode == ir_var_shader_out)
- && (var->type->is_numeric() || var->type->is_boolean())
- && state->zero_init) {
+ if ((state->zero_init & (1u << var->data.mode)) &&
+ (var->type->is_numeric() || var->type->is_boolean())) {
const ir_constant_data data = { { 0 } };
var->data.has_initializer = true;
var->constant_initializer = new(var) ir_constant(var->type, &data);
apply_type_qualifier_to_variable(& this->type->qualifier, var, state, & loc,
true);
+ if (((1u << var->data.mode) & state->zero_init) &&
+ (var->type->is_numeric() || var->type->is_boolean())) {
+ const ir_constant_data data = { { 0 } };
+ var->data.has_initializer = true;
+ var->constant_initializer = new(var) ir_constant(var->type, &data);
+ }
+
/* From section 4.1.7 of the GLSL 4.40 spec:
*
* "Opaque variables cannot be treated as l-values; hence cannot
/* Set default language version and extensions */
this->language_version = 110;
this->forced_language_version = ctx->Const.ForceGLSLVersion;
- this->zero_init = ctx->Const.GLSLZeroInit;
+ if (ctx->Const.GLSLZeroInit == 1) {
+ this->zero_init = (1u << ir_var_auto) | (1u << ir_var_temporary) | (1u << ir_var_shader_out);
+ } else {
+ this->zero_init = 0;
+ }
this->gl_version = 20;
this->compat_shader = true;
this->es_shader = false;