From: Ken Thomases <ken@codeweavers.com>
Subject: winemac: Disable software GL rendering unless it's enabled via a new registry setting, AllowSoftwareRendering.
Message-Id: <B1E50585-B14D-4EA1-AA06-1761F812BDD1@codeweavers.com>
Date: Mon, 21 Oct 2013 16:37:05 -0500


This more closely corresponds to how GLX behaves on Macs.

For <http://bugs.winehq.org/show_bug.cgi?id=34051>.
---
dlls/winemac.drv/macdrv.h      | 1 +
dlls/winemac.drv/macdrv_main.c | 4 ++++
dlls/winemac.drv/opengl.c      | 5 +++++
3 files changed, 10 insertions(+)

diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h
index 24c3f65..e64dbc6 100644
--- a/dlls/winemac.drv/macdrv.h
+++ b/dlls/winemac.drv/macdrv.h
@@ -38,6 +38,7 @@
 extern BOOL skip_single_buffer_flushes DECLSPEC_HIDDEN;
 extern BOOL allow_vsync DECLSPEC_HIDDEN;
 extern BOOL allow_set_gamma DECLSPEC_HIDDEN;
+extern BOOL allow_software_rendering DECLSPEC_HIDDEN;
 extern HMODULE macdrv_module DECLSPEC_HIDDEN;
 
 
diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c
index b86c8ae..df45bb5 100644
--- a/dlls/winemac.drv/macdrv_main.c
+++ b/dlls/winemac.drv/macdrv_main.c
@@ -52,6 +52,7 @@ BOOL allow_vsync = TRUE;
 BOOL allow_set_gamma = TRUE;
 int left_option_is_alt = 0;
 int right_option_is_alt = 0;
+BOOL allow_software_rendering = FALSE;
 HMODULE macdrv_module = 0;
 
 
@@ -176,6 +177,9 @@ static void setup_options(void)
     if (!get_config_key(hkey, appkey, "RightOptionIsAlt", buffer, sizeof(buffer)))
         right_option_is_alt = IS_OPTION_TRUE(buffer[0]);
 
+    if (!get_config_key(hkey, appkey, "AllowSoftwareRendering", buffer, sizeof(buffer)))
+        allow_software_rendering = IS_OPTION_TRUE(buffer[0]);
+
     if (appkey) RegCloseKey(appkey);
     if (hkey) RegCloseKey(hkey);
 }
diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c
index 1ae2744..16b79df 100644
--- a/dlls/winemac.drv/opengl.c
+++ b/dlls/winemac.drv/opengl.c
@@ -619,6 +619,11 @@ static void enum_renderer_pixel_formats(renderer_properties renderer, CFMutableA
         attribs[n++] = kCGLPFAAccelerated;
         attribs[n++] = kCGLPFANoRecovery;
     }
+    else if (!allow_software_rendering)
+    {
+        TRACE("ignoring software renderer because AllowSoftwareRendering is off\n");
+        return;
+    }
 
     n_stack[++n_stack_idx] = n;
     for (double_buffer = 0; double_buffer <= 1; double_buffer++)