mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07: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.
This commit is contained in:
committed by
Henri Verbeet
parent
a97c7c1fda
commit
e729ceeb1a
Notes:
Henri Verbeet
2024-12-05 21:35:35 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1088
@@ -2677,39 +2677,16 @@ static void vkd3d_time_domains_init(struct d3d12_device *device)
|
||||
static void device_init_descriptor_pool_sizes(struct d3d12_device *device)
|
||||
{
|
||||
const struct vkd3d_device_descriptor_limits *limits = &device->vk_info.descriptor_limits;
|
||||
VkDescriptorPoolSize *pool_sizes = device->vk_pool_sizes;
|
||||
unsigned int *pool_sizes = device->vk_pool_sizes;
|
||||
|
||||
if (device->use_vk_heaps)
|
||||
{
|
||||
pool_sizes[0].type = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
|
||||
pool_sizes[0].descriptorCount = min(limits->storage_image_max_descriptors,
|
||||
VKD3D_MAX_UAV_CLEAR_DESCRIPTORS_PER_TYPE);
|
||||
pool_sizes[1].type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
||||
pool_sizes[1].descriptorCount = pool_sizes[0].descriptorCount;
|
||||
pool_sizes[2].type = VK_DESCRIPTOR_TYPE_SAMPLER;
|
||||
pool_sizes[2].descriptorCount = min(limits->sampler_max_descriptors, D3D12_MAX_LIVE_STATIC_SAMPLERS);
|
||||
device->vk_pool_count = 3;
|
||||
return;
|
||||
}
|
||||
|
||||
VKD3D_ASSERT(ARRAY_SIZE(device->vk_pool_sizes) >= 6);
|
||||
pool_sizes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
||||
pool_sizes[0].descriptorCount = min(limits->uniform_buffer_max_descriptors,
|
||||
pool_sizes[VKD3D_SHADER_DESCRIPTOR_TYPE_CBV] = min(limits->uniform_buffer_max_descriptors,
|
||||
VKD3D_MAX_VIRTUAL_HEAP_DESCRIPTORS_PER_TYPE);
|
||||
pool_sizes[1].type = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER;
|
||||
pool_sizes[1].descriptorCount = min(limits->sampled_image_max_descriptors,
|
||||
pool_sizes[VKD3D_SHADER_DESCRIPTOR_TYPE_SRV] = min(limits->sampled_image_max_descriptors,
|
||||
VKD3D_MAX_VIRTUAL_HEAP_DESCRIPTORS_PER_TYPE);
|
||||
pool_sizes[2].type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
|
||||
pool_sizes[2].descriptorCount = pool_sizes[1].descriptorCount;
|
||||
pool_sizes[3].type = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
|
||||
pool_sizes[3].descriptorCount = min(limits->storage_image_max_descriptors,
|
||||
pool_sizes[VKD3D_SHADER_DESCRIPTOR_TYPE_UAV] = min(limits->storage_image_max_descriptors,
|
||||
VKD3D_MAX_VIRTUAL_HEAP_DESCRIPTORS_PER_TYPE);
|
||||
pool_sizes[4].type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
||||
pool_sizes[4].descriptorCount = pool_sizes[3].descriptorCount;
|
||||
pool_sizes[5].type = VK_DESCRIPTOR_TYPE_SAMPLER;
|
||||
pool_sizes[5].descriptorCount = min(limits->sampler_max_descriptors,
|
||||
pool_sizes[VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER] = min(limits->sampler_max_descriptors,
|
||||
VKD3D_MAX_VIRTUAL_HEAP_DESCRIPTORS_PER_TYPE);
|
||||
device->vk_pool_count = 6;
|
||||
};
|
||||
|
||||
static void vkd3d_desc_object_cache_init(struct vkd3d_desc_object_cache *cache, size_t size)
|
||||
|
||||
Reference in New Issue
Block a user