anv: disable mutable combined image/sampler in descriptor buffer

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22151>
This commit is contained in:
Lionel Landwerlin 2023-11-07 16:03:24 +02:00 committed by Marge Bot
parent ab7641b8dc
commit 454d381243

View file

@ -478,6 +478,23 @@ anv_descriptor_set_layout_type_for_flags(const struct anv_physical_device *devic
return ANV_PIPELINE_DESCRIPTOR_SET_LAYOUT_TYPE_DIRECT;
}
static bool
mutable_list_includes_type(const VkMutableDescriptorTypeCreateInfoEXT *mutable_info,
uint32_t binding, VkDescriptorType type)
{
if (!mutable_info || mutable_info->mutableDescriptorTypeListCount == 0)
return true;
const VkMutableDescriptorTypeListEXT *type_list =
&mutable_info->pMutableDescriptorTypeLists[binding];
for (uint32_t i = 0; i < type_list->descriptorTypeCount; i++) {
if (type_list->pDescriptorTypes[i] == type)
return true;
}
return false;
}
void anv_GetDescriptorSetLayoutSupport(
VkDevice _device,
const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
@ -509,6 +526,21 @@ void anv_GetDescriptorSetLayoutSupport(
flags = binding_flags_info->pBindingFlags[b];
}
/* Combined image/sampler descriptor are not supported with descriptor
* buffers & mutable descriptor types because we cannot know from the
* shader where to find the sampler structure. It can be written to the
* beginning of the descriptor (at offset 0) or in the second part (at
* offset 64bytes).
*/
if ((pCreateInfo->flags &
VK_DESCRIPTOR_SET_LAYOUT_CREATE_DESCRIPTOR_BUFFER_BIT_EXT) &&
binding->descriptorType == VK_DESCRIPTOR_TYPE_MUTABLE_EXT &&
mutable_list_includes_type(mutable_info, b,
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)) {
pSupport->supported = false;
return;
}
enum anv_descriptor_data desc_data =
binding->descriptorType == VK_DESCRIPTOR_TYPE_MUTABLE_EXT ?
anv_descriptor_data_for_mutable_type(pdevice, layout_type,