From cde1a1d5c2a82f414701effa4c5c541b196af232 Mon Sep 17 00:00:00 2001 From: Luc Ma Date: Fri, 21 Jun 2024 17:18:40 +0800 Subject: [PATCH] gallium: properly propagate the usage of resource In case that some drivers might make decision depending on it, it is better to tell drivers about usage of resource just like in `blit_to_staging()` and `st_TexSubImage()` etc before going to blit. Signed-off-by: Luc Ma Reviewed-by: Erik Faye-Lund Part-of: --- src/gallium/auxiliary/util/u_transfer_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_transfer_helper.c b/src/gallium/auxiliary/util/u_transfer_helper.c index db580e6f513..1e0f490a7d5 100644 --- a/src/gallium/auxiliary/util/u_transfer_helper.c +++ b/src/gallium/auxiliary/util/u_transfer_helper.c @@ -194,6 +194,7 @@ transfer_map_msaa(struct pipe_context *pctx, if (!trans) return NULL; struct pipe_transfer *ptrans = &trans->base; + bool need_pack = needs_pack(usage); pipe_resource_reference(&ptrans->resource, prsc); ptrans->level = level; @@ -207,6 +208,7 @@ transfer_map_msaa(struct pipe_context *pctx, .height0 = box->height, .depth0 = 1, .array_size = 1, + .usage = need_pack ? PIPE_USAGE_STAGING : 0, }; if (util_format_is_depth_or_stencil(tmpl.format)) tmpl.bind |= PIPE_BIND_DEPTH_STENCIL; @@ -218,7 +220,7 @@ transfer_map_msaa(struct pipe_context *pctx, return NULL; } - if (needs_pack(usage)) { + if (need_pack) { struct pipe_blit_info blit; memset(&blit, 0, sizeof(blit));