diff options
author | Axel Davy <axel.davy@ens.fr> | 2016-09-30 20:48:22 +0200 |
---|---|---|
committer | Axel Davy <axel.davy@ens.fr> | 2016-10-10 23:43:48 +0200 |
commit | 2290eac84ef0c80a6e60cafac8ed0fb8f8a4ca93 (patch) | |
tree | 1ed41ed88e72dbd24f9955225530a47f128731e3 /src/gallium/auxiliary | |
parent | 5e7f0ebe29df58c873b2c66674d8cbf0b1046a4d (diff) | |
download | external_mesa3d-2290eac84ef0c80a6e60cafac8ed0fb8f8a4ca93.zip external_mesa3d-2290eac84ef0c80a6e60cafac8ed0fb8f8a4ca93.tar.gz external_mesa3d-2290eac84ef0c80a6e60cafac8ed0fb8f8a4ca93.tar.bz2 |
gallium/util: Really allow aliasing of dst for u_box_union_*
Gallium nine relies on aliasing to work with this function.
Without this patch, dirty region tracking was incorrect, which
could lead to incorrect textures or vertex buffers.
Fixes several game bugs with nine.
Fixes https://github.com/iXit/Mesa-3D/issues/234
Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/util/u_box.h | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/gallium/auxiliary/util/u_box.h b/src/gallium/auxiliary/util/u_box.h index eb41f8a..b3f478e 100644 --- a/src/gallium/auxiliary/util/u_box.h +++ b/src/gallium/auxiliary/util/u_box.h @@ -124,11 +124,15 @@ static inline void u_box_union_2d(struct pipe_box *dst, const struct pipe_box *a, const struct pipe_box *b) { - dst->x = MIN2(a->x, b->x); - dst->y = MIN2(a->y, b->y); + int x, y; - dst->width = MAX2(a->x + a->width, b->x + b->width) - dst->x; - dst->height = MAX2(a->y + a->height, b->y + b->height) - dst->y; + x = MIN2(a->x, b->x); + y = MIN2(a->y, b->y); + + dst->width = MAX2(a->x + a->width, b->x + b->width) - x; + dst->height = MAX2(a->y + a->height, b->y + b->height) - y; + dst->x = x; + dst->y = y; } /* Aliasing of @dst permitted. */ @@ -136,13 +140,18 @@ static inline void u_box_union_3d(struct pipe_box *dst, const struct pipe_box *a, const struct pipe_box *b) { - dst->x = MIN2(a->x, b->x); - dst->y = MIN2(a->y, b->y); - dst->z = MIN2(a->z, b->z); - - dst->width = MAX2(a->x + a->width, b->x + b->width) - dst->x; - dst->height = MAX2(a->y + a->height, b->y + b->height) - dst->y; - dst->depth = MAX2(a->z + a->depth, b->z + b->depth) - dst->z; + int x, y, z; + + x = MIN2(a->x, b->x); + y = MIN2(a->y, b->y); + z = MIN2(a->z, b->z); + + dst->width = MAX2(a->x + a->width, b->x + b->width) - x; + dst->height = MAX2(a->y + a->height, b->y + b->height) - y; + dst->depth = MAX2(a->z + a->depth, b->z + b->depth) - z; + dst->x = x; + dst->y = y; + dst->z = z; } static inline boolean |