dzn: Raise max number of descriptor sets to 8
authorJesse Natalie <jenatali@microsoft.com>
Thu, 23 Mar 2023 15:35:41 +0000 (08:35 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 6 Apr 2023 22:08:28 +0000 (22:08 +0000)
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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22225>

src/microsoft/vulkan/dzn_cmd_buffer.c
src/microsoft/vulkan/dzn_private.h

index dfa0df9..ed471a1 100644 (file)
@@ -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) {
index 93c4ab7..c880fce 100644 (file)
@@ -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                                                  \