pvr: Store format aspects on render pass attachments

This expands the existing has_stencil field on struct
pvr_render_pass_attachment to be a complete set of VkImageApsectFlags.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19342>
This commit is contained in:
Matt Coster 2022-10-28 17:13:43 +01:00 committed by Marge Bot
parent 0e708609cb
commit 9056817a6c
3 changed files with 14 additions and 14 deletions

View file

@ -1009,7 +1009,7 @@ static void pvr_dereference_surface(struct pvr_renderpass_context *ctx,
pvr_free_surface_storage(ctx, int_attach);
}
if (int_attach->attachment->has_stencil) {
if (int_attach->attachment->aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
assert(int_attach->stencil_remaining_count > 0U);
int_attach->stencil_remaining_count--;
}
@ -1149,7 +1149,7 @@ static VkResult pvr_close_render(const struct pvr_device *device,
link) {
assert(int_attach->resource.type != USC_MRT_RESOURCE_TYPE_INVALID);
assert(int_attach->remaining_count > 0U);
if (int_attach->attachment->has_stencil)
if (int_attach->attachment->aspects & VK_IMAGE_ASPECT_STENCIL_BIT)
assert(int_attach->stencil_remaining_count > 0U);
/* Copy the location of the source data for this attachment. */
@ -1385,7 +1385,7 @@ pvr_depth_zls_conflict(struct pvr_renderpass_context *ctx,
return true;
}
if (ctx->int_ds_attach->attachment->has_stencil &&
if (ctx->int_ds_attach->attachment->aspects & VK_IMAGE_ASPECT_STENCIL_BIT &&
ctx->int_ds_attach->stencil_remaining_count > 0U) {
return true;
}
@ -1396,7 +1396,7 @@ pvr_depth_zls_conflict(struct pvr_renderpass_context *ctx,
if (int_ds_attach->load_op == VK_ATTACHMENT_LOAD_OP_LOAD)
return true;
if (int_ds_attach->attachment->has_stencil &&
if (int_ds_attach->attachment->aspects & VK_IMAGE_ASPECT_STENCIL_BIT &&
int_ds_attach->stencil_load_op == VK_ATTACHMENT_LOAD_OP_LOAD) {
return true;
}
@ -1867,12 +1867,13 @@ pvr_can_combine_with_render(const struct pvr_device_info *dev_info,
* attachment.
*/
if (sp_depth->existing_ds_is_input &&
ctx->int_ds_attach->attachment->has_stencil) {
ctx->int_ds_attach->attachment->aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
return false;
}
if (sp_depth->incoming_ds_is_input && int_ds_attach &&
int_ds_attach->attachment->has_stencil && ctx->hw_render) {
int_ds_attach->attachment->aspects & VK_IMAGE_ASPECT_STENCIL_BIT &&
ctx->hw_render) {
return false;
}
@ -2111,7 +2112,7 @@ pvr_merge_subpass(const struct pvr_device *device,
hw_subpass->depth_initop = VK_ATTACHMENT_LOAD_OP_CLEAR;
}
if (int_ds_attach->attachment->has_stencil) {
if (int_ds_attach->attachment->aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
if (int_ds_attach->stencil_load_op == VK_ATTACHMENT_LOAD_OP_LOAD) {
stencil_load = true;
setup_render_ds = true;
@ -2338,7 +2339,7 @@ static VkResult pvr_schedule_subpass(const struct pvr_device *device,
pvr_free_surface_storage(ctx, int_depth_attach);
}
if (int_depth_attach->attachment->has_stencil) {
if (int_depth_attach->attachment->aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
assert(int_depth_attach->stencil_remaining_count > 0U);
int_depth_attach->stencil_remaining_count--;
}
@ -2576,7 +2577,7 @@ VkResult pvr_create_renderpass_hwsetup(
int_attach->remaining_count++;
}
if (int_attach->attachment->has_stencil) {
if (int_attach->attachment->aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
int_attach->stencil_remaining_count = int_attach->remaining_count;
if (pass->attachments[i].stencil_store_op ==
VK_ATTACHMENT_STORE_OP_STORE) {

View file

@ -451,8 +451,8 @@ VkResult pvr_CreateRenderPass2(VkDevice _device,
attachment->load_op = desc->loadOp;
attachment->store_op = desc->storeOp;
attachment->has_stencil = vk_format_has_stencil(attachment->vk_format);
if (attachment->has_stencil) {
attachment->aspects = vk_format_aspects(desc->format);
if (attachment->aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
attachment->stencil_load_op = desc->stencilLoadOp;
attachment->stencil_store_op = desc->stencilStoreOp;
}

View file

@ -1342,9 +1342,8 @@ struct pvr_render_pass_attachment {
uint32_t sample_count;
VkImageLayout initial_layout;
/* Derived and other state. */
/* True if the attachment format includes a stencil component. */
bool has_stencil;
/* Derived and other state. */
VkImageAspectFlags aspects;
/* Can this surface be resolved by the PBE. */
bool is_pbe_downscalable;