panvk: Move mali_texture_packed structs in panvk_image_view to a union

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32563>
This commit is contained in:
Rebecca Mckeever 2025-01-28 14:21:12 -08:00 committed by Marge Bot
parent ddbbc1d217
commit 45657fb70f
3 changed files with 16 additions and 7 deletions

View file

@ -28,8 +28,13 @@ struct panvk_image_view {
struct panvk_priv_mem mem;
struct {
struct mali_texture_packed tex;
struct mali_texture_packed other_aspect_tex;
union {
struct mali_texture_packed tex;
struct {
struct mali_texture_packed tex;
struct mali_texture_packed other_aspect_tex;
} zs;
};
#if PAN_ARCH <= 7
/* Valhall passes a texture descriptor to the LEA_TEX instruction. */
@ -41,4 +46,8 @@ struct panvk_image_view {
VK_DEFINE_NONDISP_HANDLE_CASTS(panvk_image_view, vk.base, VkImageView,
VK_OBJECT_TYPE_IMAGE_VIEW);
static_assert(offsetof(struct panvk_image_view, descs.zs.tex) ==
offsetof(struct panvk_image_view, descs.tex),
"ZS texture descriptor must alias with color texture descriptor");
#endif

View file

@ -268,8 +268,8 @@ fill_textures(struct panvk_cmd_buffer *cmdbuf, struct pan_fb_info *fbinfo,
?: cmdbuf->state.gfx.render.s_attachment.iview;
textures[idx++] = vk_format_has_depth(iview->vk.view_format)
? iview->descs.tex
: iview->descs.other_aspect_tex;
? iview->descs.zs.tex
: iview->descs.zs.other_aspect_tex;
}
if (key->aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
@ -278,8 +278,8 @@ fill_textures(struct panvk_cmd_buffer *cmdbuf, struct pan_fb_info *fbinfo,
?: cmdbuf->state.gfx.render.z_attachment.iview;
textures[idx++] = vk_format_has_depth(iview->vk.view_format)
? iview->descs.other_aspect_tex
: iview->descs.tex;
? iview->descs.zs.other_aspect_tex
: iview->descs.zs.tex;
}
}

View file

@ -161,7 +161,7 @@ prepare_tex_descs(struct panvk_image_view *view)
ptr.cpu += alloc_info.size / 2;
ptr.gpu += alloc_info.size / 2;
GENX(panfrost_new_texture)(&pview, &view->descs.other_aspect_tex, &ptr);
GENX(panfrost_new_texture)(&pview, &view->descs.zs.other_aspect_tex, &ptr);
return VK_SUCCESS;
}