zink: Re-interpret formats when using vkCmdClearColorImage()

vkCmdClearColorImage() doesn't take a view format so it always uses the
underlying format of the image.  If there's texture views going on, we
need to manually mangle the colors into the image format.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14932>
This commit is contained in:
Jason Ekstrand 2022-02-08 15:31:20 -06:00 committed by Marge Bot
parent 86eaff29c0
commit 745fc95659

View file

@ -555,8 +555,13 @@ fb_clears_apply_internal(struct zink_context *ctx, struct pipe_resource *pres, i
else {
struct pipe_surface *psurf = ctx->fb_state.cbufs[i];
struct zink_framebuffer_clear_data *clear = zink_fb_clear_element(fb_clear, 0);
union pipe_color_union color;
zink_fb_clear_util_unpack_clear_color(clear, psurf->format, &color);
union pipe_color_union color = clear->color.color;
if (psurf->format != psurf->texture->format) {
uint32_t data[4];
util_format_pack_rgba(psurf->format, data, color.ui, 1);
util_format_unpack_rgba(pres->format, color.ui, data, 1);
}
clear_color_no_rp(ctx, res, &color,
psurf->u.tex.level, psurf->u.tex.first_layer,