[PATCH 05/11] d3d11: Implement UAV binding.

Józef Kucia jkucia at codeweavers.com
Wed Nov 23 07:36:06 CST 2016


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/d3d11/d3d11_private.h |  2 ++
 dlls/d3d11/device.c        | 33 +++++++++++++++++++++++++++++++--
 dlls/d3d11/view.c          |  9 +++++++++
 3 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index 78cd265..52c43d6 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -237,6 +237,8 @@ struct d3d11_unordered_access_view
 
 HRESULT d3d11_unordered_access_view_create(struct d3d_device *device, ID3D11Resource *resource,
         const D3D11_UNORDERED_ACCESS_VIEW_DESC *desc, struct d3d11_unordered_access_view **view) DECLSPEC_HIDDEN;
+struct d3d11_unordered_access_view *unsafe_impl_from_ID3D11UnorderedAccessView(
+        ID3D11UnorderedAccessView *iface) DECLSPEC_HIDDEN;
 
 /* ID3D11InputLayout, ID3D10InputLayout */
 struct d3d_input_layout
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index f90d512..1cb033d 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -634,9 +634,12 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetRenderTargetsAndUnord
         UINT unordered_access_view_start_slot, UINT unordered_access_view_count,
         ID3D11UnorderedAccessView *const *unordered_access_views, const UINT *initial_counts)
 {
-    FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p, "
+    struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface);
+    unsigned int i;
+
+    TRACE("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p, "
             "unordered_access_view_start_slot %u, unordered_access_view_count %u, unordered_access_views %p, "
-            "initial_counts %p partial-stub!\n",
+            "initial_counts %p.\n",
             iface, render_target_view_count, render_target_views, depth_stencil_view,
             unordered_access_view_start_slot, unordered_access_view_count, unordered_access_views,
             initial_counts);
@@ -646,6 +649,32 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetRenderTargetsAndUnord
         d3d11_immediate_context_OMSetRenderTargets(iface, render_target_view_count, render_target_views,
                 depth_stencil_view);
     }
+
+    if (unordered_access_view_count != D3D11_KEEP_UNORDERED_ACCESS_VIEWS)
+    {
+        if (initial_counts)
+            FIXME("Ignoring initial counts.\n");
+
+        wined3d_mutex_lock();
+        for (i = 0; i < unordered_access_view_start_slot; ++i)
+        {
+            wined3d_device_set_unordered_access_view(device->wined3d_device, i, NULL);
+        }
+        for (i = 0; i < unordered_access_view_count; ++i)
+        {
+            struct d3d11_unordered_access_view *view
+                    = unsafe_impl_from_ID3D11UnorderedAccessView(unordered_access_views[i]);
+
+            wined3d_device_set_unordered_access_view(device->wined3d_device,
+                    unordered_access_view_start_slot + i,
+                    view ? view->wined3d_view : NULL);
+        }
+        for (; unordered_access_view_start_slot + i < D3D11_PS_CS_UAV_REGISTER_COUNT; ++i)
+        {
+            wined3d_device_set_unordered_access_view(device->wined3d_device, i, NULL);
+        }
+        wined3d_mutex_unlock();
+    }
 }
 
 static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11DeviceContext *iface,
diff --git a/dlls/d3d11/view.c b/dlls/d3d11/view.c
index d670cb2..06e3cd6 100644
--- a/dlls/d3d11/view.c
+++ b/dlls/d3d11/view.c
@@ -2526,3 +2526,12 @@ HRESULT d3d11_unordered_access_view_create(struct d3d_device *device, ID3D11Reso
 
     return S_OK;
 }
+
+struct d3d11_unordered_access_view *unsafe_impl_from_ID3D11UnorderedAccessView(ID3D11UnorderedAccessView *iface)
+{
+    if (!iface)
+        return NULL;
+    assert(iface->lpVtbl == &d3d11_unordered_access_view_vtbl);
+
+    return impl_from_ID3D11UnorderedAccessView(iface);
+}
-- 
2.7.3




More information about the wine-patches mailing list