Commit 3ca87c93 authored by Matteo Bruni's avatar Matteo Bruni Committed by Michael Stefaniuc

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

Signed-off-by: 's avatarMatteo Bruni <mbruni@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org> (cherry picked from commit 8e696dee) Signed-off-by: 's avatarMichael Stefaniuc <mstefani@winehq.org>
parent 67845776
...@@ -2233,7 +2233,12 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * ...@@ -2233,7 +2233,12 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
/* Relative addressing */ /* Relative addressing */
if (reg->idx[0].rel_addr) 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); sprintf(register_name, "%s_c[%s + %u]", prefix, rel_param0.param_str, reg->idx[0].offset);
else else
sprintf(register_name, "%s_c[%s]", prefix, rel_param0.param_str); sprintf(register_name, "%s_c[%s]", prefix, rel_param0.param_str);
......
...@@ -82,6 +82,7 @@ struct wined3d_settings wined3d_settings = ...@@ -82,6 +82,7 @@ struct wined3d_settings wined3d_settings =
TRUE, /* Multisampling enabled by default. */ TRUE, /* Multisampling enabled by default. */
FALSE, /* No strict draw ordering. */ FALSE, /* No strict draw ordering. */
TRUE, /* Don't try to render onscreen by default. */ 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 VS shader model limit by default. */
~0U, /* No GS shader model limit by default. */ ~0U, /* No GS shader model limit by default. */
~0U, /* No PS shader model limit by default. */ ~0U, /* No PS shader model limit by default. */
...@@ -302,6 +303,12 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) ...@@ -302,6 +303,12 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
TRACE("Not always rendering backbuffers offscreen.\n"); TRACE("Not always rendering backbuffers offscreen.\n");
wined3d_settings.always_offscreen = FALSE; 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)) 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); 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)) if (!get_config_key_dword(hkey, appkey, "MaxShaderModelGS", &wined3d_settings.max_sm_gs))
......
...@@ -278,6 +278,7 @@ struct wined3d_settings ...@@ -278,6 +278,7 @@ struct wined3d_settings
int allow_multisampling; int allow_multisampling;
BOOL strict_draw_ordering; BOOL strict_draw_ordering;
BOOL always_offscreen; BOOL always_offscreen;
BOOL check_float_constants;
unsigned int max_sm_vs; unsigned int max_sm_vs;
unsigned int max_sm_gs; unsigned int max_sm_gs;
unsigned int max_sm_ps; 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