Module: wine Branch: master Commit: 88c5ddaae79a2965dcc9b33c69d7387d623e3e70 URL: http://source.winehq.org/git/wine.git/?a=commit;h=88c5ddaae79a2965dcc9b33c69... Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Tue Mar 29 12:14:51 2016 +0200 d3d11: Implement private data methods for immediate ID3D11DeviceContext. Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d11/d3d11_private.h | 2 ++ dlls/d3d11/device.c | 34 +++++++++++++++++++++------------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h index 80a16f3..655bae5 100644 --- a/dlls/d3d11/d3d11_private.h +++ b/dlls/d3d11/d3d11_private.h @@ -385,6 +385,8 @@ struct d3d11_immediate_context { ID3D11DeviceContext ID3D11DeviceContext_iface; LONG refcount; + + struct wined3d_private_store private_store; }; /* ID3D11Device, ID3D10Device1 */ diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 5498c8b..e1bfb70 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -109,25 +109,31 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_GetDevice(ID3D11DeviceCont static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_GetPrivateData(ID3D11DeviceContext *iface, REFGUID guid, UINT *data_size, void *data) { - FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data); + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext(iface); - return E_NOTIMPL; + TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data); + + return d3d_get_private_data(&context->private_store, guid, data_size, data); } static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_SetPrivateData(ID3D11DeviceContext *iface, REFGUID guid, UINT data_size, const void *data) { - FIXME("iface %p, guid %s, data_size %u, data %p stub!\n", iface, debugstr_guid(guid), data_size, data); + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext(iface); - return E_NOTIMPL; + TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data); + + return d3d_set_private_data(&context->private_store, guid, data_size, data); } static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_SetPrivateDataInterface(ID3D11DeviceContext *iface, REFGUID guid, const IUnknown *data) { - FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data); + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext(iface); - return E_NOTIMPL; + TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data); + + return d3d_set_private_data_interface(&context->private_store, guid, data); } static void STDMETHODCALLTYPE d3d11_immediate_context_VSSetConstantBuffers(ID3D11DeviceContext *iface, @@ -1919,14 +1925,19 @@ static const struct ID3D11DeviceContextVtbl d3d11_immediate_context_vtbl = d3d11_immediate_context_FinishCommandList, }; -static HRESULT d3d11_immediate_context_init(struct d3d11_immediate_context *context, struct d3d_device *device) +static void d3d11_immediate_context_init(struct d3d11_immediate_context *context, struct d3d_device *device) { context->ID3D11DeviceContext_iface.lpVtbl = &d3d11_immediate_context_vtbl; context->refcount = 1; ID3D11Device_AddRef(&device->ID3D11Device_iface); - return S_OK; + wined3d_private_store_init(&context->private_store); +} + +static void d3d11_immediate_context_destroy(struct d3d11_immediate_context *context) +{ + wined3d_private_store_cleanup(&context->private_store); } /* ID3D11Device methods */ @@ -2777,6 +2788,7 @@ static ULONG STDMETHODCALLTYPE d3d_device_inner_Release(IUnknown *iface) if (!refcount) { + d3d11_immediate_context_destroy(&device->immediate_context); if (device->wined3d_device) { wined3d_mutex_lock(); @@ -5110,11 +5122,7 @@ HRESULT d3d_device_init(struct d3d_device *device, void *outer_unknown) /* COM aggregation always takes place */ device->outer_unk = outer_unknown; - if (FAILED(d3d11_immediate_context_init(&device->immediate_context, device))) - { - WARN("Failed to initialize immediate device context.\n"); - return E_FAIL; - } + d3d11_immediate_context_init(&device->immediate_context, device); ID3D11DeviceContext_Release(&device->immediate_context.ID3D11DeviceContext_iface); if (wine_rb_init(&device->blend_states, &d3d_blend_state_rb_ops) == -1)