mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Incorporate mutable descriptors in the push descriptor disabling logic.
The computation is also written in the code now instead of in the comments.
This commit is contained in:
parent
bc2b137df9
commit
a1f712d100
Notes:
Henri Verbeet
2024-10-23 16:18:40 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1218
@ -1925,24 +1925,26 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device,
|
|||||||
&& descriptor_indexing->descriptorBindingUniformTexelBufferUpdateAfterBind
|
&& descriptor_indexing->descriptorBindingUniformTexelBufferUpdateAfterBind
|
||||||
&& descriptor_indexing->descriptorBindingStorageTexelBufferUpdateAfterBind;
|
&& descriptor_indexing->descriptorBindingStorageTexelBufferUpdateAfterBind;
|
||||||
|
|
||||||
/* Many Vulkan implementations allow up to 8 descriptor sets. Unfortunately
|
if (device->use_vk_heaps && device->vk_info.KHR_push_descriptor)
|
||||||
* 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");
|
/* VKD3D_SET_INDEX_COUNT for the Vulkan heaps, one for the push
|
||||||
device->vk_info.KHR_push_descriptor = VK_FALSE;
|
* descriptors set and one for the static samplers set. */
|
||||||
|
unsigned int descriptor_set_count = VKD3D_SET_INDEX_COUNT + 2;
|
||||||
|
|
||||||
|
/* A mutable descriptor set can replace all those that should otherwise
|
||||||
|
* back the SRV-UAV-CBV descriptor heap. */
|
||||||
|
if (device->vk_info.EXT_mutable_descriptor_type)
|
||||||
|
descriptor_set_count -= VKD3D_SET_INDEX_COUNT - (VKD3D_SET_INDEX_MUTABLE + 1);
|
||||||
|
|
||||||
|
/* For many Vulkan implementations maxBoundDescriptorSets == 8; also,
|
||||||
|
* if mutable descriptors are not available the descriptor set count
|
||||||
|
* will be 9; so saving a descriptor set is going to be often
|
||||||
|
* significant. */
|
||||||
|
if (descriptor_set_count > device->vk_info.device_limits.maxBoundDescriptorSets)
|
||||||
|
{
|
||||||
|
WARN("Disabling VK_KHR_push_descriptor to save a descriptor set.\n");
|
||||||
|
device->vk_info.KHR_push_descriptor = VK_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->use_vk_heaps)
|
if (device->use_vk_heaps)
|
||||||
|
Loading…
Reference in New Issue
Block a user