mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-28 07:30:22 +01:00
intel/blorp: Choose some copy formats independently
blorp_copy_get_formats() tries to make the source and destination view formats match as much as possible. This avoids some casting in the copy shader, but it makes determining the format that will be used for a surface impossible without having the ISL surface for both that surface and a source or destination. We'd like to enable the Vulkan driver to know as early as possible what format an image may be reinterpreted as for correctness. So, determine the copy formats more independently and expose a helper which does so for drivers. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31136>
This commit is contained in:
parent
6721064939
commit
73637dbce4
2 changed files with 28 additions and 22 deletions
|
|
@ -232,6 +232,9 @@ blorp_blit(struct blorp_batch *batch,
|
|||
enum blorp_filter filter,
|
||||
bool mirror_x, bool mirror_y);
|
||||
|
||||
enum isl_format
|
||||
blorp_copy_get_color_format(const struct isl_device *isl_dev,
|
||||
enum isl_format surf_format);
|
||||
void
|
||||
blorp_copy_get_formats(const struct isl_device *isl_dev,
|
||||
const struct isl_surf *src_surf,
|
||||
|
|
|
|||
|
|
@ -2771,6 +2771,25 @@ get_ccs_compatible_copy_format(const struct isl_format_layout *fmtl)
|
|||
}
|
||||
}
|
||||
|
||||
enum isl_format
|
||||
blorp_copy_get_color_format(const struct isl_device *isl_dev,
|
||||
enum isl_format surf_format)
|
||||
{
|
||||
const struct isl_format_layout *fmtl = isl_format_get_layout(surf_format);
|
||||
|
||||
if (ISL_GFX_VER(isl_dev) <= 12 &&
|
||||
isl_format_supports_ccs_e(isl_dev->info, surf_format)) {
|
||||
/* On gfx9-12, choose a copy format that maintains compatibility with
|
||||
* CCS_E. Although format reinterpretation doesn't affect compression
|
||||
* support while rendering on gfx12, the sampler does have reduced
|
||||
* support for compression when the bits-per-channel changes.
|
||||
*/
|
||||
return get_ccs_compatible_copy_format(fmtl);
|
||||
} else {
|
||||
return get_copy_format_for_bpb(isl_dev, fmtl->bpb);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
blorp_surf_convert_to_uncompressed(const struct isl_device *isl_dev,
|
||||
struct blorp_surface_info *info,
|
||||
|
|
@ -2874,33 +2893,17 @@ blorp_copy_get_formats(const struct isl_device *isl_dev,
|
|||
*/
|
||||
*src_view_format = dst_surf->format;
|
||||
*dst_view_format = dst_surf->format;
|
||||
} else if (isl_surf_usage_is_depth(src_surf->usage) ||
|
||||
isl_surf_usage_is_depth(dst_surf->usage)) {
|
||||
} else if (isl_surf_usage_is_depth_or_stencil(src_surf->usage) ||
|
||||
isl_surf_usage_is_depth_or_stencil(dst_surf->usage)) {
|
||||
assert(src_fmtl->bpb == dst_fmtl->bpb);
|
||||
*src_view_format =
|
||||
*dst_view_format =
|
||||
get_copy_format_for_bpb(isl_dev, dst_fmtl->bpb);
|
||||
} else if (ISL_GFX_VER(isl_dev) < 20 &&
|
||||
isl_format_supports_ccs_e(isl_dev->info, dst_surf->format)) {
|
||||
*dst_view_format = get_ccs_compatible_copy_format(dst_fmtl);
|
||||
if (isl_format_supports_ccs_e(isl_dev->info, src_surf->format)) {
|
||||
*src_view_format = get_ccs_compatible_copy_format(src_fmtl);
|
||||
} else if (src_fmtl->bpb == dst_fmtl->bpb) {
|
||||
*src_view_format = *dst_view_format;
|
||||
} else {
|
||||
*src_view_format = get_copy_format_for_bpb(isl_dev, src_fmtl->bpb);
|
||||
}
|
||||
} else if (ISL_GFX_VER(isl_dev) < 20 &&
|
||||
isl_format_supports_ccs_e(isl_dev->info, src_surf->format)) {
|
||||
*src_view_format = get_ccs_compatible_copy_format(src_fmtl);
|
||||
if (src_fmtl->bpb == dst_fmtl->bpb) {
|
||||
*dst_view_format = *src_view_format;
|
||||
} else {
|
||||
*dst_view_format = get_copy_format_for_bpb(isl_dev, dst_fmtl->bpb);
|
||||
}
|
||||
} else {
|
||||
*dst_view_format = get_copy_format_for_bpb(isl_dev, dst_fmtl->bpb);
|
||||
*src_view_format = get_copy_format_for_bpb(isl_dev, src_fmtl->bpb);
|
||||
*src_view_format =
|
||||
blorp_copy_get_color_format(isl_dev, src_surf->format);
|
||||
*dst_view_format =
|
||||
blorp_copy_get_color_format(isl_dev, dst_surf->format);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue