radv: rework radv_fast_clear_flush_image_inplace()

FMASK_DECOMPRESS also implies FAST_CLEAR_ELIMINATE, so it can run first.
The only exception is fast-clear for color images that have DCC and
FMASK but without comp-to-single (only GFX10) because FMASK_DECOMPRESS
can't eliminate DCC fast-clears.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33639>
This commit is contained in:
Samuel Pitoiset 2025-02-20 10:58:34 +01:00 committed by Marge Bot
parent a452098791
commit aaf634cc24

View file

@ -441,20 +441,25 @@ void
radv_fast_clear_flush_image_inplace(struct radv_cmd_buffer *cmd_buffer, struct radv_image *image,
const VkImageSubresourceRange *subresourceRange)
{
if (radv_image_has_fmask(image) && !image->tc_compatible_cmask) {
if (radv_image_has_dcc(image) && radv_image_has_cmask(image) && !image->support_comp_to_single) {
/* MSAA images with DCC and CMASK might have been fast-cleared and might require a FCE but
* FMASK_DECOMPRESS can't eliminate DCC fast clears.
*/
/* FMASK_DECOMPRESS is only required for MSAA images that don't support TC-compat CMASK. */
const bool needs_fmask_decompress = radv_image_has_fmask(image) && !image->tc_compatible_cmask;
/* FCE is only required for color images that don't support comp-to-single fast clears. */
const bool needs_fce = !image->support_comp_to_single;
if (needs_fmask_decompress) {
/* MSAA images with DCC and CMASK might have been fast-cleared and might require a FCE but
* FMASK_DECOMPRESS can't eliminate DCC fast clears. Only GFX10 is affected because it has few
* restrictions related to comp-to-single.
*/
const bool needs_dcc_fce =
radv_image_has_dcc(image) && radv_image_has_cmask(image) && !image->support_comp_to_single;
if (needs_dcc_fce)
radv_fast_clear_eliminate(cmd_buffer, image, subresourceRange);
}
radv_fmask_decompress(cmd_buffer, image, subresourceRange);
} else {
/* Skip fast clear eliminate for images that support comp-to-single fast clears. */
if (image->support_comp_to_single)
return;
} else if (needs_fce) {
radv_fast_clear_eliminate(cmd_buffer, image, subresourceRange);
}
}