Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49395 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/d2d1/bitmap.c | 43 +++++++-------------- dlls/d2d1/brush.c | 34 ++++++----------- dlls/d2d1/d2d1_private.h | 15 +++----- dlls/d2d1/dc_render_target.c | 2 +- dlls/d2d1/device.c | 73 +++++++++++++++--------------------- dlls/d2d1/tests/d2d1.c | 5 +-- 6 files changed, 62 insertions(+), 110 deletions(-)
diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c index 43c1b6f8d44..470724e96a9 100644 --- a/dlls/d2d1/bitmap.c +++ b/dlls/d2d1/bitmap.c @@ -67,18 +67,12 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_Release(ID2D1Bitmap1 *iface) if (!refcount) { if (bitmap->srv) - ID3D10ShaderResourceView_Release(bitmap->srv); - if (bitmap->d3d11_srv) - ID3D11ShaderResourceView_Release(bitmap->d3d11_srv); + ID3D11ShaderResourceView_Release(bitmap->srv); if (bitmap->rtv) - ID3D10RenderTargetView_Release(bitmap->rtv); - if (bitmap->d3d11_rtv) - ID3D11RenderTargetView_Release(bitmap->d3d11_rtv); + ID3D11RenderTargetView_Release(bitmap->rtv); if (bitmap->surface) IDXGISurface_Release(bitmap->surface); - if (bitmap->d3d11_resource) - ID3D11Resource_Release(bitmap->d3d11_resource); - ID3D10Resource_Release(bitmap->resource); + ID3D11Resource_Release(bitmap->resource); ID2D1Factory_Release(bitmap->factory); heap_free(bitmap); } @@ -172,9 +166,9 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_CopyFromMemory(ID2D1Bitmap1 *iface, box.back = 1; }
- ID3D11Resource_GetDevice(bitmap->d3d11_resource, &device); + ID3D11Resource_GetDevice(bitmap->resource, &device); ID3D11Device_GetImmediateContext(device, &context); - ID3D11DeviceContext_UpdateSubresource(context, bitmap->d3d11_resource, 0, dst_rect ? &box : NULL, src_data, pitch, 0); + ID3D11DeviceContext_UpdateSubresource(context, bitmap->resource, 0, dst_rect ? &box : NULL, src_data, pitch, 0); ID3D11DeviceContext_Release(context); ID3D11Device_Release(device);
@@ -281,18 +275,13 @@ static BOOL format_supported(const D2D1_PIXEL_FORMAT *format) static void d2d_bitmap_init(struct d2d_bitmap *bitmap, struct d2d_device_context *context, ID3D11Resource *resource, D2D1_SIZE_U size, const D2D1_BITMAP_PROPERTIES1 *desc) { - ID3D10Resource *d3d10_resource; ID3D11Device *d3d_device; HRESULT hr;
- if (FAILED(hr = ID3D11Resource_QueryInterface(resource, &IID_ID3D10Resource, (void **)&d3d10_resource))) - WARN("Failed to query ID3D10Resource interface, hr %#x.\n", hr); - bitmap->ID2D1Bitmap1_iface.lpVtbl = &d2d_bitmap_vtbl; bitmap->refcount = 1; ID2D1Factory_AddRef(bitmap->factory = context->factory); - ID3D11Resource_AddRef(bitmap->d3d11_resource = resource); - bitmap->resource = d3d10_resource; + ID3D11Resource_AddRef(bitmap->resource = resource); bitmap->pixel_size = size; bitmap->format = desc->pixelFormat; bitmap->dpi_x = desc->dpiX; @@ -305,20 +294,14 @@ static void d2d_bitmap_init(struct d2d_bitmap *bitmap, struct d2d_device_context ID3D11Resource_GetDevice(resource, &d3d_device); if (bitmap->options & D2D1_BITMAP_OPTIONS_TARGET) { - if (FAILED(hr = ID3D11Device_CreateRenderTargetView(d3d_device, resource, NULL, &bitmap->d3d11_rtv))) + if (FAILED(hr = ID3D11Device_CreateRenderTargetView(d3d_device, resource, NULL, &bitmap->rtv))) WARN("Failed to create RTV, hr %#x.\n", hr); - if (FAILED(hr = ID3D11RenderTargetView_QueryInterface(bitmap->d3d11_rtv, &IID_ID3D10RenderTargetView, - (void **)&bitmap->rtv))) - WARN("Failed to query D3D10 RTV interface, hr %#x.\n", hr); }
if (!(bitmap->options & D2D1_BITMAP_OPTIONS_CANNOT_DRAW)) { - if (FAILED(hr = ID3D11Device_CreateShaderResourceView(d3d_device, resource, NULL, &bitmap->d3d11_srv))) + if (FAILED(hr = ID3D11Device_CreateShaderResourceView(d3d_device, resource, NULL, &bitmap->srv))) WARN("Failed to create SRV, hr %#x.\n", hr); - if (FAILED(hr = ID3D11ShaderResourceView_QueryInterface(bitmap->d3d11_srv, &IID_ID3D10ShaderResourceView, - (void **)&bitmap->srv))) - WARN("Failed to query D3D10 SRV interface, hr %#x.\n", hr); } ID3D11Device_Release(d3d_device);
@@ -380,7 +363,7 @@ HRESULT d2d_bitmap_create(struct d2d_device_context *context, D2D1_SIZE_U size, resource_data.pSysMem = src_data; resource_data.SysMemPitch = pitch;
- if (FAILED(hr = ID3D11Device1_CreateTexture2D(context->d3d11_device, &texture_desc, + if (FAILED(hr = ID3D11Device1_CreateTexture2D(context->d3d_device, &texture_desc, src_data ? &resource_data : NULL, &texture))) { ERR("Failed to create texture, hr %#x.\n", hr); @@ -414,9 +397,9 @@ HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid, goto failed; }
- ID3D11Resource_GetDevice(src_impl->d3d11_resource, &device); + ID3D11Resource_GetDevice(src_impl->resource, &device); ID3D11Device_Release(device); - if (device != (ID3D11Device *)context->d3d11_device) + if (device != (ID3D11Device *)context->d3d_device) { hr = D2DERR_UNSUPPORTED_OPERATION; goto failed; @@ -446,7 +429,7 @@ HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid, goto failed; }
- d2d_bitmap_init(*bitmap, context, src_impl->d3d11_resource, src_impl->pixel_size, desc); + d2d_bitmap_init(*bitmap, context, src_impl->resource, src_impl->pixel_size, desc); TRACE("Created bitmap %p.\n", *bitmap);
failed: @@ -470,7 +453,7 @@ HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid,
ID3D11Resource_GetDevice(resource, &device); ID3D11Device_Release(device); - if (device != (ID3D11Device *)context->d3d11_device) + if (device != (ID3D11Device *)context->d3d_device) { ID3D11Resource_Release(resource); return D2DERR_UNSUPPORTED_OPERATION; diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index 398ba80dd8b..38afbe83752 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -65,8 +65,7 @@ static ULONG STDMETHODCALLTYPE d2d_gradient_Release(ID2D1GradientStopCollection if (!refcount) { heap_free(gradient->stops); - ID3D11ShaderResourceView_Release(gradient->d3d11_view); - ID3D10ShaderResourceView_Release(gradient->view); + ID3D11ShaderResourceView_Release(gradient->view); ID2D1Factory_Release(gradient->factory); heap_free(gradient); } @@ -132,9 +131,8 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D11Device1 *device, const UINT32 stop_count, D2D1_GAMMA gamma, D2D1_EXTEND_MODE extend_mode, struct d2d_gradient **out) { D3D11_SHADER_RESOURCE_VIEW_DESC srv_desc; - ID3D11ShaderResourceView *d3d11_view; D3D11_SUBRESOURCE_DATA buffer_data; - ID3D10ShaderResourceView *view; + ID3D11ShaderResourceView *view; struct d2d_gradient *gradient; D3D11_BUFFER_DESC buffer_desc; struct d2d_vec4 *data; @@ -181,7 +179,7 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D11Device1 *device, const srv_desc.Buffer.ElementOffset = 0; srv_desc.Buffer.ElementWidth = 2 * stop_count;
- hr = ID3D11Device1_CreateShaderResourceView(device, (ID3D11Resource *)buffer, &srv_desc, &d3d11_view); + hr = ID3D11Device1_CreateShaderResourceView(device, (ID3D11Resource *)buffer, &srv_desc, &view); ID3D11Buffer_Release(buffer); if (FAILED(hr)) { @@ -189,17 +187,9 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D11Device1 *device, const return hr; }
- if (FAILED(hr = ID3D11ShaderResourceView_QueryInterface(d3d11_view, &IID_ID3D10ShaderResourceView, (void **)&view))) - { - ERR("Failed to query D3D10 view, hr %#x.\n", hr); - ID3D11ShaderResourceView_Release(d3d11_view); - return hr; - } - if (!(gradient = heap_alloc_zero(sizeof(*gradient)))) { - ID3D10ShaderResourceView_Release(view); - ID3D11ShaderResourceView_Release(d3d11_view); + ID3D11ShaderResourceView_Release(view); return E_OUTOFMEMORY; }
@@ -212,13 +202,11 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D11Device1 *device, const gradient->refcount = 1; ID2D1Factory_AddRef(gradient->factory = factory); gradient->view = view; - gradient->d3d11_view = d3d11_view;
gradient->stop_count = stop_count; if (!(gradient->stops = heap_calloc(stop_count, sizeof(*stops)))) { - ID3D10ShaderResourceView_Release(view); - ID3D11ShaderResourceView_Release(d3d11_view); + ID3D11ShaderResourceView_Release(view); heap_free(gradient); return E_OUTOFMEMORY; } @@ -241,7 +229,7 @@ static void d2d_gradient_bind(struct d2d_gradient *gradient, ID3D11Device1 *devi { ID3D11DeviceContext *context; ID3D11Device1_GetImmediateContext(device, &context); - ID3D11DeviceContext_PSSetShaderResources(context, 2 + brush_idx, 1, &gradient->d3d11_view); + ID3D11DeviceContext_PSSetShaderResources(context, 2 + brush_idx, 1, &gradient->view); ID3D11DeviceContext_Release(context); }
@@ -1263,8 +1251,8 @@ static void d2d_brush_bind_bitmap(struct d2d_brush *brush, struct d2d_device_con ID3D11DeviceContext *d3d_context; HRESULT hr;
- ID3D11Device1_GetImmediateContext(context->d3d11_device, &d3d_context); - ID3D11DeviceContext_PSSetShaderResources(d3d_context, brush_idx, 1, &brush->u.bitmap.bitmap->d3d11_srv); + ID3D11Device1_GetImmediateContext(context->d3d_device, &d3d_context); + ID3D11DeviceContext_PSSetShaderResources(d3d_context, brush_idx, 1, &brush->u.bitmap.bitmap->srv);
sampler_state = &context->sampler_states [brush->u.bitmap.interpolation_mode % D2D_SAMPLER_INTERPOLATION_MODE_COUNT] @@ -1292,7 +1280,7 @@ static void d2d_brush_bind_bitmap(struct d2d_brush *brush, struct d2d_device_con sampler_desc.MinLOD = 0.0f; sampler_desc.MaxLOD = 0.0f;
- if (FAILED(hr = ID3D11Device1_CreateSamplerState(context->d3d11_device, &sampler_desc, sampler_state))) + if (FAILED(hr = ID3D11Device1_CreateSamplerState(context->d3d_device, &sampler_desc, sampler_state))) ERR("Failed to create sampler state, hr %#x.\n", hr); }
@@ -1308,11 +1296,11 @@ void d2d_brush_bind_resources(struct d2d_brush *brush, struct d2d_device_context break;
case D2D_BRUSH_TYPE_LINEAR: - d2d_gradient_bind(brush->u.linear.gradient, context->d3d11_device, brush_idx); + d2d_gradient_bind(brush->u.linear.gradient, context->d3d_device, brush_idx); break;
case D2D_BRUSH_TYPE_RADIAL: - d2d_gradient_bind(brush->u.radial.gradient, context->d3d11_device, brush_idx); + d2d_gradient_bind(brush->u.radial.gradient, context->d3d_device, brush_idx); break;
case D2D_BRUSH_TYPE_BITMAP: diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 50710a7ebd9..f25a7809b17 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -161,8 +161,7 @@ struct d2d_device_context
ID2D1Factory *factory; ID2D1Device *device; - ID3D10Device *d3d_device; - ID3D11Device1 *d3d11_device; + ID3D11Device1 *d3d_device; ID3DDeviceContextState *d3d_state; struct d2d_bitmap *target; struct d2d_shape_resources shape_resources[D2D_SHAPE_TYPE_COUNT]; @@ -272,8 +271,7 @@ struct d2d_gradient LONG refcount;
ID2D1Factory *factory; - ID3D10ShaderResourceView *view; - ID3D11ShaderResourceView *d3d11_view; + ID3D11ShaderResourceView *view; D2D1_GRADIENT_STOP *stops; UINT32 stop_count; }; @@ -378,13 +376,10 @@ struct d2d_bitmap LONG refcount;
ID2D1Factory *factory; - ID3D10ShaderResourceView *srv; - ID3D11ShaderResourceView *d3d11_srv; - ID3D10RenderTargetView *rtv; - ID3D11RenderTargetView *d3d11_rtv; + ID3D11ShaderResourceView *srv; + ID3D11RenderTargetView *rtv; IDXGISurface *surface; - ID3D10Resource *resource; - ID3D11Resource *d3d11_resource; + ID3D11Resource *resource; D2D1_SIZE_U pixel_size; D2D1_PIXEL_FORMAT format; float dpi_x; diff --git a/dlls/d2d1/dc_render_target.c b/dlls/d2d1/dc_render_target.c index 47aa99697d7..099e3b0a3a2 100644 --- a/dlls/d2d1/dc_render_target.c +++ b/dlls/d2d1/dc_render_target.c @@ -715,7 +715,7 @@ static HRESULT STDMETHODCALLTYPE d2d_dc_render_target_BindDC(ID2D1DCRenderTarget }
bitmap_impl = unsafe_impl_from_ID2D1Bitmap(bitmap); - ID3D10Resource_QueryInterface(bitmap_impl->resource, &IID_IDXGISurface1, (void **)&dxgi_surface); + ID3D11Resource_QueryInterface(bitmap_impl->resource, &IID_IDXGISurface1, (void **)&dxgi_surface);
ID2D1DeviceContext_SetTarget(context, (ID2D1Image *)bitmap); ID2D1Bitmap_Release(bitmap); diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index e102290bd0a..3b444321c87 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -123,7 +123,7 @@ static void d2d_device_context_draw(struct d2d_device_context *render_target, en { struct d2d_shape_resources *shape_resources = &render_target->shape_resources[shape_type]; ID3DDeviceContextState *prev_state; - ID3D11Device1 *device = render_target->d3d11_device; + ID3D11Device1 *device = render_target->d3d_device; ID3D11DeviceContext1 *context; ID3D11Buffer *vs_cb = render_target->vs_cb, *ps_cb = render_target->ps_cb; D3D11_RECT scissor_rect; @@ -170,7 +170,7 @@ static void d2d_device_context_draw(struct d2d_device_context *render_target, en } ID3D11DeviceContext1_RSSetScissorRects(context, 1, &scissor_rect); ID3D11DeviceContext1_RSSetState(context, render_target->rs); - ID3D11DeviceContext1_OMSetRenderTargets(context, 1, &render_target->target->d3d11_rtv, NULL); + ID3D11DeviceContext1_OMSetRenderTargets(context, 1, &render_target->target->rtv, NULL); if (brush) { ID3D11DeviceContext1_OMSetBlendState(context, render_target->bs, NULL, D3D11_DEFAULT_SAMPLE_MASK); @@ -287,8 +287,7 @@ static ULONG STDMETHODCALLTYPE d2d_device_context_inner_Release(IUnknown *iface) ID3DDeviceContextState_Release(context->d3d_state); if (context->target) ID2D1Bitmap1_Release(&context->target->ID2D1Bitmap1_iface); - ID3D11Device1_Release(context->d3d11_device); - ID3D10Device_Release(context->d3d_device); + ID3D11Device1_Release(context->d3d_device); ID2D1Factory_Release(context->factory); ID2D1Device_Release(context->device); heap_free(context); @@ -457,7 +456,7 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateGradientStopCollection TRACE("iface %p, stops %p, stop_count %u, gamma %#x, extend_mode %#x, gradient %p.\n", iface, stops, stop_count, gamma, extend_mode, gradient);
- if (SUCCEEDED(hr = d2d_gradient_create(render_target->factory, render_target->d3d11_device, + if (SUCCEEDED(hr = d2d_gradient_create(render_target->factory, render_target->d3d_device, stops, stop_count, gamma, extend_mode, &object))) *gradient = &object->ID2D1GradientStopCollection_iface;
@@ -717,7 +716,7 @@ static HRESULT d2d_device_context_update_ps_cb(struct d2d_device_context *contex struct d2d_ps_cb *cb_data; HRESULT hr;
- ID3D11Device1_GetImmediateContext(context->d3d11_device, &d3d_context); + ID3D11Device1_GetImmediateContext(context->d3d_device, &d3d_context);
if (FAILED(hr = ID3D11DeviceContext_Map(d3d_context, (ID3D11Resource *)context->ps_cb, 0, D3D11_MAP_WRITE_DISCARD, 0, &map_desc))) @@ -753,7 +752,7 @@ static HRESULT d2d_device_context_update_vs_cb(struct d2d_device_context *contex float tmp_x, tmp_y; HRESULT hr;
- ID3D11Device1_GetImmediateContext(context->d3d11_device, &d3d_context); + ID3D11Device1_GetImmediateContext(context->d3d_device, &d3d_context);
if (FAILED(hr = ID3D11DeviceContext_Map(d3d_context, (ID3D11Resource *)context->vs_cb, 0, D3D11_MAP_WRITE_DISCARD, 0, &map_desc))) @@ -826,7 +825,7 @@ static void d2d_device_context_draw_geometry(struct d2d_device_context *render_t buffer_desc.BindFlags = D3D11_BIND_INDEX_BUFFER; buffer_data.pSysMem = geometry->outline.faces;
- if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, &buffer_desc, &buffer_data, &ib))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ib))) { WARN("Failed to create index buffer, hr %#x.\n", hr); return; @@ -836,7 +835,7 @@ static void d2d_device_context_draw_geometry(struct d2d_device_context *render_t buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer_data.pSysMem = geometry->outline.vertices;
- if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, &buffer_desc, &buffer_data, &vb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) { ERR("Failed to create vertex buffer, hr %#x.\n", hr); ID3D11Buffer_Release(ib); @@ -856,7 +855,7 @@ static void d2d_device_context_draw_geometry(struct d2d_device_context *render_t buffer_desc.BindFlags = D3D11_BIND_INDEX_BUFFER; buffer_data.pSysMem = geometry->outline.bezier_faces;
- if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, &buffer_desc, &buffer_data, &ib))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ib))) { WARN("Failed to create beziers index buffer, hr %#x.\n", hr); return; @@ -866,7 +865,7 @@ static void d2d_device_context_draw_geometry(struct d2d_device_context *render_t buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer_data.pSysMem = geometry->outline.beziers;
- if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, &buffer_desc, &buffer_data, &vb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) { ERR("Failed to create beziers vertex buffer, hr %#x.\n", hr); ID3D11Buffer_Release(ib); @@ -887,7 +886,7 @@ static void d2d_device_context_draw_geometry(struct d2d_device_context *render_t buffer_desc.BindFlags = D3D11_BIND_INDEX_BUFFER; buffer_data.pSysMem = geometry->outline.arc_faces;
- if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, &buffer_desc, &buffer_data, &ib))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ib))) { WARN("Failed to create arcs index buffer, hr %#x.\n", hr); return; @@ -897,7 +896,7 @@ static void d2d_device_context_draw_geometry(struct d2d_device_context *render_t buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer_data.pSysMem = geometry->outline.arcs;
- if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, &buffer_desc, &buffer_data, &vb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) { ERR("Failed to create arcs vertex buffer, hr %#x.\n", hr); ID3D11Buffer_Release(ib); @@ -963,7 +962,7 @@ static void d2d_device_context_fill_geometry(struct d2d_device_context *render_t buffer_desc.BindFlags = D3D11_BIND_INDEX_BUFFER; buffer_data.pSysMem = geometry->fill.faces;
- if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, &buffer_desc, &buffer_data, &ib))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ib))) { WARN("Failed to create index buffer, hr %#x.\n", hr); return; @@ -973,7 +972,7 @@ static void d2d_device_context_fill_geometry(struct d2d_device_context *render_t buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer_data.pSysMem = geometry->fill.vertices;
- if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, &buffer_desc, &buffer_data, &vb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) { ERR("Failed to create vertex buffer, hr %#x.\n", hr); ID3D11Buffer_Release(ib); @@ -993,7 +992,7 @@ static void d2d_device_context_fill_geometry(struct d2d_device_context *render_t buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer_data.pSysMem = geometry->fill.bezier_vertices;
- if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, &buffer_desc, &buffer_data, &vb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) { ERR("Failed to create beziers vertex buffer, hr %#x.\n", hr); return; @@ -1011,7 +1010,7 @@ static void d2d_device_context_fill_geometry(struct d2d_device_context *render_t buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer_data.pSysMem = geometry->fill.arc_vertices;
- if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, &buffer_desc, &buffer_data, &vb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) { ERR("Failed to create arc vertex buffer, hr %#x.\n", hr); return; @@ -1627,7 +1626,7 @@ static void STDMETHODCALLTYPE d2d_device_context_Clear(ID2D1DeviceContext *iface
TRACE("iface %p, colour %p.\n", iface, colour);
- ID3D11Device1_GetImmediateContext(render_target->d3d11_device, &d3d_context); + ID3D11Device1_GetImmediateContext(render_target->d3d_device, &d3d_context);
if (FAILED(hr = ID3D11DeviceContext_Map(d3d_context, (ID3D11Resource *)render_target->vs_cb, 0, D3D11_MAP_WRITE_DISCARD, 0, &map_desc))) @@ -1782,7 +1781,7 @@ static UINT32 STDMETHODCALLTYPE d2d_device_context_GetMaximumBitmapSize(ID2D1Dev { TRACE("iface %p.\n", iface);
- return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; + return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; }
static BOOL STDMETHODCALLTYPE d2d_device_context_IsSupported(ID2D1DeviceContext *iface, @@ -2071,7 +2070,7 @@ static void STDMETHODCALLTYPE d2d_device_context_SetTarget(ID2D1DeviceContext *i } blend_desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; blend_desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; - if (FAILED(hr = ID3D11Device1_CreateBlendState(context->d3d11_device, &blend_desc, &context->bs))) + if (FAILED(hr = ID3D11Device1_CreateBlendState(context->d3d_device, &blend_desc, &context->bs))) WARN("Failed to create blend state, hr %#x.\n", hr); }
@@ -2736,7 +2735,7 @@ static HRESULT d2d_device_context_get_surface(struct d2d_device_context *render_ ID3D11Resource *resource; HRESULT hr;
- ID3D11RenderTargetView_GetResource(render_target->target->d3d11_rtv, &resource); + ID3D11RenderTargetView_GetResource(render_target->target->rtv, &resource); hr = ID3D11Resource_QueryInterface(resource, &IID_IDXGISurface1, (void **)surface); ID3D11Resource_Release(resource); if (FAILED(hr)) @@ -3870,21 +3869,13 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target,
device_impl = unsafe_impl_from_ID2D1Device(device); if (FAILED(hr = IDXGIDevice_QueryInterface(device_impl->dxgi_device, - &IID_ID3D10Device, (void **)&render_target->d3d_device))) - { - WARN("Failed to get device interface, hr %#x.\n", hr); - ID2D1Factory_Release(render_target->factory); - return hr; - } - - if (FAILED(hr = IDXGIDevice_QueryInterface(device_impl->dxgi_device, - &IID_ID3D11Device1, (void **)&render_target->d3d11_device))) + &IID_ID3D11Device1, (void **)&render_target->d3d_device))) { WARN("Failed to query ID3D11Device1 interface, hr %#x.\n", hr); goto err; }
- if (FAILED(hr = ID3D11Device1_CreateDeviceContextState(render_target->d3d11_device, + if (FAILED(hr = ID3D11Device1_CreateDeviceContextState(render_target->d3d_device, 0, &feature_levels, 1, D3D11_SDK_VERSION, &IID_ID3D11Device1, NULL, &render_target->d3d_state))) { @@ -3896,14 +3887,14 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, { const struct shape_info *si = &shape_info[i];
- if (FAILED(hr = ID3D11Device1_CreateInputLayout(render_target->d3d11_device, si->il_desc, si->il_element_count, + if (FAILED(hr = ID3D11Device1_CreateInputLayout(render_target->d3d_device, si->il_desc, si->il_element_count, si->vs_code, si->vs_code_size, &render_target->shape_resources[si->shape_type].il))) { WARN("Failed to create input layout for shape type %#x, hr %#x.\n", si->shape_type, hr); goto err; }
- if (FAILED(hr = ID3D11Device1_CreateVertexShader(render_target->d3d11_device, si->vs_code, + if (FAILED(hr = ID3D11Device1_CreateVertexShader(render_target->d3d_device, si->vs_code, si->vs_code_size, NULL, &render_target->shape_resources[si->shape_type].vs))) { WARN("Failed to create vertex shader for shape type %#x, hr %#x.\n", si->shape_type, hr); @@ -3918,14 +3909,14 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, buffer_desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; buffer_desc.MiscFlags = 0;
- if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, &buffer_desc, NULL, + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, NULL, &render_target->vs_cb))) { WARN("Failed to create constant buffer, hr %#x.\n", hr); goto err; }
- if (FAILED(hr = ID3D11Device1_CreatePixelShader(render_target->d3d11_device, + if (FAILED(hr = ID3D11Device1_CreatePixelShader(render_target->d3d_device, ps_code, sizeof(ps_code), NULL, &render_target->ps))) { WARN("Failed to create pixel shader, hr %#x.\n", hr); @@ -3938,7 +3929,7 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, buffer_desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; buffer_desc.MiscFlags = 0;
- if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, &buffer_desc, NULL, + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, NULL, &render_target->ps_cb))) { WARN("Failed to create constant buffer, hr %#x.\n", hr); @@ -3955,7 +3946,7 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, buffer_data.SysMemPitch = 0; buffer_data.SysMemSlicePitch = 0;
- if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &render_target->ib))) { WARN("Failed to create clear index buffer, hr %#x.\n", hr); @@ -3967,7 +3958,7 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, buffer_data.pSysMem = quad;
render_target->vb_stride = sizeof(*quad); - if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d11_device, + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &render_target->vb))) { WARN("Failed to create clear vertex buffer, hr %#x.\n", hr); @@ -3984,7 +3975,7 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, rs_desc.ScissorEnable = TRUE; rs_desc.MultisampleEnable = FALSE; rs_desc.AntialiasedLineEnable = FALSE; - if (FAILED(hr = ID3D11Device1_CreateRasterizerState(render_target->d3d11_device, &rs_desc, &render_target->rs))) + if (FAILED(hr = ID3D11Device1_CreateRasterizerState(render_target->d3d_device, &rs_desc, &render_target->rs))) { WARN("Failed to create clear rasterizer state, hr %#x.\n", hr); goto err; @@ -4043,10 +4034,8 @@ err: } if (render_target->d3d_state) ID3DDeviceContextState_Release(render_target->d3d_state); - if (render_target->d3d11_device) - ID3D11Device1_Release(render_target->d3d11_device); if (render_target->d3d_device) - ID3D10Device_Release(render_target->d3d_device); + ID3D11Device1_Release(render_target->d3d_device); ID2D1Device_Release(render_target->device); ID2D1Factory_Release(render_target->factory); return hr; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 8dbad9c5ecc..e60128b38f2 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -936,12 +936,9 @@ static ID2D1RenderTarget *create_render_target_desc(IDXGISurface *surface, hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory); ok(SUCCEEDED(hr), "Failed to create factory, hr %#x.\n", hr); hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(factory, surface, desc, &render_target); - todo_wine_if(d3d11) ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr); ID2D1Factory_Release(factory);
- if (FAILED(hr)) - return NULL; - return render_target; }