Philip Rebohle : vkd3d: Support count buffer for indirect draws.

Alexandre Julliard julliard at winehq.org
Mon May 20 15:25:44 CDT 2019


Module: vkd3d
Branch: master
Commit: f1076bb15333a7177e7b5406121a77601c8dfb54
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=f1076bb15333a7177e7b5406121a77601c8dfb54

Author: Philip Rebohle <philip.rebohle at tu-dortmund.de>
Date:   Mon May 20 09:09:24 2019 +0200

vkd3d: Support count buffer for indirect draws.

Used by Resident Evil 2.

Signed-off-by: Philip Rebohle <philip.rebohle at tu-dortmund.de>
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d/command.c | 37 +++++++++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index 9187ad0..2fdd980 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -4872,6 +4872,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(ID3D12GraphicsC
         UINT64 arg_buffer_offset, ID3D12Resource *count_buffer, UINT64 count_buffer_offset)
 {
     struct d3d12_command_signature *sig_impl = unsafe_impl_from_ID3D12CommandSignature(command_signature);
+    struct d3d12_resource *count_impl = unsafe_impl_from_ID3D12Resource(count_buffer);
     struct d3d12_resource *arg_impl = unsafe_impl_from_ID3D12Resource(arg_buffer);
     struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList1(iface);
     const D3D12_COMMAND_SIGNATURE_DESC *signature_desc;
@@ -4885,9 +4886,9 @@ static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(ID3D12GraphicsC
 
     vk_procs = &list->device->vk_procs;
 
-    if (count_buffer)
+    if (count_buffer && !list->device->vk_info.KHR_draw_indirect_count)
     {
-        FIXME("Count buffers not implemented.\n");
+        FIXME("Count buffers not supported by Vulkan implementation.\n");
         return;
     }
 
@@ -4905,8 +4906,17 @@ static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(ID3D12GraphicsC
                     break;
                 }
 
-                VK_CALL(vkCmdDrawIndirect(list->vk_command_buffer, arg_impl->u.vk_buffer,
-                        arg_buffer_offset, max_command_count, signature_desc->ByteStride));
+                if (count_buffer)
+                {
+                    VK_CALL(vkCmdDrawIndirectCountKHR(list->vk_command_buffer, arg_impl->u.vk_buffer,
+                            arg_buffer_offset, count_impl->u.vk_buffer, count_buffer_offset,
+                            max_command_count, signature_desc->ByteStride));
+                }
+                else
+                {
+                    VK_CALL(vkCmdDrawIndirect(list->vk_command_buffer, arg_impl->u.vk_buffer,
+                            arg_buffer_offset, max_command_count, signature_desc->ByteStride));
+                }
                 break;
 
             case D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED:
@@ -4918,14 +4928,29 @@ static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(ID3D12GraphicsC
 
                 d3d12_command_list_check_index_buffer_strip_cut_value(list);
 
-                VK_CALL(vkCmdDrawIndexedIndirect(list->vk_command_buffer, arg_impl->u.vk_buffer,
-                        arg_buffer_offset, max_command_count, signature_desc->ByteStride));
+                if (count_buffer)
+                {
+                    VK_CALL(vkCmdDrawIndexedIndirectCountKHR(list->vk_command_buffer, arg_impl->u.vk_buffer,
+                            arg_buffer_offset, count_impl->u.vk_buffer, count_buffer_offset,
+                            max_command_count, signature_desc->ByteStride));
+                }
+                else
+                {
+                    VK_CALL(vkCmdDrawIndexedIndirect(list->vk_command_buffer, arg_impl->u.vk_buffer,
+                            arg_buffer_offset, max_command_count, signature_desc->ByteStride));
+                }
                 break;
 
             case D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH:
                 if (max_command_count != 1)
                     FIXME("Ignoring command count %u.\n", max_command_count);
 
+                if (count_buffer)
+                {
+                    FIXME("Count buffers not supported for indirect dispatch.\n");
+                    break;
+                }
+
                 if (list->state->vk_bind_point != VK_PIPELINE_BIND_POINT_COMPUTE)
                 {
                     WARN("Pipeline state %p has bind point %#x, ignoring dispatch.\n",




More information about the wine-cvs mailing list