tu: Make input attachments always contain a real descriptor

We need this for read-only input attachments.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31261>
This commit is contained in:
Connor Abbott 2024-03-05 11:59:05 -05:00 committed by Marge Bot
parent beb513ad78
commit cad2ca74d9
2 changed files with 7 additions and 27 deletions

View file

@ -46,12 +46,6 @@ descriptor_size(struct tu_device *dev,
VkDescriptorType type)
{
switch (type) {
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
if (TU_DEBUG(DYNAMIC))
return A6XX_TEX_CONST_DWORDS * 4;
/* Input attachment doesn't use descriptor sets at all */
return 0;
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
/* We make offsets and sizes all 16 dwords, to match how the hardware
* interprets indices passed to sample/load/store instructions in
@ -367,8 +361,7 @@ tu_GetDescriptorSetLayoutSupport(
for (uint32_t j = 0; j < list->descriptorTypeCount; j++) {
/* Don't support the input attachement and combined image sampler type
* for mutable descriptors */
if (list->pDescriptorTypes[j] == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT ||
list->pDescriptorTypes[j] == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER ||
if (list->pDescriptorTypes[j] == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER ||
list->pDescriptorTypes[j] == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK) {
supported = false;
goto out;
@ -1200,11 +1193,8 @@ tu_GetDescriptorEXT(
write_sampler_descriptor(dest, *pDescriptorInfo->data.pSampler);
break;
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
/* nothing in descriptor set - framebuffer state is used instead */
if (TU_DEBUG(DYNAMIC)) {
write_image_descriptor(dest, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,
pDescriptorInfo->data.pInputAttachmentImage);
}
write_image_descriptor(dest, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,
pDescriptorInfo->data.pInputAttachmentImage);
break;
default:
unreachable("unimplemented descriptor type");
@ -1298,6 +1288,7 @@ tu_update_descriptor_sets(const struct tu_device *device,
break;
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
write_image_descriptor(ptr, writeset->descriptorType, writeset->pImageInfo + j);
break;
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
@ -1315,11 +1306,6 @@ tu_update_descriptor_sets(const struct tu_device *device,
else if (copy_immutable_samplers)
write_sampler_push(ptr, &samplers[writeset->dstArrayElement + j]);
break;
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
/* nothing in descriptor set - framebuffer state is used instead */
if (TU_DEBUG(DYNAMIC))
write_image_descriptor(ptr, writeset->descriptorType, writeset->pImageInfo + j);
break;
default:
unreachable("unimplemented descriptor type");
break;
@ -1631,7 +1617,8 @@ tu_update_descriptor_set_with_template(
write_texel_buffer_descriptor(ptr, *(VkBufferView *) src);
break;
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: {
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: {
write_image_descriptor(ptr, templ->entry[i].descriptor_type,
(const VkDescriptorImageInfo *) src);
break;
@ -1650,12 +1637,6 @@ tu_update_descriptor_set_with_template(
else if (samplers)
write_sampler_push(ptr, &samplers[j]);
break;
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
/* nothing in descriptor set - framebuffer state is used instead */
if (TU_DEBUG(DYNAMIC))
write_image_descriptor(ptr, templ->entry[i].descriptor_type,
(const VkDescriptorImageInfo *) src);
break;
default:
unreachable("unimplemented descriptor type");
break;

View file

@ -1143,8 +1143,7 @@ tu_get_properties(struct tu_physical_device *pdevice,
COND(pdevice->info->a7xx.storage_8bit, 1));
props->robustStorageBufferDescriptorSize =
props->storageBufferDescriptorSize;
props->inputAttachmentDescriptorSize = TU_DEBUG(DYNAMIC) ?
A6XX_TEX_CONST_DWORDS * 4 : 0;
props->inputAttachmentDescriptorSize = A6XX_TEX_CONST_DWORDS * 4;
props->maxSamplerDescriptorBufferRange = ~0ull;
props->maxResourceDescriptorBufferRange = ~0ull;
props->samplerDescriptorBufferAddressSpaceSize = ~0ull;