blorp: convert fast clear color for unsupported formats

This tests is asserting on LNL like :

  dEQP-VK.pipeline.monolithic.sampler.border_swizzle.r8_srgb.gbar.custom.gather_1.no_swizzle_hint
  dEQP-VK.api.image_clearing.core.clear_color_image.2d.optimal.single_layer.e5b9g9r9_ufloat_pack32

Because blorp tries, for example, to setup a render target with
L8_UNORM_SRGB (which is mapped to the R8_UNORM_SRGB of Vulkan) but is
not supported for rendering.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 1c7fe9ad1b ("anv: Support fast clears in anv_CmdClearColorImage")
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31357>
This commit is contained in:
Lionel Landwerlin 2024-09-25 11:05:47 +03:00 committed by Marge Bot
parent 10282ee079
commit 50cc738a6d

View file

@ -414,14 +414,23 @@ blorp_fast_clear(struct blorp_batch *batch,
params.y1 = y1;
if (batch->blorp->isl_dev->info->ver >= 20) {
union isl_color_value clear_color =
isl_color_value_swizzle_inv(surf->clear_color, swizzle);
if (format == ISL_FORMAT_R9G9B9E5_SHAREDEXP) {
clear_color.u32[0] = float3_to_rgb9e5(clear_color.f32);
format = ISL_FORMAT_R32_UINT;
} else if (format == ISL_FORMAT_L8_UNORM_SRGB) {
clear_color.f32[0] = util_format_linear_to_srgb_float(clear_color.f32[0]);
format = ISL_FORMAT_R8_UNORM;
}
/* Bspec 57340 (r59562):
*
* Overview of Fast Clear:
* Pixel shader's color output is treated as Clear Value, value
* should be a constant.
*/
memcpy(&params.wm_inputs.clear_color, &surf->clear_color,
4 * sizeof(float));
memcpy(&params.wm_inputs.clear_color, &clear_color, 4 * sizeof(float));
} else {
/* BSpec: 2423 (r153658):
*