Module: Mesa Branch: main Commit: 15b302179a74f49036f45b7ec8d27536b58094ee URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=15b302179a74f49036f45b7ec8d27536b58094ee
Author: Mike Blumenkrantz <[email protected]> Date: Tue Feb 14 13:10:28 2023 -0500 aux/tc: add a 'has_resolve' member to tc_renderpass_info this indicates that the first color buffer gets resolved Acked-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21365> --- src/gallium/auxiliary/util/u_threaded_context.c | 6 ++++++ src/gallium/auxiliary/util/u_threaded_context.h | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index 1145f961743..bb89f6417b3 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -1401,6 +1401,7 @@ tc_set_framebuffer_state(struct pipe_context *_pipe, sizeof(void*) * (PIPE_MAX_COLOR_BUFS - nr_cbufs)); tc->fb_resources[PIPE_MAX_COLOR_BUFS] = fb->zsbuf ? fb->zsbuf->texture : NULL; + tc->fb_resolve = fb->resolve; if (tc->seen_fb_state) { /* this is the end of a renderpass, so increment the renderpass info */ tc_batch_increment_renderpass_info(tc, false); @@ -4174,6 +4175,11 @@ tc_blit(struct pipe_context *_pipe, const struct pipe_blit_info *info) tc_set_resource_reference(&blit->info.dst.resource, info->dst.resource); tc_set_resource_reference(&blit->info.src.resource, info->src.resource); memcpy(&blit->info, info, sizeof(*info)); + if (tc->options.parse_renderpass_info) { + tc->renderpass_info_recording->has_resolve = info->src.resource->nr_samples > 1 && + info->dst.resource->nr_samples <= 1 && + tc->fb_resolve == info->dst.resource; + } } struct tc_generate_mipmap { diff --git a/src/gallium/auxiliary/util/u_threaded_context.h b/src/gallium/auxiliary/util/u_threaded_context.h index e87b0061ecd..69878daffc5 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.h +++ b/src/gallium/auxiliary/util/u_threaded_context.h @@ -444,7 +444,9 @@ struct tc_renderpass_info { bool zsbuf_invalidate : 1; /* whether a draw occurs */ bool has_draw : 1; - uint8_t pad : 3; + /* whether a framebuffer resolve occurs on cbuf[0] */ + bool has_resolve : 1; + uint8_t pad : 2; /* 32 bits offset */ /* bitmask of color buffers using fbfetch */ uint8_t cbuf_fbfetch; @@ -619,8 +621,9 @@ struct threaded_context { struct tc_batch batch_slots[TC_MAX_BATCHES]; struct tc_buffer_list buffer_lists[TC_MAX_BUFFER_LISTS]; - /* the curent framebuffer attachments; [PIPE_MAX_COLOR_BUFS] is the zsbuf */ + /* the current framebuffer attachments; [PIPE_MAX_COLOR_BUFS] is the zsbuf */ struct pipe_resource *fb_resources[PIPE_MAX_COLOR_BUFS + 1]; + struct pipe_resource *fb_resolve; /* accessed by main thread; preserves info across batches */ struct tc_renderpass_info *renderpass_info_recording; /* accessed by driver thread */
