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 <luc@sietium.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29833>
This commit is contained in:
Luc Ma
2024-06-21 17:18:40 +08:00
committed by Marge Bot
parent 9ae1c5dce3
commit cde1a1d5c2

View File

@@ -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));