[Mesa-dev] [PATCH] gallium: Force blend color to 16-byte alignment

Nicolai Hähnle nhaehnle at gmail.com
Fri Jul 8 09:16:15 UTC 2016


Hi Chuck,

this commit breaks 32-bit builds at least of radeonsi and probably 
others because malloc()ed structures are only aligned to 8 bytes, see 
https://bugs.freedesktop.org/show_bug.cgi?id=96835

I presume there are two possible fixes:
1. Drop the alignment on 32-bit.
2. Align affected structures to 16 byte boundaries manually.

Personally, I prefer the first option because it seems less fragile, but 
the question is whether the 16-byte alignment is needed for 32-bit 
builds as well?

Cheers,
Nicolai

On 28.06.2016 22:45, Chuck Atkins wrote:
> This aligns the 4-element color float array to 16 byte boundaries.  This
> should allow compiler vectorizers to generate better optimizations.
> Also fixes broken vectorization generated by Intel compiler.
>
> Reported-by: Tim Rowley <timothy.o.rowley at intel.com>
> Signed-off-by: Chuck Atkins <chuck.atkins at kitware.com>
> ---
>   src/gallium/include/pipe/p_state.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
> index 1543e90..95f140f 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -326,7 +326,7 @@ struct pipe_blend_state
>
>   struct pipe_blend_color
>   {
> -   float color[4];
> +  PIPE_ALIGN_VAR(16) float color[4];
>   };
>
>
>


More information about the mesa-dev mailing list