panvk: Track VkFormats for depth and stencil attachments

These can be used directly in vk_meta_rendering_info.

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31159>
This commit is contained in:
Rebecca Mckeever
2024-10-07 15:52:33 -07:00
committed by Marge Bot
parent 26a03222ef
commit ddb2f6f1fa
5 changed files with 14 additions and 21 deletions

View File

@@ -386,6 +386,7 @@ struct panvk_cmd_graphics_state {
struct {
struct panvk_image_view *iview;
VkFormat fmt;
struct panvk_resolve_attachment resolve;
} z_attachment, s_attachment;

View File

@@ -1735,6 +1735,7 @@ panvk_cmd_begin_rendering_init_state(struct panvk_cmd_buffer *cmdbuf,
struct panvk_image *img =
container_of(iview->vk.image, struct panvk_image, vk);
const VkExtent3D iview_size = iview->vk.extent;
cmdbuf->state.gfx.render.z_attachment.fmt = iview->vk.format;
if (iview->vk.aspects & VK_IMAGE_ASPECT_DEPTH_BIT) {
cmdbuf->state.gfx.render.bound_attachments |=
@@ -1776,6 +1777,7 @@ panvk_cmd_begin_rendering_init_state(struct panvk_cmd_buffer *cmdbuf,
struct panvk_image *img =
container_of(iview->vk.image, struct panvk_image, vk);
const VkExtent3D iview_size = iview->vk.extent;
cmdbuf->state.gfx.render.s_attachment.fmt = iview->vk.format;
if (iview->vk.aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
cmdbuf->state.gfx.render.bound_attachments |=

View File

@@ -146,6 +146,7 @@ struct panvk_cmd_graphics_state {
struct {
struct panvk_image_view *iview;
VkFormat fmt;
struct panvk_resolve_attachment resolve;
} z_attachment, s_attachment;

View File

@@ -1605,6 +1605,7 @@ panvk_cmd_begin_rendering_init_state(struct panvk_cmd_buffer *cmdbuf,
struct panvk_image *img =
container_of(iview->vk.image, struct panvk_image, vk);
const VkExtent3D iview_size = iview->vk.extent;
cmdbuf->state.gfx.render.z_attachment.fmt = iview->vk.format;
if (iview->vk.aspects & VK_IMAGE_ASPECT_DEPTH_BIT) {
cmdbuf->state.gfx.render.bound_attachments |=
@@ -1648,6 +1649,7 @@ panvk_cmd_begin_rendering_init_state(struct panvk_cmd_buffer *cmdbuf,
struct panvk_image *img =
container_of(iview->vk.image, struct panvk_image, vk);
const VkExtent3D iview_size = iview->vk.extent;
cmdbuf->state.gfx.render.s_attachment.fmt = iview->vk.format;
if (iview->vk.aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
cmdbuf->state.gfx.render.bound_attachments |=

View File

@@ -187,30 +187,17 @@ panvk_per_arch(CmdClearAttachments)(VkCommandBuffer commandBuffer,
.view_mask = 0,
.samples = fbinfo->nr_samples,
.color_attachment_count = fbinfo->rt_count,
.depth_attachment_format = cmdbuf->state.gfx.render.z_attachment.fmt,
.stencil_attachment_format = cmdbuf->state.gfx.render.s_attachment.fmt,
};
for (uint32_t i = 0; i < fbinfo->rt_count; i++) {
if (fbinfo->rts[i].view) {
for (uint32_t i = 0; i < render.color_attachment_count; i++) {
render.color_attachment_formats[i] =
cmdbuf->state.gfx.render.color_attachments.fmts[i];
render.color_attachment_write_masks[i] =
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
}
}
if (fbinfo->zs.view.zs) {
render.depth_attachment_format =
vk_format_from_pipe_format(fbinfo->zs.view.zs->format);
if (vk_format_has_stencil(render.depth_attachment_format))
render.stencil_attachment_format = render.depth_attachment_format;
}
if (fbinfo->zs.view.s) {
render.stencil_attachment_format =
vk_format_from_pipe_format(fbinfo->zs.view.s->format);
}
panvk_per_arch(cmd_meta_gfx_start)(cmdbuf, &save);
vk_meta_clear_attachments(&cmdbuf->vk, &dev->meta, &render, attachmentCount,