Skip to content

Allocate descriptor set pools on demand.#115

Merged
crud89 merged 2 commits intomainfrom
dynamic-pool-size
Jan 8, 2024
Merged

Allocate descriptor set pools on demand.#115
crud89 merged 2 commits intomainfrom
dynamic-pool-size

Conversation

@crud89
Copy link
Copy Markdown
Owner

@crud89 crud89 commented Jan 8, 2024

Describe the pull request

In the Vulkan backend, descriptor sets are allocated from fixed-size descriptor pools. If descriptor sets are allocated from descriptor pools, they eventually run out of memory. This causes new pools to be allocated. To prevent unnecessary allocations, the pool size could be configured by clients. The default pool size is pretty conservatively assumed at 1024 descriptor sets per pool. Most descriptor sets are, however, only allocated sparingly, so a lot of space is wasted.

With this PR, pool sizes are determined by the amount of descriptor sets to be allocated. If a descriptor set layout needs to allocate large quantities of descriptor sets, it is now up to the client to allocate them in larger chunks. The favoured way would be to allocate a large set of descriptor sets (using allocateMultiple) and discard them immediately. This will cause the descriptor sets to be cached until they are requested later on, when they will be handed out again.

However, most descriptor sets are only created infrequently (ideally once) in small quantities, as this is the preferred way of using them. In this case, the new approach will no longer cause excessive pool sizes.

The poolSize parameters have been removed from the descriptor set layout and its builder interface.

Related issues

@crud89 crud89 added the Vulkan 🌋 The issue involves the Vulkan backend. label Jan 8, 2024
@crud89 crud89 added this to the Alpha #04 milestone Jan 8, 2024
@crud89 crud89 self-assigned this Jan 8, 2024
@crud89 crud89 marked this pull request as ready for review January 8, 2024 11:36
@crud89 crud89 merged commit ac73e1d into main Jan 8, 2024
@crud89 crud89 deleted the dynamic-pool-size branch January 8, 2024 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Vulkan 🌋 The issue involves the Vulkan backend.

Projects

Status: v0.4.1

Development

Successfully merging this pull request may close these issues.

Make descriptor pool sizes dynamic.

1 participant