zink: add another helper for checking whether one rect covers another

this is going to be used for no-oping writes

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9206>
This commit is contained in:
Mike Blumenkrantz 2020-09-17 09:37:50 -04:00 committed by Marge Bot
parent 72653ade81
commit f6cf5a64cc
2 changed files with 15 additions and 0 deletions

View File

@ -278,3 +278,15 @@ zink_blit_region_fills(struct u_rect region, unsigned width, unsigned height)
return false;
}
bool
zink_blit_region_covers(struct u_rect region, struct u_rect covers)
{
struct u_rect intersect;
if (!u_rect_test_intersection(&region, &covers))
return false;
u_rect_union(&intersect, &region, &covers);
return intersect.x0 == covers.x0 && intersect.y0 == covers.y0 &&
intersect.x1 == covers.x1 && intersect.y1 == covers.y1;
}

View File

@ -284,6 +284,9 @@ zink_blit(struct pipe_context *pctx,
bool
zink_blit_region_fills(struct u_rect region, unsigned width, unsigned height);
bool
zink_blit_region_covers(struct u_rect region, struct u_rect covers);
static inline struct u_rect
zink_rect_from_box(const struct pipe_box *box)
{