mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 13:10:10 +01:00
panvk: Initialize panvk_image::plane_count early
We are about to use it at initialization time, so let's make sure it's initialized as early as possible. We defer the initialization to a helper because we will extend it to support planar Z24S8. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Eric R. Smith <eric.smith@collabora.com> Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37158>
This commit is contained in:
parent
9c2c43c5e4
commit
7ac76d4e91
1 changed files with 16 additions and 0 deletions
|
|
@ -128,6 +128,19 @@ get_iusage(struct panvk_image *image, const VkImageCreateInfo *create_info)
|
|||
return iusage;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
get_plane_count(struct panvk_image *image)
|
||||
{
|
||||
/* Z32_S8X24 is not supported on v9+, and we don't want to use it
|
||||
* on v7- anyway, because it's less efficient than the multiplanar
|
||||
* alternative.
|
||||
*/
|
||||
if (image->vk.format == VK_FORMAT_D32_SFLOAT_S8_UINT)
|
||||
return 2;
|
||||
|
||||
return vk_format_get_plane_count(image->vk.format);
|
||||
}
|
||||
|
||||
static bool
|
||||
panvk_image_can_use_mod(struct panvk_image *image,
|
||||
const struct pan_image_usage *iusage, uint64_t mod,
|
||||
|
|
@ -469,6 +482,9 @@ VkResult
|
|||
panvk_image_init(struct panvk_image *image,
|
||||
const VkImageCreateInfo *pCreateInfo)
|
||||
{
|
||||
/* Needs to happen early for some panvk_image_ helpers to work. */
|
||||
image->plane_count = get_plane_count(image);
|
||||
|
||||
/* Add any create/usage flags that might be needed for meta operations.
|
||||
* This is run before the modifier selection because some
|
||||
* usage/create_flags influence the modifier selection logic. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue