[PATCH 08/10] wined3d: Get rid of the current multisampling support.

Henri Verbeet hverbeet at codeweavers.com
Thu Aug 25 14:05:02 CDT 2011


It doesn't really work, and trying to make multisampling work with onscreen
rendering is probably more trouble than it's worth, both for us and the
driver.
---
 dlls/wined3d/context.c      |   29 ++++------------
 dlls/wined3d/directx.c      |   78 -------------------------------------------
 dlls/wined3d/wined3d_main.c |    2 +-
 3 files changed, 8 insertions(+), 101 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index a5f5861..b1c2f50 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1066,7 +1066,7 @@ void context_invalidate_state(struct wined3d_context *context, DWORD state)
 /* This function takes care of wined3d pixel format selection. */
 static int context_choose_pixel_format(struct wined3d_device *device, HDC hdc,
         const struct wined3d_format *color_format, const struct wined3d_format *ds_format,
-        BOOL auxBuffers, int numSamples, BOOL findCompatible)
+        BOOL auxBuffers, BOOL findCompatible)
 {
     int iPixelFormat=0;
     unsigned int matchtry;
@@ -1099,9 +1099,9 @@ static int context_choose_pixel_format(struct wined3d_device *device, HDC hdc,
     int i = 0;
     int nCfgs = device->adapter->nCfgs;
 
-    TRACE("ColorFormat=%s, DepthStencilFormat=%s, auxBuffers=%d, numSamples=%d, findCompatible=%d\n",
-          debug_d3dformat(color_format->id), debug_d3dformat(ds_format->id),
-          auxBuffers, numSamples, findCompatible);
+    TRACE("device %p, dc %p, color_format %s, ds_format %s, aux_buffers %#x, find_compatible %#x.\n",
+            device, hdc, debug_d3dformat(color_format->id), debug_d3dformat(ds_format->id),
+            auxBuffers, findCompatible);
 
     if (!getColorBits(color_format, &redBits, &greenBits, &blueBits, &alphaBits, &colorBits))
     {
@@ -1171,7 +1171,7 @@ static int context_choose_pixel_format(struct wined3d_device *device, HDC hdc,
                 continue;
 
             /* Check multisampling support */
-            if(cfg->numSamples != numSamples)
+            if (cfg->numSamples)
                 continue;
 
             /* When we have passed all the checks then we have found a format which matches our
@@ -1236,7 +1236,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     struct wined3d_context *ret;
     PIXELFORMATDESCRIPTOR pfd;
     BOOL auxBuffers = FALSE;
-    int numSamples = 0;
     int pixel_format;
     unsigned int s;
     int swap_interval;
@@ -1287,28 +1286,14 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     if (color_format->id == WINED3DFMT_P8_UINT)
         color_format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM);
 
-    /* D3D only allows multisampling when SwapEffect is set to WINED3DSWAPEFFECT_DISCARD. */
-    if (swapchain->presentParms.MultiSampleType && (swapchain->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD))
-    {
-        if (!gl_info->supported[ARB_MULTISAMPLE])
-            WARN("The application is requesting multisampling without support.\n");
-        else
-        {
-            TRACE("Requesting multisample type %#x.\n", swapchain->presentParms.MultiSampleType);
-            numSamples = swapchain->presentParms.MultiSampleType;
-        }
-    }
-
     /* Try to find a pixel format which matches our requirements. */
-    pixel_format = context_choose_pixel_format(device, hdc, color_format, ds_format,
-            auxBuffers, numSamples, FALSE /* findCompatible */);
+    pixel_format = context_choose_pixel_format(device, hdc, color_format, ds_format, auxBuffers, FALSE);
 
     /* Try to locate a compatible format if we weren't able to find anything. */
     if (!pixel_format)
     {
         TRACE("Trying to locate a compatible pixel format because an exact match failed.\n");
-        pixel_format = context_choose_pixel_format(device, hdc, color_format, ds_format,
-                auxBuffers, 0 /* numSamples */, TRUE /* findCompatible */);
+        pixel_format = context_choose_pixel_format(device, hdc, color_format, ds_format, auxBuffers, TRUE);
     }
 
     /* If we still don't have a pixel format, something is very wrong as ChoosePixelFormat barely fails */
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index a43dc9f..5887000 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -3127,9 +3127,6 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3
         WINED3DDEVTYPE device_type, enum wined3d_format_id surface_format_id, BOOL windowed,
         WINED3DMULTISAMPLE_TYPE multisample_type, DWORD *quality_levels)
 {
-    const struct wined3d_adapter *adapter;
-    const struct wined3d_format *format;
-
     TRACE_(d3d_caps)("wined3d %p, adapter_idx %u, device_type %s, surface_format %s,\n"
             "windowed %#x, multisample_type %#x, quality_levels %p.\n",
             wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(surface_format_id),
@@ -3138,87 +3135,12 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3
     if (adapter_idx >= wined3d->adapter_count)
         return WINED3DERR_INVALIDCALL;
 
-    /* TODO: Handle windowed, add more quality levels. */
-
     if (WINED3DMULTISAMPLE_NONE == multisample_type)
     {
         if (quality_levels) *quality_levels = 1;
         return WINED3D_OK;
     }
 
-    /* By default multisampling is disabled right now as it causes issues
-     * on some Nvidia driver versions and it doesn't work well in combination
-     * with FBOs yet. */
-    if (!wined3d_settings.allow_multisampling)
-        return WINED3DERR_NOTAVAILABLE;
-
-    adapter = &wined3d->adapters[adapter_idx];
-    format = wined3d_get_format(&adapter->gl_info, surface_format_id);
-    if (!format) return WINED3DERR_INVALIDCALL;
-
-    if (format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
-    {
-        const struct wined3d_pixel_format *cfgs;
-        unsigned int i, cfg_count;
-
-        cfgs = adapter->cfgs;
-        cfg_count = adapter->nCfgs;
-        for (i = 0; i < cfg_count; ++i)
-        {
-            if(cfgs[i].numSamples != multisample_type)
-                continue;
-
-            if (!wined3d_check_pixel_format_depth(&adapter->gl_info, &cfgs[i], format))
-                continue;
-
-            TRACE("Found pixel format %u to support multisample_type %#x for format %s.\n",
-                    cfgs[i].iPixelFormat, multisample_type, debug_d3dformat(surface_format_id));
-
-            if (quality_levels) *quality_levels = 1;
-
-            return WINED3D_OK;
-        }
-    }
-    else if (format->flags & WINED3DFMT_FLAG_RENDERTARGET)
-    {
-        BYTE redSize, greenSize, blueSize, alphaSize, colorBits;
-        const struct wined3d_pixel_format *cfgs;
-        unsigned int i, cfg_count;
-
-        if (!getColorBits(format, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits))
-        {
-            ERR("Unable to get color bits for format %s, can't check multisampling capability.\n",
-                    debug_d3dformat(surface_format_id));
-            return WINED3DERR_NOTAVAILABLE;
-        }
-
-        cfgs = adapter->cfgs;
-        cfg_count = adapter->nCfgs;
-        for (i = 0; i < cfg_count; ++i)
-        {
-            if(cfgs[i].numSamples != multisample_type)
-                continue;
-            if(cfgs[i].redSize != redSize)
-                continue;
-            if(cfgs[i].greenSize != greenSize)
-                continue;
-            if(cfgs[i].blueSize != blueSize)
-                continue;
-            /* Not all drivers report alpha-less formats since they use 32-bit
-             * anyway, so accept alpha even if we didn't ask for it. */
-            if(alphaSize && cfgs[i].alphaSize != alphaSize)
-                continue;
-            if (cfgs[i].colorSize != (format->byte_count << 3))
-                continue;
-
-            TRACE("Found pixel format %u to support multisample_type %#x for format %s.\n",
-                    cfgs[i].iPixelFormat, multisample_type, debug_d3dformat(surface_format_id));
-
-            if (quality_levels) *quality_levels = 1;
-
-            return WINED3D_OK;
-        }
-    }
     return WINED3DERR_NOTAVAILABLE;
 }
 
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 06af5b1..da6aa2a 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -84,7 +84,7 @@ struct wined3d_settings wined3d_settings =
     PCI_DEVICE_NONE,/* PCI Device ID */
     0,              /* The default of memory is set in init_driver_info */
     NULL,           /* No wine logo by default */
-    FALSE,          /* Disable multisampling for now due to Nvidia driver bugs which happens for some users */
+    FALSE,          /* Multisampling disabled by default. */
     FALSE,          /* No strict draw ordering. */
     FALSE,          /* Try to render onscreen by default. */
 };
-- 
1.7.3.4




More information about the wine-patches mailing list