ac,radv,radeonsi: add helper to know if a format is supported by DB

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29291>
This commit is contained in:
Samuel Pitoiset 2024-05-20 16:13:35 +02:00 committed by Marge Bot
parent d2234adf59
commit 32e43fe77c
4 changed files with 11 additions and 2 deletions

View File

@ -445,3 +445,9 @@ ac_translate_dbformat(enum pipe_format format)
return V_028040_Z_INVALID;
}
}
bool
ac_is_zs_format_supported(enum pipe_format format)
{
return ac_translate_dbformat(format) != V_028040_Z_INVALID;
}

View File

@ -49,6 +49,9 @@ ac_colorformat_endian_swap(uint32_t colorformat);
uint32_t
ac_translate_dbformat(enum pipe_format format);
bool
ac_is_zs_format_supported(enum pipe_format format);
#ifdef __cplusplus
}
#endif

View File

@ -470,7 +470,7 @@ radv_is_zs_format_supported(VkFormat format)
if (format == VK_FORMAT_D24_UNORM_S8_UINT || format == VK_FORMAT_X8_D24_UNORM_PACK32)
return false;
return ac_translate_dbformat(vk_format_to_pipe_format(format)) != V_028040_Z_INVALID || format == VK_FORMAT_S8_UINT;
return ac_is_zs_format_supported(vk_format_to_pipe_format(format)) || format == VK_FORMAT_S8_UINT;
}
static bool

View File

@ -2461,7 +2461,7 @@ static bool si_is_zs_format_supported(enum pipe_format format)
if (format == PIPE_FORMAT_Z16_UNORM_S8_UINT)
return false;
return ac_translate_dbformat(format) != V_028040_Z_INVALID;
return ac_is_zs_format_supported(format);
}
static bool si_is_format_supported(struct pipe_screen *screen, enum pipe_format format,