pvr: Add support for image descriptor.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17719>
This commit is contained in:
Rajnesh Kanwal 2022-07-01 23:26:41 +01:00
parent ecfea72c73
commit 08c867972f
1 changed files with 68 additions and 0 deletions

View File

@ -1580,6 +1580,65 @@ static void pvr_descriptor_update_sampler_texture(
}
}
static void pvr_descriptor_update_texture(
const struct pvr_device *device,
const VkWriteDescriptorSet *write_set,
struct pvr_descriptor_set *set,
const struct pvr_descriptor_set_layout_binding *binding,
uint32_t *mem_ptr,
uint32_t start_stage,
uint32_t end_stage)
{
const struct pvr_device_info *dev_info = &device->pdevice->dev_info;
for (uint32_t i = 0; i < write_set->descriptorCount; i++) {
PVR_FROM_HANDLE(pvr_image_view,
iview,
write_set->pImageInfo[i].imageView);
const uint32_t desc_idx =
binding->descriptor_index + write_set->dstArrayElement + i;
set->descriptors[desc_idx].type = write_set->descriptorType;
set->descriptors[desc_idx].iview = iview;
set->descriptors[desc_idx].layout = write_set->pImageInfo[i].imageLayout;
for (uint32_t j = start_stage; j < end_stage; j++) {
uint32_t secondary_offset;
uint32_t primary_offset;
if (!(binding->shader_stage_mask & BITFIELD_BIT(j)))
continue;
/* Offset calculation functions expect descriptor_index to be
* binding relative not layout relative, so we have used
* write_set->dstArrayElement + i rather than desc_idx.
*/
primary_offset =
pvr_get_descriptor_primary_offset(device,
set->layout,
binding,
j,
write_set->dstArrayElement + i);
secondary_offset =
pvr_get_descriptor_secondary_offset(device,
set->layout,
binding,
j,
write_set->dstArrayElement + i);
pvr_write_image_descriptor_primaries(dev_info,
iview,
write_set->descriptorType,
mem_ptr + primary_offset);
pvr_write_image_descriptor_secondaries(dev_info,
iview,
write_set->descriptorType,
mem_ptr + secondary_offset);
}
}
}
void pvr_UpdateDescriptorSets(VkDevice _device,
uint32_t descriptorWriteCount,
const VkWriteDescriptorSet *pDescriptorWrites,
@ -1632,6 +1691,15 @@ void pvr_UpdateDescriptorSets(VkDevice _device,
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
pvr_descriptor_update_texture(device,
write_set,
set,
binding,
map,
0,
PVR_STAGE_ALLOCATION_COUNT);
break;
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: