Mesa (main): zink: Re-interpret formats when using vkCmdClearColorImage()
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Feb 9 05:25:08 UTC 2022
Module: Mesa
Branch: main
Commit: 745fc95659bd19908f5bd85f73c92e4a92e28f85
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=745fc95659bd19908f5bd85f73c92e4a92e28f85
Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date: Tue Feb 8 15:31:20 2022 -0600
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 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14932>
---
src/gallium/drivers/zink/zink_clear.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_clear.c b/src/gallium/drivers/zink/zink_clear.c
index 77f294f5279..6b6db04c3ca 100644
--- a/src/gallium/drivers/zink/zink_clear.c
+++ b/src/gallium/drivers/zink/zink_clear.c
@@ -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,
More information about the mesa-commit
mailing list