v3dv/format: add v3dv_get_format_swizzle

Heavily based on the equivalent v3d v3d_get_formar_swizzle.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Alejandro Piñeiro 2019-12-10 15:15:06 +01:00 committed by Marge Bot
parent 62ca997476
commit 6cb24a3b39
2 changed files with 13 additions and 0 deletions

View file

@ -201,6 +201,18 @@ v3dv_get_internal_type_bpp_for_output_format(uint32_t format,
}
}
const uint8_t *
v3dv_get_format_swizzle(VkFormat f)
{
const struct v3dv_format *vf = v3dv_get_format(f);
static const uint8_t fallback[] = {0, 1, 2, 3};
if (!vf)
return fallback;
return vf->swizzle;
}
static VkFormatFeatureFlags
image_format_features(VkFormat vk_format,
const struct v3dv_format *v3dv_format,

View file

@ -457,6 +457,7 @@ void v3dv_loge(const char *format, ...) v3dv_printflike(1, 2);
void v3dv_loge_v(const char *format, va_list va);
const struct v3dv_format *v3dv_get_format(VkFormat);
const uint8_t *v3dv_get_format_swizzle(VkFormat f);
void v3dv_get_internal_type_bpp_for_output_format(uint32_t format, uint32_t *type, uint32_t *bpp);
uint32_t v3d_utile_width(int cpp);