mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Create smaller UAV-only descriptor pools in the allocator if Vulkan-backed heaps are enabled.
In this case d3d12_command_allocator_allocate_descriptor_set() is only called for clearing UAVs. This helps on platforms with limited descriptor maximum counts.
This commit is contained in:
parent
7516adeeae
commit
f039c86aac
Notes:
Alexandre Julliard
2023-05-08 22:33:59 +02:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/202
@ -1437,7 +1437,7 @@ static VkDescriptorPool d3d12_command_allocator_allocate_descriptor_pool(
|
||||
pool_desc.pNext = NULL;
|
||||
pool_desc.flags = 0;
|
||||
pool_desc.maxSets = 512;
|
||||
pool_desc.poolSizeCount = ARRAY_SIZE(device->vk_pool_sizes);
|
||||
pool_desc.poolSizeCount = device->vk_pool_count;
|
||||
pool_desc.pPoolSizes = device->vk_pool_sizes;
|
||||
if ((vr = VK_CALL(vkCreateDescriptorPool(vk_device, &pool_desc, NULL, &vk_pool))) < 0)
|
||||
{
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include "vkd3d_private.h"
|
||||
#include "vkd3d_version.h"
|
||||
|
||||
#define VKD3D_MAX_UAV_CLEAR_DESCRIPTORS_PER_TYPE 256u
|
||||
|
||||
struct vkd3d_struct
|
||||
{
|
||||
enum vkd3d_structure_type type;
|
||||
@ -2393,9 +2395,23 @@ static void vkd3d_time_domains_init(struct d3d12_device *device)
|
||||
WARN("Found no acceptable host time domain. Calibrated timestamps will not be available.\n");
|
||||
}
|
||||
|
||||
static void vkd3d_init_descriptor_pool_sizes(VkDescriptorPoolSize *pool_sizes,
|
||||
const struct vkd3d_device_descriptor_limits *limits)
|
||||
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;
|
||||
|
||||
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;
|
||||
device->vk_pool_count = 2;
|
||||
return;
|
||||
}
|
||||
|
||||
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,
|
||||
VKD3D_MAX_VIRTUAL_HEAP_DESCRIPTORS_PER_TYPE);
|
||||
@ -2412,6 +2428,7 @@ static void vkd3d_init_descriptor_pool_sizes(VkDescriptorPoolSize *pool_sizes,
|
||||
pool_sizes[5].type = VK_DESCRIPTOR_TYPE_SAMPLER;
|
||||
pool_sizes[5].descriptorCount = 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)
|
||||
@ -4000,7 +4017,7 @@ static HRESULT d3d12_device_init(struct d3d12_device *device,
|
||||
vkd3d_desc_object_cache_init(&device->view_desc_cache, sizeof(struct vkd3d_view));
|
||||
vkd3d_desc_object_cache_init(&device->cbuffer_desc_cache, sizeof(struct vkd3d_cbuffer_desc));
|
||||
|
||||
vkd3d_init_descriptor_pool_sizes(device->vk_pool_sizes, &device->vk_info.descriptor_limits);
|
||||
device_init_descriptor_pool_sizes(device);
|
||||
|
||||
if ((device->parent = create_info->parent))
|
||||
IUnknown_AddRef(device->parent);
|
||||
|
@ -1666,6 +1666,7 @@ struct d3d12_device
|
||||
struct vkd3d_uav_clear_state uav_clear_state;
|
||||
|
||||
VkDescriptorPoolSize vk_pool_sizes[VKD3D_DESCRIPTOR_POOL_COUNT];
|
||||
unsigned int vk_pool_count;
|
||||
struct vkd3d_vk_descriptor_heap_layout vk_descriptor_heap_layouts[VKD3D_SET_INDEX_COUNT];
|
||||
bool use_vk_heaps;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user