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

Alexandre Julliard julliard at winehq.org
Tue Feb 26 15:13:57 CST 2019


Module: wine
Branch: master
Commit: 32b6ccb9c17b0d4c1d9acd6cbb91b28e7cbd97de
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=32b6ccb9c17b0d4c1d9acd6cbb91b28e7cbd97de

Author: Paul Gofman <gofmanp at gmail.com>
Date:   Tue Feb 26 22:57:03 2019 +0330

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/glsl_shader.c     | 3 +++
 dlls/wined3d/wined3d_main.c    | 3 +++
 dlls/wined3d/wined3d_private.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 660005f..4613d78 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -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 */
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 1b64d2c..fb70b94 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -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))
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b3f3847..f2b9b5f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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;




More information about the wine-cvs mailing list