dzn: Partial revert of 8887852d
authorJesse Natalie <jenatali@microsoft.com>
Wed, 24 May 2023 17:41:40 +0000 (10:41 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 25 May 2023 02:08:32 +0000 (02:08 +0000)
Turns out there was a good reason for having both buffer count
and desc_count. They served different purposes.

Fixes: 8887852d ("dzn: Add some docs around descriptor sets and remove redundant/unused data")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23218>

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

index 15eaa10..792222d 100644 (file)
@@ -421,8 +421,9 @@ dzn_descriptor_set_layout_create(struct dzn_device *device,
          if (is_dynamic) {
             range->OffsetInDescriptorsFromTableStart =
                set_layout->dynamic_buffers.range_offset +
-               set_layout->dynamic_buffers.count;
+               set_layout->dynamic_buffers.desc_count;
             set_layout->dynamic_buffers.count += range->NumDescriptors;
+            set_layout->dynamic_buffers.desc_count += range->NumDescriptors;
          } else {
             range->OffsetInDescriptorsFromTableStart = set_layout->range_desc_count[type];
             if (!binfos[binding].variable_size)
@@ -440,7 +441,8 @@ dzn_descriptor_set_layout_create(struct dzn_device *device,
          if (is_dynamic) {
             range->OffsetInDescriptorsFromTableStart =
                set_layout->dynamic_buffers.range_offset +
-               set_layout->dynamic_buffers.count;
+               set_layout->dynamic_buffers.desc_count;
+            set_layout->dynamic_buffers.desc_count += range->NumDescriptors;
          } else {
             range->OffsetInDescriptorsFromTableStart = set_layout->range_desc_count[type];
             set_layout->range_desc_count[type] += range->NumDescriptors;
@@ -679,7 +681,7 @@ dzn_pipeline_layout_create(struct dzn_device *device,
       }
 
       if (!device->bindless)
-         layout->desc_count[D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV] += set_layout->dynamic_buffers.count;
+         layout->desc_count[D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV] += set_layout->dynamic_buffers.desc_count;
 
       dynamic_buffer_base += set_layout->dynamic_buffers.count;
       for (uint32_t o = 0, elem = 0; o < set_layout->dynamic_buffers.count; o++, elem++) {
index 03764d5..3e4777b 100644 (file)
@@ -769,6 +769,7 @@ struct dzn_descriptor_set_layout {
    struct {
       uint32_t bindings[MAX_DYNAMIC_BUFFERS];
       uint32_t count;
+      uint32_t desc_count;
       uint32_t range_offset;
    } dynamic_buffers;
    uint32_t buffer_count;