wined3d: Add a setting to turn off aggressive optimization on NVIDIA.

NVIDIA drivers perform too aggressive optimization involving change
of computation order (aka 'fastmath') by default. The setting
helps to workaround bugs like https://bugs.winehq.org/show_bug.cgi?id=35207.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2019-02-26 22:39:03 +03:30 committed by Alexandre Julliard
parent 4826b77d71
commit 32b6ccb9c1
3 changed files with 7 additions and 0 deletions

View File

@ -2416,6 +2416,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
unsigned int i;
DWORD map;
if (wined3d_settings.strict_shader_math)
shader_addline(buffer, "#pragma optionNV(fastmath off)\n");
prefix = shader_glsl_get_prefix(version->type);
/* Prototype the subroutines */

View File

@ -82,6 +82,7 @@ struct wined3d_settings wined3d_settings =
TRUE, /* Prefer multisample textures to multisample renderbuffers. */
~0u, /* Don't force a specific sample count by default. */
FALSE, /* Don't range check relative addressing indices in float constants. */
FALSE, /* No strict shader math by default. */
~0U, /* No VS shader model limit by default. */
~0U, /* No HS shader model limit by default. */
~0U, /* No DS shader model limit by default. */
@ -312,6 +313,8 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
TRACE("Checking relative addressing indices in float constants.\n");
wined3d_settings.check_float_constants = TRUE;
}
if (!get_config_key_dword(hkey, appkey, "strict_shader_math", &wined3d_settings.strict_shader_math))
ERR_(winediag)("Setting strict shader math to %#x.\n", wined3d_settings.strict_shader_math);
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, "MaxShaderModelHS", &wined3d_settings.max_sm_hs))

View File

@ -398,6 +398,7 @@ struct wined3d_settings
unsigned int multisample_textures;
unsigned int sample_count;
BOOL check_float_constants;
unsigned int strict_shader_math;
unsigned int max_sm_vs;
unsigned int max_sm_hs;
unsigned int max_sm_ds;