Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49395 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/d2d1/d2d1_private.h | 2 +- dlls/d2d1/device.c | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 565288bc71c..73259835786 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -167,7 +167,7 @@ struct d2d_device_context ID3D10StateBlock *stateblock; struct d2d_shape_resources shape_resources[D2D_SHAPE_TYPE_COUNT]; ID3D11Buffer *vs_cb; - ID3D10PixelShader *ps; + ID3D11PixelShader *ps; ID3D11Buffer *ps_cb; ID3D11Buffer *ib; unsigned int vb_stride; diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index acb01a35868..efeeaf6aa18 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -126,6 +126,7 @@ static void d2d_device_context_draw(struct d2d_device_context *render_target, en ID3D10Buffer *d3d10_ib = NULL, *d3d10_vb = NULL, *d3d10_vs_cb = NULL, *d3d10_ps_cb = NULL; ID3D11Buffer *vs_cb = render_target->vs_cb, *ps_cb = render_target->ps_cb; ID3D10VertexShader *d3d10_vs = NULL; + ID3D10PixelShader *d3d10_ps = NULL; ID3D10InputLayout *d3d10_il = NULL; D3D10_RECT scissor_rect; unsigned int offset; @@ -175,6 +176,12 @@ static void d2d_device_context_draw(struct d2d_device_context *render_target, en goto error; }
+ if (render_target->ps && FAILED(hr = ID3D11PixelShader_QueryInterface(render_target->ps, &IID_ID3D10PixelShader, (void **)&d3d10_ps))) + { + ERR("Failed to query D3D10 pixel shader, hr %#x.\n", hr); + goto error; + } + if (FAILED(hr = render_target->stateblock->lpVtbl->Capture(render_target->stateblock))) { WARN("Failed to capture stateblock, hr %#x.\n", hr); @@ -191,7 +198,7 @@ static void d2d_device_context_draw(struct d2d_device_context *render_target, en ID3D10Device_VSSetConstantBuffers(device, 0, 1, &d3d10_vs_cb); ID3D10Device_VSSetShader(device, d3d10_vs); ID3D10Device_PSSetConstantBuffers(device, 0, 1, &d3d10_ps_cb); - ID3D10Device_PSSetShader(device, render_target->ps); + ID3D10Device_PSSetShader(device, d3d10_ps); ID3D10Device_RSSetViewports(device, 1, &vp); if (render_target->clip_stack.count) { @@ -230,6 +237,7 @@ static void d2d_device_context_draw(struct d2d_device_context *render_target, en WARN("Failed to apply stateblock, hr %#x.\n", hr);
error: + if (d3d10_ps) ID3D10PixelShader_Release(d3d10_ps); if (d3d10_vs) ID3D10VertexShader_Release(d3d10_vs); if (d3d10_il) ID3D10InputLayout_Release(d3d10_il); if (d3d10_ib) ID3D10Buffer_Release(d3d10_ib); @@ -314,7 +322,7 @@ static ULONG STDMETHODCALLTYPE d2d_device_context_inner_Release(IUnknown *iface) ID3D11Buffer_Release(context->vb); ID3D11Buffer_Release(context->ib); ID3D11Buffer_Release(context->ps_cb); - ID3D10PixelShader_Release(context->ps); + ID3D11PixelShader_Release(context->ps); ID3D11Buffer_Release(context->vs_cb); for (i = 0; i < D2D_SHAPE_TYPE_COUNT; ++i) { @@ -3976,8 +3984,8 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, goto err; }
- if (FAILED(hr = ID3D10Device_CreatePixelShader(render_target->d3d_device, - ps_code, sizeof(ps_code), &render_target->ps))) + if (FAILED(hr = ID3D11Device1_CreatePixelShader(render_target->d3d11_device, + ps_code, sizeof(ps_code), NULL, &render_target->ps))) { WARN("Failed to create pixel shader, hr %#x.\n", hr); goto err; @@ -4082,7 +4090,7 @@ err: if (render_target->ps_cb) ID3D11Buffer_Release(render_target->ps_cb); if (render_target->ps) - ID3D10PixelShader_Release(render_target->ps); + ID3D11PixelShader_Release(render_target->ps); if (render_target->vs_cb) ID3D11Buffer_Release(render_target->vs_cb); for (i = 0; i < D2D_SHAPE_TYPE_COUNT; ++i)