Nikolay Sivov : d3d11: Implement d3d11_device_GetImmediateContext1().

Alexandre Julliard julliard at winehq.org
Wed May 15 14:32:20 CDT 2019


Module: wine
Branch: stable
Commit: 4e8dc0577c87f2cae76122de2ad7b3e05e8053d8
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4e8dc0577c87f2cae76122de2ad7b3e05e8053d8

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Jan 23 08:21:33 2019 +0300

d3d11: Implement d3d11_device_GetImmediateContext1().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46298
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 9ede653d0dd1ae9db2bf8df13ae5ce99a36a7766)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/d3d11/device.c      | 10 ++++++++--
 dlls/d3d11/tests/d3d11.c | 14 ++++++++------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index df754de..7ad3d9b 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -3648,9 +3648,15 @@ static UINT STDMETHODCALLTYPE d3d11_device_GetExceptionMode(ID3D11Device2 *iface
     return 0;
 }
 
-static void STDMETHODCALLTYPE d3d11_device_GetImmediateContext1(ID3D11Device2 *iface, ID3D11DeviceContext1 **context)
+static void STDMETHODCALLTYPE d3d11_device_GetImmediateContext1(ID3D11Device2 *iface,
+        ID3D11DeviceContext1 **immediate_context)
 {
-    FIXME("iface %p, context %p stub!\n", iface, context);
+    struct d3d_device *device = impl_from_ID3D11Device2(iface);
+
+    TRACE("iface %p, immediate_context %p.\n", iface, immediate_context);
+
+    *immediate_context = &device->immediate_context.ID3D11DeviceContext1_iface;
+    ID3D11DeviceContext1_AddRef(*immediate_context);
 }
 
 static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeferredContext1(ID3D11Device2 *iface, UINT flags,
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 3efba83..3c870c2 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -6439,12 +6439,7 @@ static void test_device_context_state(void)
 
     feature_level = ID3D11Device1_GetFeatureLevel(device);
     ID3D11Device1_GetImmediateContext1(device, &context);
-    todo_wine ok(!!context, "Failed to get immediate context.\n");
-    if (!context)
-    {
-        ID3D11Device1_Release(device);
-        return;
-    }
+    ok(!!context, "Failed to get immediate context.\n");
 
     sampler_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
     sampler_desc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
@@ -6471,7 +6466,14 @@ static void test_device_context_state(void)
     feature_level = min(feature_level, D3D_FEATURE_LEVEL_10_1);
     hr = ID3D11Device1_CreateDeviceContextState(device, 0, &feature_level, 1, D3D11_SDK_VERSION,
             &IID_ID3D10Device, NULL, &context_state);
+todo_wine
     ok(SUCCEEDED(hr), "Failed to create device context state, hr %#x.\n", hr);
+    if (FAILED(hr))
+    {
+        ID3D11SamplerState_Release(sampler);
+        ID3D11Device1_Release(device);
+        return;
+    }
     refcount = get_refcount(context_state);
     ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount);
 




More information about the wine-cvs mailing list