From 2537d783b525e7ec2239b87b17916d15e0130add Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 1 Jun 2020 16:34:54 +1000
Subject: [PATCH] d3d11: Implement ID3D11Device2 GetImmediateContext1

Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=41636
---
 dlls/d3d11/device.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index a649be2f8ea..28100c2f9db 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -7174,9 +7174,24 @@ static void STDMETHODCALLTYPE d3d11_device_GetImmediateContext1(ID3D11Device2 *i
 static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeferredContext1(ID3D11Device2 *iface, UINT flags,
         ID3D11DeviceContext1 **context)
 {
-    FIXME("iface %p, flags %#x, context %p stub!\n", iface, flags, context);
+    struct d3d11_deferred_context *object;
 
-    return E_NOTIMPL;
+    TRACE("iface %p, flags %#x, context %p.\n", iface, flags, context);
+
+    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+        return E_OUTOFMEMORY;
+
+    object->ID3D11DeviceContext1_iface.lpVtbl = &d3d11_deferred_context_vtbl;
+    object->device = (ID3D11Device *)iface;
+    object->refcount = 1;
+
+    list_init(&object->commands);
+
+    ID3D11Device2_AddRef(iface);
+    wined3d_private_store_init(&object->private_store);
+
+    return ID3D11DeviceContext1_QueryInterface(&object->ID3D11DeviceContext1_iface,
+            &IID_ID3D11DeviceContext, (void**)context);
 }
 
 static HRESULT STDMETHODCALLTYPE d3d11_device_CreateBlendState1(ID3D11Device2 *iface,
-- 
2.26.2

