anv: Store fast-clear colors with the view swizzle

Prevents the next patch from failing CTS tests such as:

   dEQP-VK.api.image_clearing.core.clear_color_image.*.b4g4r4a4*

Brings back the feature that was introduced in commit 46187bb54f
("anv: Swizzle fast-clear values"), but went unused in commit
721d0c3e77 ("anv,hasvk: Always use BLORP_BATCH_NO_UPDATE_CLEAR_COLOR").

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32187>
This commit is contained in:
Nanley Chery 2024-09-06 08:50:53 -04:00 committed by Marge Bot
parent 2a9d7a3bd0
commit 93e42f9700
5 changed files with 11 additions and 2 deletions

View file

@ -1474,6 +1474,7 @@ void anv_CmdClearColorImage(
if (cmd_buffer->device->info->ver < 20) {
anv_cmd_buffer_mark_image_fast_cleared(cmd_buffer, image,
src_format.isl_format,
src_format.swizzle,
clear_color);
}
@ -1705,6 +1706,7 @@ clear_color_attachment(struct anv_cmd_buffer *cmd_buffer,
if (cmd_buffer->device->info->ver < 20) {
anv_cmd_buffer_mark_image_fast_cleared(cmd_buffer, iview->image,
iview->planes[0].isl.format,
iview->planes[0].isl.swizzle,
clear_color);
anv_cmd_buffer_load_clear_color(cmd_buffer, att->surface_state.state,
iview);

View file

@ -345,10 +345,11 @@ void
anv_cmd_buffer_mark_image_fast_cleared(struct anv_cmd_buffer *cmd_buffer,
const struct anv_image *image,
const enum isl_format format,
const struct isl_swizzle swizzle,
union isl_color_value clear_color)
{
const struct intel_device_info *devinfo = cmd_buffer->device->info;
anv_genX(devinfo, set_fast_clear_state)(cmd_buffer, image, format,
anv_genX(devinfo, set_fast_clear_state)(cmd_buffer, image, format, swizzle,
clear_color);
}

View file

@ -75,6 +75,7 @@ void
genX(set_fast_clear_state)(struct anv_cmd_buffer *cmd_buffer,
const struct anv_image *image,
const enum isl_format format,
const struct isl_swizzle swizzle,
union isl_color_value clear_color);
void

View file

@ -5791,6 +5791,7 @@ void
anv_cmd_buffer_mark_image_fast_cleared(struct anv_cmd_buffer *cmd_buffer,
const struct anv_image *image,
const enum isl_format format,
const struct isl_swizzle swizzle,
union isl_color_value clear_color);
void

View file

@ -977,10 +977,13 @@ void
genX(set_fast_clear_state)(struct anv_cmd_buffer *cmd_buffer,
const struct anv_image *image,
const enum isl_format format,
const struct isl_swizzle swizzle,
union isl_color_value clear_color)
{
uint32_t pixel[4] = {};
isl_color_value_pack(&clear_color, format, pixel);
union isl_color_value swiz_color =
isl_color_value_swizzle_inv(clear_color, swizzle);
isl_color_value_pack(&swiz_color, format, pixel);
set_image_clear_color(cmd_buffer, image, VK_IMAGE_ASPECT_COLOR_BIT, pixel);
if (isl_color_value_is_zero(clear_color, format)) {
@ -5414,6 +5417,7 @@ void genX(CmdBeginRendering)(
#if GFX_VER < 20
genX(set_fast_clear_state)(cmd_buffer, iview->image,
iview->planes[0].isl.format,
iview->planes[0].isl.swizzle,
clear_color);
#endif
}