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->type->is_numeric() || var->type->is_boolean())
+ && state->zero_init) {
+ const ir_constant_data data = {0};
+ var->data.has_initializer = true;
+ var->constant_initializer = new(var) ir_constant(var->type, &data);
+ }
+
if (this->type->qualifier.flags.q.invariant) {
if (!is_varying_var(var, state->stage)) {
_mesa_glsl_error(&loc, state,
/* Set default language version and extensions */
this->language_version = 110;
this->forced_language_version = ctx->Const.ForceGLSLVersion;
+ this->zero_init = ctx->Const.GLSLZeroInit;
this->es_shader = false;
this->ARB_texture_rectangle_enable = true;
bool es_shader;
unsigned language_version;
unsigned forced_language_version;
+ bool zero_init;
gl_shader_stage stage;
/**
unsigned force_glsl_version;
boolean force_s3tc_enable;
boolean allow_glsl_extension_directive_midshader;
+ boolean glsl_zero_init;
};
/**
DRI_CONF_SECTION_MISCELLANEOUS
DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER("false")
+ DRI_CONF_GLSL_ZERO_INIT("false")
DRI_CONF_SECTION_END
DRI_CONF_END
};
driQueryOptionb(optionCache, "force_s3tc_enable");
options->allow_glsl_extension_directive_midshader =
driQueryOptionb(optionCache, "allow_glsl_extension_directive_midshader");
+ options->glsl_zero_init = driQueryOptionb(optionCache, "glsl_zero_init");
}
static const __DRIconfig **
<application name="Warsow (64-bit)" executable="warsow.x86_64">
<option name="allow_glsl_extension_directive_midshader" value="true" />
</application>
+
+ <application name="Rust" executable="rust">
+ <option name="glsl_zero_init" value="true"/>
+ </application>
</device>
</driconf>
DRI_CONF_DESC(en,gettext("Create all visuals with a depth buffer")) \
DRI_CONF_OPT_END
-
+#define DRI_CONF_GLSL_ZERO_INIT(def) \
+DRI_CONF_OPT_BEGIN_B(glsl_zero_init, def) \
+ DRI_CONF_DESC(en,gettext("Force uninitialized variables to default to zero")) \
+DRI_CONF_OPT_END
/**
* \brief Initialization configuration options
ctx->Const.AllowGLSLExtensionDirectiveMidShader =
driQueryOptionb(options, "allow_glsl_extension_directive_midshader");
+ ctx->Const.GLSLZeroInit = driQueryOptionb(options, "glsl_zero_init");
+
brw->dual_color_blend_by_location =
driQueryOptionb(options, "dual_color_blend_by_location");
}
DRI_CONF_DESC(en, "Perform code generation at shader link time.")
DRI_CONF_OPT_END
DRI_CONF_SECTION_END
+
+ DRI_CONF_SECTION_MISCELLANEOUS
+ DRI_CONF_GLSL_ZERO_INIT("false")
+ DRI_CONF_SECTION_END
DRI_CONF_END
};
*/
GLboolean AllowGLSLExtensionDirectiveMidShader;
+ /**
+ * Force uninitialized variables to default to zero.
+ */
+ GLboolean GLSLZeroInit;
+
/**
* Does the driver support real 32-bit integers? (Otherwise, integers are
* simulated via floats.)
extensions->EXT_texture_integer = GL_FALSE;
}
+ consts->GLSLZeroInit = options->glsl_zero_init;
+
consts->UniformBooleanTrue = consts->NativeIntegers ? ~0U : fui(1.0f);
/* Below are the cases which cannot be moved into tables easily. */