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

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2016-03-02 00:50:00 +01:00 committed by Alexandre Julliard
parent 28c04a64f6
commit 8e696dee5f
3 changed files with 14 additions and 1 deletions

View File

@ -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);

View File

@ -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))

View File

@ -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;