d2d1: Query ID3D11Device1 interface in d2d_device_context_init.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49395
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-06-21 09:57:43 +02:00 committed by Alexandre Julliard
parent fd7954974b
commit 80ae670691
2 changed files with 12 additions and 1 deletions

View File

@ -27,7 +27,7 @@
#include <math.h>
#define COBJMACROS
#include "d2d1_2.h"
#include "d3d11.h"
#include "d3d11_1.h"
#ifdef D2D1_INIT_GUID
#include "initguid.h"
#endif
@ -162,6 +162,7 @@ struct d2d_device_context
ID2D1Factory *factory;
ID2D1Device *device;
ID3D10Device *d3d_device;
ID3D11Device1 *d3d11_device;
struct d2d_bitmap *target;
ID3D10StateBlock *stateblock;
struct d2d_shape_resources shape_resources[D2D_SHAPE_TYPE_COUNT];

View File

@ -287,6 +287,7 @@ static ULONG STDMETHODCALLTYPE d2d_device_context_inner_Release(IUnknown *iface)
context->stateblock->lpVtbl->Release(context->stateblock);
if (context->target)
ID2D1Bitmap1_Release(&context->target->ID2D1Bitmap1_iface);
ID3D11Device1_Release(context->d3d11_device);
ID3D10Device_Release(context->d3d_device);
ID2D1Factory_Release(context->factory);
ID2D1Device_Release(context->device);
@ -3850,6 +3851,13 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target,
return hr;
}
if (FAILED(hr = IDXGIDevice_QueryInterface(device_impl->dxgi_device,
&IID_ID3D11Device1, (void **)&render_target->d3d11_device)))
{
WARN("Failed to query ID3D11Device1 interface, hr %#x.\n", hr);
goto err;
}
if (FAILED(hr = D3D10StateBlockMaskEnableAll(&state_mask)))
{
WARN("Failed to create stateblock mask, hr %#x.\n", hr);
@ -4013,6 +4021,8 @@ err:
}
if (render_target->stateblock)
render_target->stateblock->lpVtbl->Release(render_target->stateblock);
if (render_target->d3d11_device)
ID3D11Device1_Release(render_target->d3d11_device);
if (render_target->d3d_device)
ID3D10Device_Release(render_target->d3d_device);
ID2D1Device_Release(render_target->device);