From 186113109069bd9381093f9f9f5048437ac0e1b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Fri, 23 Oct 2015 02:38:14 +0200 Subject: [PATCH] d3d11: Do not store ID3D11Device pointer in d3d11_immediate_context. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d11/d3d11_private.h | 1 - dlls/d3d11/device.c | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h index b8df6098bd9..b8d134059b8 100644 --- a/dlls/d3d11/d3d11_private.h +++ b/dlls/d3d11/d3d11_private.h @@ -370,7 +370,6 @@ struct d3d11_immediate_context { ID3D11DeviceContext ID3D11DeviceContext_iface; LONG refcount; - ID3D11Device *device; }; /* ID3D11Device, ID3D10Device1 */ diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index e031e24156f..5650e1d8860 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -67,13 +67,14 @@ static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_QueryInterface(ID3D11De static ULONG STDMETHODCALLTYPE d3d11_immediate_context_AddRef(ID3D11DeviceContext *iface) { struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext(iface); + struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface); ULONG refcount = InterlockedIncrement(&context->refcount); TRACE("%p increasing refcount to %u.\n", context, refcount); if (refcount == 1) { - ID3D11Device_AddRef(context->device); + ID3D11Device_AddRef(&device->ID3D11Device_iface); } return refcount; @@ -82,13 +83,14 @@ static ULONG STDMETHODCALLTYPE d3d11_immediate_context_AddRef(ID3D11DeviceContex static ULONG STDMETHODCALLTYPE d3d11_immediate_context_Release(ID3D11DeviceContext *iface) { struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext(iface); + struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface); ULONG refcount = InterlockedDecrement(&context->refcount); TRACE("%p decreasing refcount to %u.\n", context, refcount); if (!refcount) { - ID3D11Device_Release(context->device); + ID3D11Device_Release(&device->ID3D11Device_iface); } return refcount; @@ -96,11 +98,11 @@ static ULONG STDMETHODCALLTYPE d3d11_immediate_context_Release(ID3D11DeviceConte static void STDMETHODCALLTYPE d3d11_immediate_context_GetDevice(ID3D11DeviceContext *iface, ID3D11Device **device) { - struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext(iface); + struct d3d_device *device_object = device_from_immediate_ID3D11DeviceContext(iface); TRACE("iface %p, device %p.\n", iface, device); - *device = context->device; + *device = &device_object->ID3D11Device_iface; ID3D11Device_AddRef(*device); } @@ -1057,8 +1059,7 @@ static HRESULT d3d11_immediate_context_init(struct d3d11_immediate_context *cont context->ID3D11DeviceContext_iface.lpVtbl = &d3d11_immediate_context_vtbl; context->refcount = 1; - context->device = &device->ID3D11Device_iface; - ID3D11Device_AddRef(context->device); + ID3D11Device_AddRef(&device->ID3D11Device_iface); return S_OK; }