llvmpipe: fix lp_rast_plane alignment on 32bit

Some rasterization code relies (for sse) on the first and third planes
(but not the second for now) being 128bit aligned, and we didn't get that
on 32bit - I mistakenly thought the 64bit number in the struct would get
the thing aligned to 64bit even on 32bit archs.
Stephane Marchesin really figured this out.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>

CC: <mesa-stable@lists.freedesktop.org>
This commit is contained in:
Roland Scheidegger 2016-03-15 16:39:55 +01:00
parent 12a4f0bed6
commit bb2c5e657b
2 changed files with 8 additions and 0 deletions

View file

@ -116,6 +116,12 @@ struct lp_rast_plane {
/* one-pixel sized trivial reject offsets for each plane */
uint32_t eo;
/*
* We rely on this struct being 64bit aligned (ideally it would be 128bit
* but that's quite the waste) and therefore on 32bit we need padding
* since otherwise (even with the 64bit number in there) it wouldn't be.
*/
uint32_t pad;
};
/**

View file

@ -94,6 +94,8 @@ lp_setup_alloc_triangle(struct lp_scene *scene,
unsigned plane_sz = nr_planes * sizeof(struct lp_rast_plane);
struct lp_rast_triangle *tri;
STATIC_ASSERT(sizeof(struct lp_rast_plane) % 8 == 0);
*tri_size = (sizeof(struct lp_rast_triangle) +
3 * input_array_sz +
plane_sz);