From a348b499016c7e90005832d1fcbc62f188813753 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Thu, 23 Mar 2023 08:35:41 -0700 Subject: [PATCH] dzn: Raise max number of descriptor sets to 8 DOOM Eternal just assumes you support at least 5, which caused corruption due to overrunning arrays. We can just bump this up. 8 should work with and without bindless. Part-of: --- src/microsoft/vulkan/dzn_cmd_buffer.c | 22 ++++++++++++---------- src/microsoft/vulkan/dzn_private.h | 12 ++++++++++-- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/microsoft/vulkan/dzn_cmd_buffer.c b/src/microsoft/vulkan/dzn_cmd_buffer.c index dfa0df9..ed471a1 100644 --- a/src/microsoft/vulkan/dzn_cmd_buffer.c +++ b/src/microsoft/vulkan/dzn_cmd_buffer.c @@ -3159,19 +3159,21 @@ dzn_cmd_buffer_update_heaps(struct dzn_cmd_buffer *cmdbuf, uint32_t bindpoint) cmdbuf->state.heaps[h] = new_heaps[h]; } - for (uint32_t r = 0; r < pipeline->root.sets_param_count; r++) { - D3D12_DESCRIPTOR_HEAP_TYPE type = pipeline->root.type[r]; + if (!device->bindless) { + for (uint32_t r = 0; r < pipeline->root.sets_param_count; r++) { + D3D12_DESCRIPTOR_HEAP_TYPE type = pipeline->root.type[r]; - if (!update_root_desc_table[type]) - continue; + if (!update_root_desc_table[type]) + continue; - D3D12_GPU_DESCRIPTOR_HANDLE handle = - dzn_descriptor_heap_get_gpu_handle(new_heaps[type], new_heap_offsets[type]); + D3D12_GPU_DESCRIPTOR_HANDLE handle = + dzn_descriptor_heap_get_gpu_handle(new_heaps[type], new_heap_offsets[type]); - if (bindpoint == VK_PIPELINE_BIND_POINT_GRAPHICS) - ID3D12GraphicsCommandList1_SetGraphicsRootDescriptorTable(cmdbuf->cmdlist, r, handle); - else - ID3D12GraphicsCommandList1_SetComputeRootDescriptorTable(cmdbuf->cmdlist, r, handle); + if (bindpoint == VK_PIPELINE_BIND_POINT_GRAPHICS) + ID3D12GraphicsCommandList1_SetGraphicsRootDescriptorTable(cmdbuf->cmdlist, r, handle); + else + ID3D12GraphicsCommandList1_SetComputeRootDescriptorTable(cmdbuf->cmdlist, r, handle); + } } if (device->bindless) { diff --git a/src/microsoft/vulkan/dzn_private.h b/src/microsoft/vulkan/dzn_private.h index 93c4ab7..c880fce 100644 --- a/src/microsoft/vulkan/dzn_private.h +++ b/src/microsoft/vulkan/dzn_private.h @@ -345,13 +345,21 @@ enum dzn_cmd_bindpoint_dirty { DZN_CMD_BINDPOINT_DIRTY_DESC_SET1 = 1 << 4, DZN_CMD_BINDPOINT_DIRTY_DESC_SET2 = 1 << 5, DZN_CMD_BINDPOINT_DIRTY_DESC_SET3 = 1 << 6, + DZN_CMD_BINDPOINT_DIRTY_DESC_SET4 = 1 << 7, + DZN_CMD_BINDPOINT_DIRTY_DESC_SET5 = 1 << 8, + DZN_CMD_BINDPOINT_DIRTY_DESC_SET6 = 1 << 9, + DZN_CMD_BINDPOINT_DIRTY_DESC_SET7 = 1 << 10, DZN_CMD_BINDPOINT_DIRTY_HEAPS = DZN_CMD_BINDPOINT_DIRTY_DYNAMIC_BUFFERS | DZN_CMD_BINDPOINT_DIRTY_SYSVALS | DZN_CMD_BINDPOINT_DIRTY_DESC_SET0 | DZN_CMD_BINDPOINT_DIRTY_DESC_SET1 | DZN_CMD_BINDPOINT_DIRTY_DESC_SET2 | - DZN_CMD_BINDPOINT_DIRTY_DESC_SET3, + DZN_CMD_BINDPOINT_DIRTY_DESC_SET3 | + DZN_CMD_BINDPOINT_DIRTY_DESC_SET4 | + DZN_CMD_BINDPOINT_DIRTY_DESC_SET5 | + DZN_CMD_BINDPOINT_DIRTY_DESC_SET6 | + DZN_CMD_BINDPOINT_DIRTY_DESC_SET7, }; enum dzn_cmd_dirty { @@ -368,7 +376,7 @@ enum dzn_cmd_dirty { #define MAX_VBS D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT #define MAX_VP D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE #define MAX_SCISSOR D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE -#define MAX_SETS 4 +#define MAX_SETS 8 #define MAX_DYNAMIC_UNIFORM_BUFFERS 8 #define MAX_DYNAMIC_STORAGE_BUFFERS 4 #define MAX_DYNAMIC_BUFFERS \ -- 2.7.4