vkd3d: Disable push descriptors when that's helpful to stay within 8 descriptor sets.

This commit is contained in:
Giovanni Mascellani 2024-10-17 22:58:54 +02:00 committed by Henri Verbeet
parent 3bf114f3c3
commit ae772d40cf
Notes: Henri Verbeet 2024-10-21 18:42:52 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1202
2 changed files with 20 additions and 4 deletions

View File

@ -1918,6 +1918,26 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device,
&& descriptor_indexing->descriptorBindingUniformTexelBufferUpdateAfterBind
&& descriptor_indexing->descriptorBindingStorageTexelBufferUpdateAfterBind;
/* Many Vulkan implementations allow up to 8 descriptor sets. Unfortunately
* using vkd3d with Vulkan heaps and push descriptors currently requires up
* to 9 descriptor sets (up to one for the push descriptors, up to one for
* the static samplers and seven for Vulkan heaps, one for each needed
* descriptor type). If we detect such situation, we disable push
* descriptors, which allows us to stay within the limits (not doing so is
* fatal on many implmentations).
*
* It is possible that a different strategy might be used. For example, we
* could move the static samplers to one of the seven Vulkan heaps sets. Or
* we could decide whether to create the push descriptor set when creating
* the root signature, depending on whether there are static samplers or
* not. */
if (device->vk_info.device_limits.maxBoundDescriptorSets == 8 && device->use_vk_heaps
&& device->vk_info.KHR_push_descriptor)
{
TRACE("Disabling VK_KHR_push_descriptor to save a descriptor set.\n");
device->vk_info.KHR_push_descriptor = VK_FALSE;
}
if (device->use_vk_heaps)
vkd3d_device_vk_heaps_descriptor_limits_init(&vulkan_info->descriptor_limits,
&physical_device_info->descriptor_indexing_properties);

View File

@ -19402,8 +19402,6 @@ static void test_descriptors_visibility(void)
root_signature_desc.NumStaticSamplers = 2;
root_signature_desc.pStaticSamplers = sampler_desc;
hr = create_root_signature(device, &root_signature_desc, &context.root_signature);
/* llvmpipe (from Mesa 24.0.4) has maxBoundDescriptorSet == 8, which is less than we need. */
todo_if(is_llvmpipe_device(device))
ok(SUCCEEDED(hr), "Failed to create root signature, hr %#x.\n", hr);
if (FAILED(hr))
@ -21155,8 +21153,6 @@ static void test_depth_stencil_sampling(void)
root_signature_desc.NumStaticSamplers = 2;
root_signature_desc.pStaticSamplers = sampler_desc;
hr = create_root_signature(device, &root_signature_desc, &context.root_signature);
/* llvmpipe (from Mesa 24.0.4) has maxBoundDescriptorSet == 8, which is less than we need. */
todo_if(is_llvmpipe_device(device))
ok(SUCCEEDED(hr), "Failed to create root signature, hr %#x.\n", hr);
if (FAILED(hr))