Commit 8e696dee authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: Add a setting to check relative addressing indices when accessing uniforms.

parent 28c04a64
......@@ -2257,7 +2257,12 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
/* Relative addressing */
if (reg->idx[0].rel_addr)
{
if (reg->idx[0].offset)
if (wined3d_settings.check_float_constants)
sprintf(register_name, "(%s + %u >= 0 && %s + %u < %u ? %s_c[%s + %u] : vec4(0.0))",
rel_param0.param_str, reg->idx[0].offset,
rel_param0.param_str, reg->idx[0].offset, shader->limits->constant_float,
prefix, rel_param0.param_str, reg->idx[0].offset);
else if (reg->idx[0].offset)
sprintf(register_name, "%s_c[%s + %u]", prefix, rel_param0.param_str, reg->idx[0].offset);
else
sprintf(register_name, "%s_c[%s]", prefix, rel_param0.param_str);
......
......@@ -82,6 +82,7 @@ struct wined3d_settings wined3d_settings =
TRUE, /* Multisampling enabled by default. */
FALSE, /* No strict draw ordering. */
TRUE, /* Don't try to render onscreen by default. */
FALSE, /* Don't range check relative addressing indices in float constants. */
~0U, /* No VS shader model limit by default. */
~0U, /* No GS shader model limit by default. */
~0U, /* No PS shader model limit by default. */
......@@ -302,6 +303,12 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
TRACE("Not always rendering backbuffers offscreen.\n");
wined3d_settings.always_offscreen = FALSE;
}
if (!get_config_key(hkey, appkey, "CheckFloatConstants", buffer, size)
&& !strcmp(buffer, "enabled"))
{
TRACE("Checking relative addressing indices in float constants.\n");
wined3d_settings.check_float_constants = TRUE;
}
if (!get_config_key_dword(hkey, appkey, "MaxShaderModelVS", &wined3d_settings.max_sm_vs))
TRACE("Limiting VS shader model to %u.\n", wined3d_settings.max_sm_vs);
if (!get_config_key_dword(hkey, appkey, "MaxShaderModelGS", &wined3d_settings.max_sm_gs))
......
......@@ -290,6 +290,7 @@ struct wined3d_settings
int allow_multisampling;
BOOL strict_draw_ordering;
BOOL always_offscreen;
BOOL check_float_constants;
unsigned int max_sm_vs;
unsigned int max_sm_gs;
unsigned int max_sm_ps;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment