mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-12-15 08:03:30 -08:00
vkd3d: Rename the struct vkd3d_device_descriptor_limits fields.
They do not represent the raw Vulkan resource limits, but the emulated d3d12 limits depending on the Vulkan limits. Therefore name them according to d3d12.
This commit is contained in:
committed by
Henri Verbeet
parent
443f4bc056
commit
be31451ae9
Notes:
Henri Verbeet
2025-12-03 15:30:19 +01:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1576
@@ -233,18 +233,18 @@ static HRESULT vkd3d_vk_descriptor_heap_layouts_init(struct d3d12_device *device
|
||||
switch (device->vk_descriptor_heap_layouts[set].type)
|
||||
{
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||
device->vk_descriptor_heap_layouts[set].count = limits->uniform_buffer_max_descriptors;
|
||||
device->vk_descriptor_heap_layouts[set].count = limits->max_cbv_descriptor_count;
|
||||
break;
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
||||
device->vk_descriptor_heap_layouts[set].count = limits->sampled_image_max_descriptors;
|
||||
device->vk_descriptor_heap_layouts[set].count = limits->max_srv_descriptor_count;
|
||||
break;
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
||||
device->vk_descriptor_heap_layouts[set].count = limits->storage_image_max_descriptors;
|
||||
device->vk_descriptor_heap_layouts[set].count = limits->max_uav_descriptor_count;
|
||||
break;
|
||||
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
||||
device->vk_descriptor_heap_layouts[set].count = limits->sampler_max_descriptors;
|
||||
device->vk_descriptor_heap_layouts[set].count = limits->max_sampler_descriptor_count;
|
||||
break;
|
||||
default:
|
||||
ERR("Unhandled descriptor type %#x.\n", device->vk_descriptor_heap_layouts[set].type);
|
||||
@@ -1487,10 +1487,11 @@ static void vkd3d_init_feature_level(struct vkd3d_vulkan_info *vk_info,
|
||||
static void vkd3d_device_descriptor_limits_init(struct vkd3d_device_descriptor_limits *limits,
|
||||
const VkPhysicalDeviceLimits *device_limits)
|
||||
{
|
||||
limits->uniform_buffer_max_descriptors = device_limits->maxDescriptorSetUniformBuffers;
|
||||
limits->sampled_image_max_descriptors = device_limits->maxDescriptorSetSampledImages;
|
||||
limits->storage_image_max_descriptors = device_limits->maxDescriptorSetStorageImages;
|
||||
limits->sampler_max_descriptors = min(device_limits->maxDescriptorSetSamplers, VKD3D_MAX_DESCRIPTOR_SET_SAMPLERS);
|
||||
limits->max_cbv_descriptor_count = device_limits->maxDescriptorSetUniformBuffers;
|
||||
limits->max_srv_descriptor_count = device_limits->maxDescriptorSetSampledImages;
|
||||
limits->max_uav_descriptor_count = device_limits->maxDescriptorSetStorageImages;
|
||||
limits->max_sampler_descriptor_count = min(device_limits->maxDescriptorSetSamplers,
|
||||
VKD3D_MAX_DESCRIPTOR_SET_SAMPLERS);
|
||||
}
|
||||
|
||||
static void vkd3d_device_vk_heaps_descriptor_limits_init(struct vkd3d_device_descriptor_limits *limits,
|
||||
@@ -1510,19 +1511,19 @@ static void vkd3d_device_vk_heaps_descriptor_limits_init(struct vkd3d_device_des
|
||||
uav_divisor = properties->maxDescriptorSetUpdateAfterBindSampledImages >= (3u << 20) ? 3 : 2;
|
||||
}
|
||||
|
||||
limits->uniform_buffer_max_descriptors = min(min(properties->maxDescriptorSetUpdateAfterBindUniformBuffers,
|
||||
limits->max_cbv_descriptor_count = min(min(properties->maxDescriptorSetUpdateAfterBindUniformBuffers,
|
||||
properties->maxPerStageDescriptorUpdateAfterBindUniformBuffers - root_provision),
|
||||
VKD3D_MAX_DESCRIPTOR_SET_CBVS_SRVS_UAVS);
|
||||
limits->sampled_image_max_descriptors = min(min(properties->maxDescriptorSetUpdateAfterBindSampledImages,
|
||||
limits->max_srv_descriptor_count = min(min(properties->maxDescriptorSetUpdateAfterBindSampledImages,
|
||||
properties->maxPerStageDescriptorUpdateAfterBindSampledImages / srv_divisor - root_provision),
|
||||
VKD3D_MAX_DESCRIPTOR_SET_CBVS_SRVS_UAVS);
|
||||
limits->storage_image_max_descriptors = min(min(properties->maxDescriptorSetUpdateAfterBindStorageImages,
|
||||
limits->max_uav_descriptor_count = min(min(properties->maxDescriptorSetUpdateAfterBindStorageImages,
|
||||
properties->maxPerStageDescriptorUpdateAfterBindStorageImages / uav_divisor - root_provision),
|
||||
VKD3D_MAX_DESCRIPTOR_SET_CBVS_SRVS_UAVS);
|
||||
limits->sampler_max_descriptors = min(min(properties->maxDescriptorSetUpdateAfterBindSamplers,
|
||||
limits->max_sampler_descriptor_count = min(min(properties->maxDescriptorSetUpdateAfterBindSamplers,
|
||||
properties->maxPerStageDescriptorUpdateAfterBindSamplers - root_provision),
|
||||
VKD3D_MAX_DESCRIPTOR_SET_CBVS_SRVS_UAVS);
|
||||
limits->sampler_max_descriptors = min(limits->sampler_max_descriptors, VKD3D_MAX_DESCRIPTOR_SET_SAMPLERS);
|
||||
limits->max_sampler_descriptor_count = min(limits->max_sampler_descriptor_count, VKD3D_MAX_DESCRIPTOR_SET_SAMPLERS);
|
||||
}
|
||||
|
||||
static bool d3d12_device_supports_typed_uav_load_additional_formats(const struct d3d12_device *device)
|
||||
@@ -2726,13 +2727,13 @@ static void device_init_descriptor_pool_sizes(struct d3d12_device *device)
|
||||
const struct vkd3d_device_descriptor_limits *limits = &device->vk_info.descriptor_limits;
|
||||
unsigned int *pool_sizes = device->vk_pool_limits;
|
||||
|
||||
pool_sizes[VKD3D_SHADER_DESCRIPTOR_TYPE_CBV] = min(limits->uniform_buffer_max_descriptors,
|
||||
pool_sizes[VKD3D_SHADER_DESCRIPTOR_TYPE_CBV] = min(limits->max_cbv_descriptor_count,
|
||||
VKD3D_MAX_VIRTUAL_HEAP_DESCRIPTORS_PER_TYPE);
|
||||
pool_sizes[VKD3D_SHADER_DESCRIPTOR_TYPE_SRV] = min(limits->sampled_image_max_descriptors,
|
||||
pool_sizes[VKD3D_SHADER_DESCRIPTOR_TYPE_SRV] = min(limits->max_srv_descriptor_count,
|
||||
VKD3D_MAX_VIRTUAL_HEAP_DESCRIPTORS_PER_TYPE);
|
||||
pool_sizes[VKD3D_SHADER_DESCRIPTOR_TYPE_UAV] = min(limits->storage_image_max_descriptors,
|
||||
pool_sizes[VKD3D_SHADER_DESCRIPTOR_TYPE_UAV] = min(limits->max_uav_descriptor_count,
|
||||
VKD3D_MAX_VIRTUAL_HEAP_DESCRIPTORS_PER_TYPE);
|
||||
pool_sizes[VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER] = min(limits->sampler_max_descriptors,
|
||||
pool_sizes[VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER] = min(limits->max_sampler_descriptor_count,
|
||||
VKD3D_MAX_VIRTUAL_HEAP_DESCRIPTORS_PER_TYPE);
|
||||
};
|
||||
|
||||
|
||||
@@ -938,19 +938,19 @@ static unsigned int vk_binding_count_from_descriptor_range(const struct d3d12_ro
|
||||
switch (range->type)
|
||||
{
|
||||
case VKD3D_SHADER_DESCRIPTOR_TYPE_CBV:
|
||||
limit = limits->uniform_buffer_max_descriptors;
|
||||
limit = limits->max_cbv_descriptor_count;
|
||||
count = (limit - min(info->cbv_count, limit)) / info->cbv_unbounded_range_count;
|
||||
break;
|
||||
case VKD3D_SHADER_DESCRIPTOR_TYPE_SRV:
|
||||
limit = limits->sampled_image_max_descriptors;
|
||||
limit = limits->max_srv_descriptor_count;
|
||||
count = (limit - min(info->srv_count, limit)) / info->srv_unbounded_range_count;
|
||||
break;
|
||||
case VKD3D_SHADER_DESCRIPTOR_TYPE_UAV:
|
||||
limit = limits->storage_image_max_descriptors;
|
||||
limit = limits->max_uav_descriptor_count;
|
||||
count = (limit - min(info->uav_count, limit)) / info->uav_unbounded_range_count;
|
||||
break;
|
||||
case VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER:
|
||||
limit = limits->sampler_max_descriptors;
|
||||
limit = limits->max_sampler_descriptor_count;
|
||||
count = (limit - min(info->sampler_count, limit)) / info->sampler_unbounded_range_count;
|
||||
break;
|
||||
default:
|
||||
@@ -1084,36 +1084,36 @@ static void vkd3d_descriptor_heap_binding_from_descriptor_range(const struct d3d
|
||||
if (range->type == VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER)
|
||||
{
|
||||
binding->set = VKD3D_SET_INDEX_SAMPLER;
|
||||
descriptor_set_size = descriptor_limits->sampler_max_descriptors;
|
||||
descriptor_set_size = descriptor_limits->max_sampler_descriptor_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
binding->set = VKD3D_SET_INDEX_MUTABLE;
|
||||
descriptor_set_size = descriptor_limits->sampled_image_max_descriptors;
|
||||
descriptor_set_size = descriptor_limits->max_srv_descriptor_count;
|
||||
}
|
||||
}
|
||||
else switch (range->type)
|
||||
{
|
||||
case VKD3D_SHADER_DESCRIPTOR_TYPE_SRV:
|
||||
binding->set = is_buffer ? VKD3D_SET_INDEX_UNIFORM_TEXEL_BUFFER : VKD3D_SET_INDEX_SAMPLED_IMAGE;
|
||||
descriptor_set_size = descriptor_limits->sampled_image_max_descriptors;
|
||||
descriptor_set_size = descriptor_limits->max_srv_descriptor_count;
|
||||
break;
|
||||
case VKD3D_SHADER_DESCRIPTOR_TYPE_UAV:
|
||||
binding->set = is_buffer ? VKD3D_SET_INDEX_STORAGE_TEXEL_BUFFER : VKD3D_SET_INDEX_STORAGE_IMAGE;
|
||||
descriptor_set_size = descriptor_limits->storage_image_max_descriptors;
|
||||
descriptor_set_size = descriptor_limits->max_uav_descriptor_count;
|
||||
break;
|
||||
case VKD3D_SHADER_DESCRIPTOR_TYPE_CBV:
|
||||
binding->set = VKD3D_SET_INDEX_UNIFORM_BUFFER;
|
||||
descriptor_set_size = descriptor_limits->uniform_buffer_max_descriptors;
|
||||
descriptor_set_size = descriptor_limits->max_cbv_descriptor_count;
|
||||
break;
|
||||
case VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER:
|
||||
binding->set = VKD3D_SET_INDEX_SAMPLER;
|
||||
descriptor_set_size = descriptor_limits->sampler_max_descriptors;
|
||||
descriptor_set_size = descriptor_limits->max_sampler_descriptor_count;
|
||||
break;
|
||||
default:
|
||||
FIXME("Unhandled descriptor range type type %#x.\n", range->type);
|
||||
binding->set = VKD3D_SET_INDEX_SAMPLED_IMAGE;
|
||||
descriptor_set_size = descriptor_limits->sampled_image_max_descriptors;
|
||||
descriptor_set_size = descriptor_limits->max_srv_descriptor_count;
|
||||
break;
|
||||
}
|
||||
binding->set += root_signature->vk_set_count;
|
||||
@@ -1151,7 +1151,7 @@ static void d3d12_root_signature_map_vk_heap_uav_counter(struct d3d12_root_signa
|
||||
mapping->binding.set = root_signature->vk_set_count + VKD3D_SET_INDEX_UAV_COUNTER;
|
||||
mapping->binding.binding = 0;
|
||||
mapping->binding.count = vk_heap_binding_count_from_descriptor_range(range,
|
||||
root_signature->device->vk_info.descriptor_limits.storage_image_max_descriptors);
|
||||
root_signature->device->vk_info.descriptor_limits.max_uav_descriptor_count);
|
||||
offset->static_offset = range->offset;
|
||||
offset->dynamic_offset_index = context->push_constant_index;
|
||||
}
|
||||
|
||||
@@ -108,10 +108,10 @@ HRESULT hresult_from_vkd3d_result(int vkd3d_result);
|
||||
|
||||
struct vkd3d_device_descriptor_limits
|
||||
{
|
||||
unsigned int uniform_buffer_max_descriptors;
|
||||
unsigned int sampled_image_max_descriptors;
|
||||
unsigned int storage_image_max_descriptors;
|
||||
unsigned int sampler_max_descriptors;
|
||||
unsigned int max_cbv_descriptor_count;
|
||||
unsigned int max_srv_descriptor_count;
|
||||
unsigned int max_uav_descriptor_count;
|
||||
unsigned int max_sampler_descriptor_count;
|
||||
};
|
||||
|
||||
struct vkd3d_vulkan_info
|
||||
|
||||
Reference in New Issue
Block a user