pvr: Implement VK_KHR_imageless_framebuffer

Signed-off-by: Vlad Schiller <vlad-radu.schiller@imgtec.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36412>
This commit is contained in:
Vlad Schiller 2023-11-21 10:05:51 +00:00 committed by Marge Bot
parent e6ebf937e8
commit 03f02a4655
3 changed files with 42 additions and 12 deletions

View file

@ -468,7 +468,7 @@ Vulkan 1.2 -- all DONE: anv, hk, nvk, panvk/v10+, tu, vn
VK_KHR_draw_indirect_count DONE (anv, dzn, hasvk, lvp, nvk, panvk/v10+, radv, tu, vn)
VK_KHR_driver_properties DONE (anv, dzn, hasvk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)
VK_KHR_image_format_list DONE (anv, dzn, hasvk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)
VK_KHR_imageless_framebuffer DONE (anv, dzn, hasvk, lvp, nvk, panvk, radv, tu, v3dv, vn)
VK_KHR_imageless_framebuffer DONE (anv, dzn, hasvk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)
VK_KHR_sampler_mirror_clamp_to_edge DONE (anv, dzn, hasvk, lvp, nvk, panvk, radv, tu, v3dv, vn)
VK_KHR_separate_depth_stencil_layouts DONE (anv, dzn, hasvk, lvp, nvk, panvk, radv, tu, v3dv, vn)
VK_KHR_shader_atomic_int64 DONE (anv, lvp, nvk, panvk/v10+, radv, vn, tu/a740+)

View file

@ -2833,15 +2833,20 @@ void pvr_CmdPushConstants2KHR(VkCommandBuffer commandBuffer,
}
}
static VkResult
pvr_cmd_buffer_setup_attachments(struct pvr_cmd_buffer *cmd_buffer,
const struct pvr_render_pass *pass,
const struct pvr_framebuffer *framebuffer)
static VkResult pvr_cmd_buffer_setup_attachments(
struct pvr_cmd_buffer *cmd_buffer,
struct pvr_render_pass *pass,
const struct pvr_framebuffer *framebuffer,
const VkRenderPassBeginInfo *pRenderPassBeginInfo)
{
struct pvr_cmd_buffer_state *state = &cmd_buffer->state;
struct pvr_render_pass_info *info = &state->render_pass_info;
const VkRenderPassAttachmentBeginInfo *pImageless =
vk_find_struct_const(pRenderPassBeginInfo->pNext,
RENDER_PASS_ATTACHMENT_BEGIN_INFO);
assert(pass->attachment_count == framebuffer->attachment_count);
if (!pImageless)
assert(pass->attachment_count == framebuffer->attachment_count);
/* Free any previously allocated attachments. */
vk_free(&cmd_buffer->vk.pool->alloc, state->render_pass_info.attachments);
@ -2861,8 +2866,15 @@ pvr_cmd_buffer_setup_attachments(struct pvr_cmd_buffer *cmd_buffer,
VK_ERROR_OUT_OF_HOST_MEMORY);
}
for (uint32_t i = 0; i < pass->attachment_count; i++)
info->attachments[i] = framebuffer->attachments[i];
for (uint32_t i = 0; i < pass->attachment_count; i++) {
if (pImageless && pImageless->attachmentCount) {
assert(pImageless->attachmentCount == pass->attachment_count);
PVR_FROM_HANDLE(pvr_image_view, img_view, pImageless->pAttachments[i]);
info->attachments[i] = img_view;
} else {
info->attachments[i] = framebuffer->attachments[i];
}
}
return VK_SUCCESS;
}
@ -3300,7 +3312,10 @@ void pvr_CmdBeginRenderPass2(VkCommandBuffer commandBuffer,
state->render_pass_info.isp_userpass = pass->subpasses[0].isp_userpass;
state->dirty.isp_userpass = true;
result = pvr_cmd_buffer_setup_attachments(cmd_buffer, pass, framebuffer);
result = pvr_cmd_buffer_setup_attachments(cmd_buffer,
pass,
framebuffer,
pRenderPassBeginInfo);
if (result != VK_SUCCESS)
return;

View file

@ -181,6 +181,7 @@ static void pvr_physical_device_get_supported_extensions(
.KHR_external_semaphore_fd = PVR_USE_WSI_PLATFORM,
.KHR_get_memory_requirements2 = true,
.KHR_image_format_list = true,
.KHR_imageless_framebuffer = true,
.KHR_index_type_uint8 = false,
.KHR_maintenance1 = true,
.KHR_maintenance2 = true,
@ -279,6 +280,9 @@ static void pvr_physical_device_get_supported_features(
/* VK_KHR_index_type_uint8 */
.indexTypeUint8 = true,
/* Vulkan 1.2 / VK_KHR_imageless_framebuffer */
.imagelessFramebuffer = true,
/* Vulkan 1.2 / VK_KHR_timeline_semaphore */
.timelineSemaphore = true,
@ -2955,6 +2959,7 @@ VkResult pvr_CreateFramebuffer(VkDevice _device,
{
PVR_FROM_HANDLE(pvr_render_pass, pass, pCreateInfo->renderPass);
PVR_FROM_HANDLE(pvr_device, device, _device);
const VkFramebufferAttachmentsCreateInfoKHR *pImageless;
struct pvr_spm_bgobj_state *spm_bgobj_state_per_render;
struct pvr_spm_eot_state *spm_eot_state_per_render;
struct pvr_render_target *render_targets;
@ -2966,6 +2971,9 @@ VkResult pvr_CreateFramebuffer(VkDevice _device,
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO);
pImageless = vk_find_struct_const(pCreateInfo->pNext,
FRAMEBUFFER_ATTACHMENTS_CREATE_INFO);
render_targets_count =
PVR_RENDER_TARGETS_PER_FRAMEBUFFER(&device->pdevice->dev_info);
@ -3003,10 +3011,17 @@ VkResult pvr_CreateFramebuffer(VkDevice _device,
framebuffer->layers = pCreateInfo->layers;
framebuffer->attachments = attachments;
framebuffer->attachment_count = pCreateInfo->attachmentCount;
if (!pImageless)
framebuffer->attachment_count = pCreateInfo->attachmentCount;
else
framebuffer->attachment_count = pImageless->attachmentImageInfoCount;
for (uint32_t i = 0; i < framebuffer->attachment_count; i++) {
framebuffer->attachments[i] =
pvr_image_view_from_handle(pCreateInfo->pAttachments[i]);
if (!pImageless) {
framebuffer->attachments[i] =
pvr_image_view_from_handle(pCreateInfo->pAttachments[i]);
} else {
assert(i < pImageless->attachmentImageInfoCount);
}
}
result = pvr_framebuffer_create_ppp_state(device, framebuffer);