From 20c5727bab6314d9d788f5b782cf8f5d1b6fc281 Mon Sep 17 00:00:00 2001
From: Austin English <austinenglish@gmail.com>
Date: Sat, 28 Feb 2015 00:34:07 +0100
Subject: wined3d: Allow to specify multisampling AA quality levels via
 registry.

---
 dlls/wined3d/directx.c         |  7 ++++++-
 dlls/wined3d/wined3d_main.c    | 12 ++++++++++++
 dlls/wined3d/wined3d_private.h |  1 +
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 019b415..b9eb03c 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -4404,7 +4404,12 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3
 
     if (quality_levels)
     {
-        if (multisample_type == WINED3D_MULTISAMPLE_NON_MASKABLE)
+        if (wined3d_settings.msaa_quality_levels)
+        {
+            *quality_levels = wined3d_settings.msaa_quality_levels;
+            TRACE("Overriding MSAA quality levels to %i\n", *quality_levels);
+        }
+        else if (multisample_type == WINED3D_MULTISAMPLE_NON_MASKABLE)
             *quality_levels = gl_info->limits.samples;
         else
             *quality_levels = 1;
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 0543d97..c985c2d 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -77,6 +77,7 @@ struct wined3d_settings wined3d_settings =
     ORM_FBO,        /* Use FBOs to do offscreen rendering */
     PCI_VENDOR_NONE,/* PCI Vendor ID */
     PCI_DEVICE_NONE,/* PCI Device ID */
+    0,              /* Multisampling AA Quality Levels */
     0,              /* The default of memory is set in init_driver_info */
     NULL,           /* No wine logo by default */
     TRUE,           /* Multisampling enabled by default. */
@@ -261,6 +262,17 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
                 wined3d_settings.pci_vendor_id = pci_vendor_id;
             }
         }
+        if (!get_config_key( hkey, appkey, "MultisamplingAAQualityLevels", buffer, size ))
+        {
+            int quality_levels = atoi(buffer);
+            if(quality_levels > 0)
+            {
+                wined3d_settings.msaa_quality_levels = quality_levels;
+                TRACE("Setting MultisamplingAAQualityLevels to %i\n", quality_levels);
+            }
+            else
+                ERR("MultisamplingAAQualityLevels is %i but must be >0\n", quality_levels);
+        }
         if ( !get_config_key( hkey, appkey, "VideoMemorySize", buffer, size) )
         {
             int TmpVideoMemorySize = atoi(buffer);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7847557..9e39dd7 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -268,6 +268,7 @@ struct wined3d_settings
     unsigned short pci_vendor_id;
     unsigned short pci_device_id;
     /* Memory tracking and object counting. */
+    unsigned int msaa_quality_levels;
     UINT64 emulated_textureram;
     char *logo;
     int allow_multisampling;
-- 
2.5.0

