zink: optimize the remaining read cases of applying pending clear calls
we have src regions for all the blit/copy/map calls, so we can use those to verify whether we actually need to apply the clears now or if we can keep sitting on them a while longer Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9206>
This commit is contained in:
parent
50281dacad
commit
3c4bc68a05
|
@ -39,7 +39,7 @@ blit_resolve(struct zink_context *ctx, const struct pipe_blit_info *info)
|
|||
info->dst.box.x, info->dst.box.x + info->dst.box.width);
|
||||
|
||||
zink_fb_clears_apply_or_discard(ctx, info->dst.resource, zink_rect_from_box(&info->dst.box), false);
|
||||
zink_fb_clears_apply(ctx, info->src.resource);
|
||||
zink_fb_clears_apply_region(ctx, info->src.resource, zink_rect_from_box(&info->src.box));
|
||||
struct zink_batch *batch = zink_batch_no_rp(ctx);
|
||||
|
||||
zink_batch_reference_resource_rw(batch, src, false);
|
||||
|
@ -121,7 +121,7 @@ blit_native(struct zink_context *ctx, const struct pipe_blit_info *info)
|
|||
return false;
|
||||
|
||||
zink_fb_clears_apply_or_discard(ctx, info->dst.resource, zink_rect_from_box(&info->dst.box), false);
|
||||
zink_fb_clears_apply(ctx, info->src.resource);
|
||||
zink_fb_clears_apply_region(ctx, info->src.resource, zink_rect_from_box(&info->src.box));
|
||||
struct zink_batch *batch = zink_batch_no_rp(ctx);
|
||||
zink_batch_reference_resource_rw(batch, src, false);
|
||||
zink_batch_reference_resource_rw(batch, dst, true);
|
||||
|
|
|
@ -1592,7 +1592,7 @@ zink_resource_copy_region(struct pipe_context *pctx,
|
|||
unreachable("planar formats not yet handled");
|
||||
|
||||
zink_fb_clears_apply_or_discard(ctx, pdst, (struct u_rect){dstx, dstx + src_box->width, dsty, dsty + src_box->height}, false);
|
||||
zink_fb_clears_apply(ctx, psrc);
|
||||
zink_fb_clears_apply_region(ctx, psrc, zink_rect_from_box(src_box));
|
||||
|
||||
region.srcSubresource.aspectMask = src->aspect;
|
||||
region.srcSubresource.mipLevel = src_level;
|
||||
|
|
|
@ -619,7 +619,12 @@ zink_transfer_map(struct pipe_context *pctx,
|
|||
if (usage & PIPE_MAP_WRITE)
|
||||
util_range_add(&res->base, &res->valid_buffer_range, box->x, box->x + box->width);
|
||||
} else {
|
||||
zink_fb_clears_apply(ctx, pres);
|
||||
if (usage & PIPE_MAP_WRITE && !(usage & PIPE_MAP_READ))
|
||||
/* this is like a blit, so we can potentially dump some clears or maybe we have to */
|
||||
zink_fb_clears_apply_or_discard(ctx, pres, zink_rect_from_box(box), false);
|
||||
else if (usage & PIPE_MAP_READ)
|
||||
/* if the map region intersects with any clears then we have to apply them */
|
||||
zink_fb_clears_apply_region(ctx, pres, zink_rect_from_box(box));
|
||||
if (res->optimal_tiling || !res->host_visible) {
|
||||
enum pipe_format format = pres->format;
|
||||
if (usage & PIPE_MAP_DEPTH_ONLY)
|
||||
|
|
Loading…
Reference in New Issue