mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 00:49:04 +02:00
v3dv: add swizzle helpers to identify formats wit R/B swap and reverse flags
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14533>
This commit is contained in:
parent
dbd3935b04
commit
872f08815b
2 changed files with 39 additions and 0 deletions
|
|
@ -40,6 +40,42 @@ v3dv_get_format_swizzle(struct v3dv_device *device, VkFormat f)
|
|||
return vf->swizzle;
|
||||
}
|
||||
|
||||
bool
|
||||
v3dv_format_swizzle_needs_rb_swap(const uint8_t *swizzle)
|
||||
{
|
||||
/* Normal case */
|
||||
if (swizzle[0] == PIPE_SWIZZLE_Z)
|
||||
return swizzle[2] == PIPE_SWIZZLE_X;
|
||||
|
||||
/* Format uses reverse flag */
|
||||
if (swizzle[0] == PIPE_SWIZZLE_Y)
|
||||
return swizzle[2] == PIPE_SWIZZLE_W;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
v3dv_format_swizzle_needs_reverse(const uint8_t *swizzle)
|
||||
{
|
||||
/* Normal case */
|
||||
if (swizzle[0] == PIPE_SWIZZLE_W &&
|
||||
swizzle[1] == PIPE_SWIZZLE_Z &&
|
||||
swizzle[2] == PIPE_SWIZZLE_Y &&
|
||||
swizzle[3] == PIPE_SWIZZLE_X) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Format uses RB swap flag */
|
||||
if (swizzle[0] == PIPE_SWIZZLE_Y &&
|
||||
swizzle[1] == PIPE_SWIZZLE_Z &&
|
||||
swizzle[2] == PIPE_SWIZZLE_W &&
|
||||
swizzle[3] == PIPE_SWIZZLE_X) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
v3dv_get_tex_return_size(const struct v3dv_format *vf,
|
||||
bool compare_enable)
|
||||
|
|
|
|||
|
|
@ -554,6 +554,9 @@ struct v3d_resource_slice {
|
|||
uint32_t padded_height_of_output_image_in_uif_blocks;
|
||||
};
|
||||
|
||||
bool v3dv_format_swizzle_needs_rb_swap(const uint8_t *swizzle);
|
||||
bool v3dv_format_swizzle_needs_reverse(const uint8_t *swizzle);
|
||||
|
||||
struct v3dv_image {
|
||||
struct vk_image vk;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue