u_transfer_helper: Use common code for interleaved unmap.

The function was static and only used from this caller, and the only
difference was that the interleaved case didn't handle trans->ss (which
will always be unset for an interleaved mapping since interleaving splits
the underlying map of the MSAA resource into trans->trans and
trans->trans2).

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20523>
This commit is contained in:
Emma Anholt
2023-01-04 11:52:19 -08:00
committed by Marge Bot
parent b5b2194a3a
commit 4372069f5a

View File

@@ -495,22 +495,14 @@ u_transfer_helper_transfer_flush_region(struct pipe_context *pctx,
}
}
static void
u_transfer_helper_deinterleave_transfer_unmap(struct pipe_context *pctx,
struct pipe_transfer *ptrans);
void
u_transfer_helper_transfer_unmap(struct pipe_context *pctx,
struct pipe_transfer *ptrans)
{
struct u_transfer_helper *helper = pctx->screen->transfer_helper;
bool interleave = need_interleave_path(helper, ptrans->resource->format);
if (need_interleave_path(helper, ptrans->resource->format)) {
u_transfer_helper_deinterleave_transfer_unmap(pctx, ptrans);
return;
}
if (handle_transfer(ptrans->resource)) {
if (handle_transfer(ptrans->resource) || interleave) {
struct u_transfer *trans = u_transfer(ptrans);
if (!(ptrans->usage & PIPE_MAP_FLUSH_EXPLICIT)) {
@@ -671,27 +663,3 @@ fail:
free(trans);
return NULL;
}
static void
u_transfer_helper_deinterleave_transfer_unmap(struct pipe_context *pctx,
struct pipe_transfer *ptrans)
{
struct u_transfer_helper *helper = pctx->screen->transfer_helper;
struct u_transfer *trans = (struct u_transfer *)ptrans;
if (!(ptrans->usage & PIPE_MAP_FLUSH_EXPLICIT)) {
struct pipe_box box;
u_box_2d(0, 0, ptrans->box.width, ptrans->box.height, &box);
flush_region(pctx, ptrans, &box);
}
helper->vtbl->transfer_unmap(pctx, trans->trans);
if (trans->trans2)
helper->vtbl->transfer_unmap(pctx, trans->trans2);
pipe_resource_reference(&ptrans->resource, NULL);
free(trans->staging);
free(trans);
}