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:
@@ -194,6 +194,7 @@ transfer_map_msaa(struct pipe_context *pctx,
|
|||||||
if (!trans)
|
if (!trans)
|
||||||
return NULL;
|
return NULL;
|
||||||
struct pipe_transfer *ptrans = &trans->base;
|
struct pipe_transfer *ptrans = &trans->base;
|
||||||
|
bool need_pack = needs_pack(usage);
|
||||||
|
|
||||||
pipe_resource_reference(&ptrans->resource, prsc);
|
pipe_resource_reference(&ptrans->resource, prsc);
|
||||||
ptrans->level = level;
|
ptrans->level = level;
|
||||||
@@ -207,6 +208,7 @@ transfer_map_msaa(struct pipe_context *pctx,
|
|||||||
.height0 = box->height,
|
.height0 = box->height,
|
||||||
.depth0 = 1,
|
.depth0 = 1,
|
||||||
.array_size = 1,
|
.array_size = 1,
|
||||||
|
.usage = need_pack ? PIPE_USAGE_STAGING : 0,
|
||||||
};
|
};
|
||||||
if (util_format_is_depth_or_stencil(tmpl.format))
|
if (util_format_is_depth_or_stencil(tmpl.format))
|
||||||
tmpl.bind |= PIPE_BIND_DEPTH_STENCIL;
|
tmpl.bind |= PIPE_BIND_DEPTH_STENCIL;
|
||||||
@@ -218,7 +220,7 @@ transfer_map_msaa(struct pipe_context *pctx,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needs_pack(usage)) {
|
if (need_pack) {
|
||||||
struct pipe_blit_info blit;
|
struct pipe_blit_info blit;
|
||||||
memset(&blit, 0, sizeof(blit));
|
memset(&blit, 0, sizeof(blit));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user