From fa05d30dc5d2a85385da43f8dace0b4dbcaa07f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Wed, 4 Nov 2015 23:37:15 +0100 Subject: [PATCH] d3d11: Implement d3d11_immediate_context_OMSetRenderTargets(). 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 | 21 ++++++++++++++++++++- dlls/d3d11/view.c | 9 +++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h index 932d5189e87..fb3bb458e37 100644 --- a/dlls/d3d11/d3d11_private.h +++ b/dlls/d3d11/d3d11_private.h @@ -169,6 +169,7 @@ struct d3d_depthstencil_view HRESULT d3d_depthstencil_view_create(struct d3d_device *device, ID3D11Resource *resource, const D3D11_DEPTH_STENCIL_VIEW_DESC *desc, struct d3d_depthstencil_view **view) DECLSPEC_HIDDEN; +struct d3d_depthstencil_view *unsafe_impl_from_ID3D11DepthStencilView(ID3D11DepthStencilView *iface) DECLSPEC_HIDDEN; struct d3d_depthstencil_view *unsafe_impl_from_ID3D10DepthStencilView(ID3D10DepthStencilView *iface) DECLSPEC_HIDDEN; /* ID3D11RenderTargetView, ID3D10RenderTargetView */ diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index f655a3ecc67..4560f5264ec 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -406,8 +406,27 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetRenderTargets(ID3D11D UINT render_target_view_count, ID3D11RenderTargetView *const *render_target_views, ID3D11DepthStencilView *depth_stencil_view) { - FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p stub!\n", + struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface); + struct d3d_depthstencil_view *dsv; + unsigned int i; + + TRACE("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p.\n", iface, render_target_view_count, render_target_views, depth_stencil_view); + + wined3d_mutex_lock(); + for (i = 0; i < render_target_view_count; ++i) + { + struct d3d_rendertarget_view *rtv = unsafe_impl_from_ID3D11RenderTargetView(render_target_views[i]); + wined3d_device_set_rendertarget_view(device->wined3d_device, i, rtv ? rtv->wined3d_view : NULL, FALSE); + } + for (; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + { + wined3d_device_set_rendertarget_view(device->wined3d_device, i, NULL, FALSE); + } + + dsv = unsafe_impl_from_ID3D11DepthStencilView(depth_stencil_view); + wined3d_device_set_depth_stencil_view(device->wined3d_device, dsv ? dsv->wined3d_view : NULL); + wined3d_mutex_unlock(); } static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetRenderTargetsAndUnorderedAccessViews( diff --git a/dlls/d3d11/view.c b/dlls/d3d11/view.c index ca537643c56..33c7a0781f7 100644 --- a/dlls/d3d11/view.c +++ b/dlls/d3d11/view.c @@ -757,6 +757,15 @@ HRESULT d3d_depthstencil_view_create(struct d3d_device *device, ID3D11Resource * return S_OK; } +struct d3d_depthstencil_view *unsafe_impl_from_ID3D11DepthStencilView(ID3D11DepthStencilView *iface) +{ + if (!iface) + return NULL; + assert(iface->lpVtbl == &d3d11_depthstencil_view_vtbl); + + return impl_from_ID3D11DepthStencilView(iface); +} + struct d3d_depthstencil_view *unsafe_impl_from_ID3D10DepthStencilView(ID3D10DepthStencilView *iface) { if (!iface)