wined3d: Only create a swapchain context array for GL swapchains.
authorHenri Verbeet <hverbeet@codeweavers.com>
Fri, 8 Apr 2011 12:30:59 +0000 (14:30 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Fri, 8 Apr 2011 12:40:39 +0000 (14:40 +0200)
Lying about the number of contexts a swapchain has isn't very useful.

dlls/wined3d/swapchain.c

index 1c875bf1d666038416d9267029a4fd68eb74b548..ddd946da1de6f0859a795185072a9426a200574f 100644 (file)
@@ -1043,15 +1043,6 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
         displaymode_set = TRUE;
     }
 
-    swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(swapchain->context));
-    if (!swapchain->context)
-    {
-        ERR("Failed to create the context array.\n");
-        hr = E_OUTOFMEMORY;
-        goto err;
-    }
-    swapchain->num_contexts = 1;
-
     if (surface_type == SURFACE_OPENGL)
     {
         static const enum wined3d_format_id formats[] =
@@ -1065,6 +1056,15 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
 
         const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
 
+        swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(swapchain->context));
+        if (!swapchain->context)
+        {
+            ERR("Failed to create the context array.\n");
+            hr = E_OUTOFMEMORY;
+            goto err;
+        }
+        swapchain->num_contexts = 1;
+
         /* In WGL both color, depth and stencil are features of a pixel format. In case of D3D they are separate.
          * You are able to add a depth + stencil surface at a later stage when you need it.
          * In order to support this properly in WineD3D we need the ability to recreate the opengl context and
@@ -1099,10 +1099,6 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
         }
         context_release(swapchain->context[0]);
     }
-    else
-    {
-        swapchain->context[0] = NULL;
-    }
 
     if (swapchain->presentParms.BackBufferCount > 0)
     {