asahi: Respect render target format swizzle

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11086>
This commit is contained in:
Alyssa Rosenzweig 2021-05-31 15:37:40 -04:00 committed by Marge Bot
parent f690d1f7ab
commit cd09a61887
1 changed files with 6 additions and 4 deletions

View File

@ -572,14 +572,16 @@ agx_set_framebuffer_state(struct pipe_context *pctx,
for (unsigned i = 0; i < state->nr_cbufs; ++i) {
struct pipe_surface *surf = state->cbufs[i];
struct agx_resource *tex = agx_resource(surf->texture);
const struct util_format_description *desc =
util_format_description(surf->format);
agx_pack(ctx->render_target[i], RENDER_TARGET, cfg) {
cfg.layout = agx_translate_layout(tex->modifier);
cfg.format = agx_pixel_format[surf->format].hw;
cfg.swizzle_r = AGX_CHANNEL_B;
cfg.swizzle_g = AGX_CHANNEL_G;
cfg.swizzle_b = AGX_CHANNEL_R;
cfg.swizzle_a = AGX_CHANNEL_A;
cfg.swizzle_r = agx_channel_from_pipe(desc->swizzle[0]);
cfg.swizzle_g = agx_channel_from_pipe(desc->swizzle[1]);
cfg.swizzle_b = agx_channel_from_pipe(desc->swizzle[2]);
cfg.swizzle_a = agx_channel_from_pipe(desc->swizzle[3]);
cfg.width = state->width;
cfg.height = state->height;
cfg.buffer = tex->bo->ptr.gpu;