[PATCH 4/5] d3d11: Implement d3d11_immediate_context_OMSetRenderTargets().

Józef Kucia jkucia at codeweavers.com
Wed Nov 4 16:37:15 CST 2015


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 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 932d518..fb3bb45 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 f655a3e..4560f52 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 ca53764..33c7a07 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)
-- 
2.4.10




More information about the wine-patches mailing list