From c47799ef188ff3e15573bfb8811193918afffea1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 24 Jan 2017 05:13:46 +0100
Subject: [PATCH] d3d11: Implement Draw for deferred contexts.

---
 dlls/d3d11/device.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 3c41fc3..1bf9caf 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -60,6 +60,7 @@ enum deferred_cmd
 
     DEFERRED_CSSETUNORDEREDACCESSVIEWS, /* unordered_view */
 
+    DEFERRED_DRAW,                      /* draw_info */
     DEFERRED_DRAWINDEXED,               /* draw_indexed_info */
     DEFERRED_DRAWINDEXEDINSTANCED,      /* draw_indexed_inst_info */
 
@@ -177,6 +178,11 @@ struct deferred_call
         struct
         {
             UINT count;
+            UINT start;
+        } draw_info;
+        struct
+        {
+            UINT count;
             UINT start_index;
             INT  base_vertex;
         } draw_indexed_info;
@@ -450,6 +456,7 @@ static void free_deferred_calls(struct list *commands)
                 }
                 break;
             }
+            case DEFERRED_DRAW:
             case DEFERRED_DRAWINDEXED:
             case DEFERRED_DRAWINDEXEDINSTANCED:
             {
@@ -631,6 +638,11 @@ static void exec_deferred_calls(ID3D11DeviceContext1 *iface, struct list *comman
                         call->unordered_view.num_views, call->unordered_view.views, call->unordered_view.initial_counts);
                 break;
             }
+            case DEFERRED_DRAW:
+            {
+                ID3D11DeviceContext1_Draw(iface, call->draw_info.count, call->draw_info.start);
+                break;
+            }
             case DEFERRED_DRAWINDEXED:
             {
                 ID3D11DeviceContext1_DrawIndexed(iface, call->draw_indexed_info.count,
@@ -3866,8 +3878,18 @@ static void STDMETHODCALLTYPE d3d11_deferred_context_DrawIndexed(ID3D11DeviceCon
 static void STDMETHODCALLTYPE d3d11_deferred_context_Draw(ID3D11DeviceContext *iface,
         UINT vertex_count, UINT start_vertex_location)
 {
-    FIXME("iface %p, vertex_count %u, start_vertex_location %u stub!\n",
+    struct d3d11_deferred_context *context = impl_from_deferred_ID3D11DeviceContext(iface);
+    struct deferred_call *call;
+
+    TRACE("iface %p, vertex_count %u, start_vertex_location %u.\n",
             iface, vertex_count, start_vertex_location);
+
+    if (!(call = add_deferred_call(context, 0)))
+        return;
+
+    call->cmd = DEFERRED_DRAW;
+    call->draw_info.count = vertex_count;
+    call->draw_info.start = start_vertex_location;
 }
 
 static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_Map(ID3D11DeviceContext *iface, ID3D11Resource *resource,
-- 
1.9.1

