Henri Verbeet pushed to branch master at wine / vkd3d
Commits: 4a94bfc2 by Conor McCarthy at 2024-12-05T20:54:45+01:00 vkd3d: Store only a single vkd3d descriptor type in each Vulkan descriptor set.
We currently create statically sized descriptor pools, shared among different descriptor types. Once we're unable to allocate a descriptor set from a pool, we create a new pool. The unfortunate but predictable consequence is that when we run out of descriptors of one type, we waste any unallocated descriptors of the other types.
Dynamically adjusting the pool sizes could mitigate the issue, but it seems non-trivial to handle all the edge cases, particularly in situations where the descriptor count ratios change significantly between frames. Instead, by storing only a single vkd3d descriptor type in each Vulkan descriptor set we're able to create separate descriptor pools for each vkd3d descriptor type, which also avoids the issue.
The main drawback of using separate descriptor sets for each descriptor type is that we can no longer pack all bounded descriptor ranges into a single descriptor set, potentially leaving fewer descriptor sets available for unbounded ranges. That seems worth it, but we may end up having to switch to a more complicated strategy if this ends up being a problem on Vulkan implementations with a very limited number of available descriptor sets.
- - - - - 3c620e88 by Conor McCarthy at 2024-12-05T20:54:45+01:00 vkd3d: Introduce struct vkd3d_vk_descriptor_pool_array.
- - - - - 7c0ce25b by Conor McCarthy at 2024-12-05T20:54:45+01:00 vkd3d: Introduce vkd3d_vk_descriptor_pool_array_push_array().
- - - - - 9d46a186 by Conor McCarthy at 2024-12-05T20:54:45+01:00 vkd3d: Introduce vkd3d_vk_descriptor_pool_array_push().
- - - - - 8dc9fe72 by Conor McCarthy at 2024-12-05T20:54:45+01:00 vkd3d: Introduce vkd3d_vk_descriptor_pool_array_pop().
- - - - - 19c6df1a by Conor McCarthy at 2024-12-05T20:54:45+01:00 vkd3d: Introduce vkd3d_vk_descriptor_pool_array_destroy_pools().
- - - - - a97c7c1f by Henri Verbeet at 2024-12-05T20:54:45+01:00 vkd3d: Introduce d3d12_descriptor_set_layout_init().
- - - - - e729ceeb by Conor McCarthy at 2024-12-05T20:54:45+01:00 vkd3d: Create separate descriptor pools for each vkd3d descriptor type.
Now that our Vulkan descriptor sets contain only a single vkd3d descriptor type, we're able to create descriptor pools containing only a single vkd3d descriptor type as well. This avoids wasting unallocated descriptors of one type when we run out of descriptors of another type.
- - - - - a43f6a66 by Conor McCarthy at 2024-12-05T20:54:45+01:00 vkd3d: Create descriptor pools of geometrically increasing size.
Creating a pool of 16k descriptors is wasteful if an allocator only uses a fraction of them, so start at 1k and double for each subsequent allocation until 16k is reached.
- - - - -
4 changed files:
- libs/vkd3d/command.c - libs/vkd3d/device.c - libs/vkd3d/state.c - libs/vkd3d/vkd3d_private.h
View it on GitLab: https://gitlab.winehq.org/wine/vkd3d/-/compare/01117c716dea0e934ac594a7596d9...