[PATCH vkd3d 2/3] vkd3d: Support count buffer for indirect draws
Philip Rebohle
philip.rebohle at tu-dortmund.de
Sat May 18 08:53:02 CDT 2019
Used by Resident Evil 2.
Signed-off-by: Philip Rebohle <philip.rebohle at tu-dortmund.de>
---
libs/vkd3d/command.c | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index 9187ad0..d3ec387 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -4873,6 +4873,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(ID3D12GraphicsC
{
struct d3d12_command_signature *sig_impl = unsafe_impl_from_ID3D12CommandSignature(command_signature);
struct d3d12_resource *arg_impl = unsafe_impl_from_ID3D12Resource(arg_buffer);
+ struct d3d12_resource *count_impl = unsafe_impl_from_ID3D12Resource(count_buffer);
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList1(iface);
const D3D12_COMMAND_SIGNATURE_DESC *signature_desc;
const struct vkd3d_vk_device_procs *vk_procs;
@@ -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,14 @@ 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(vkCmdDrawIndirect(list->vk_command_buffer, arg_impl->u.vk_buffer,
+ arg_buffer_offset, max_command_count, signature_desc->ByteStride));
+ } else {
+ 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));
+ }
break;
case D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED:
@@ -4918,14 +4925,25 @@ 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(vkCmdDrawIndexedIndirect(list->vk_command_buffer, arg_impl->u.vk_buffer,
+ arg_buffer_offset, max_command_count, signature_desc->ByteStride));
+ } else {
+ 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));
+ }
break;
case D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH:
if (max_command_count != 1)
FIXME("Ignoring command count %u.\n", max_command_count);
+ if (count_buffer) {
+ WARN("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",
--
2.21.0
More information about the wine-devel
mailing list