mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
drisw: clamp damage region to texture bounds
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28242>
This commit is contained in:
parent
85a91f461c
commit
912e203a53
1 changed files with 9 additions and 1 deletions
|
|
@ -246,7 +246,15 @@ drisw_swap_buffers_with_damage(struct dri_drawable *drawable, int nrects, const
|
|||
for (unsigned int i = 0; i < nrects; i++) {
|
||||
const int *rect = &rects[i * 4];
|
||||
|
||||
u_box_2d(rect[0], ptex->height0 - rect[1] - rect[3], rect[2], rect[3], &stack_boxes[i]);
|
||||
int w = MIN2(rect[2], ptex->width0);
|
||||
int h = MIN2(rect[3], ptex->height0);
|
||||
int x = CLAMP(rect[0], 0, ptex->width0);
|
||||
int y = CLAMP(ptex->height0 - rect[1] - h, 0, ptex->height0);
|
||||
|
||||
if (h > ptex->height0 - y)
|
||||
h = ptex->height0 - y;
|
||||
|
||||
u_box_2d(x, y, w, h, &stack_boxes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue