Skip to content
Snippets Groups Projects

vkd3d: Store a struct d3d12_descriptor_heap pointer in each CBV/SRV/UAV descriptor.

Merged Conor McCarthy requested to merge cmccarthy/vkd3d:descriptor_heap_pointer into master

The PE build of vkd3d uses Windows critical sections for synchronisation, and these slow down on the very high lock/unlock rate during multithreaded descriptor copying in Shadow of the Tomb Raider. This patch speeds up the demo by about 8%. By comparison, using SRW locks in the allocators and locking them for read only where applicable is about 4% faster.

Merge request reports

Merge request pipeline #6814 skipped

Merge request pipeline skipped for 3db50938

Merged by Alexandre JulliardAlexandre Julliard 2 years ago (Jan 25, 2023 9:43pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • @@ -2833,8 +2832,7 @@ static void d3d12_command_list_prepare_descriptors(struct d3d12_command_list *li
                     /* Descriptors may not be set, eg. WoW. */
                     && (base_descriptor = bindings->descriptor_tables[table_index]))
             {
    -            heap_size = vkd3d_gpu_descriptor_allocator_range_size_from_descriptor(
    -                    &device->gpu_descriptor_allocator, base_descriptor);
    +            heap_size = base_descriptor->heap->desc.NumDescriptors;
     
                 if (heap_size < unbounded_offset)
                     WARN("Descriptor heap size %u is less than the offset %u of an unbounded range in table %u, "

    That doesn't do the same thing. Is that intentional, or should this use d3d12_desc_heap_range_size() like elsewhere?

    -struct vkd3d_gpu_descriptor_allocator
    -{
    -    struct vkd3d_mutex mutex;
    -
    -    struct vkd3d_gpu_descriptor_allocation *allocations;
    -    size_t allocations_size;
    -    size_t allocation_count;
    -};

    We should also be able to remove struct vkd3d_gpu_descriptor_allocation now, right?

    +static inline void d3d12_desc_copy_raw(struct d3d12_desc *dst, const struct d3d12_desc *src)
    +{
    +    memcpy(dst, src, offsetof(struct d3d12_desc, heap));
    +}

    That's a bit unfortunate; this ends up depending on the exact layout of struct d3d12_desc. Could we just wrap the descriptor "body" in a structure instead?

  • Conor McCarthy added 1 commit

    added 1 commit

    • f6ee265f - vkd3d: Store a heap array index in each CBV/SRV/UAV descriptor.

    Compare with previous version

  • Conor McCarthy added 1 commit

    added 1 commit

    • cf298365 - vkd3d: Store a heap array index in each CBV/SRV/UAV descriptor.

    Compare with previous version

  • Henri Verbeet approved this merge request

    approved this merge request

  • added 22 commits

    Compare with previous version

  • Alexandre Julliard approved this merge request

    approved this merge request

Please register or sign in to reply
Loading