summaryrefslogtreecommitdiffstats
path: root/src/gallium/include
diff options
context:
space:
mode:
authorChuck Atkins <chuck.atkins@kitware.com>2016-06-28 22:32:02 -0400
committerTim Rowley <timothy.o.rowley@intel.com>2016-06-30 17:04:41 -0500
commitd8d6091a846ac2a40a011d512d6d57f6c8442e6a (patch)
tree2a3e233fc4a8d15da0bb4f30b1a1d71004171e77 /src/gallium/include
parentc1bf6692beb662e5749e5680e0ebd15af2cd032a (diff)
downloadexternal_mesa3d-d8d6091a846ac2a40a011d512d6d57f6c8442e6a.zip
external_mesa3d-d8d6091a846ac2a40a011d512d6d57f6c8442e6a.tar.gz
external_mesa3d-d8d6091a846ac2a40a011d512d6d57f6c8442e6a.tar.bz2
gallium: Force blend color to 16-byte alignment
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. v2: Fixed indentation and added a lengthy comment explaining the reason for the alignment. Cc: <mesa-stable@lists.freedesktop.org> Reported-by: Tim Rowley <timothy.o.rowley@intel.com> Tested-by: Tim Rowley <timothy.o.rowley@intel.com> Signed-off-by: Chuck Atkins <chuck.atkins@kitware.com> Acked-by: Roland Scheidegger <sroland@vmware.com>
Diffstat (limited to 'src/gallium/include')
-rw-r--r--src/gallium/include/pipe/p_state.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 1543e90..5526c39 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -326,7 +326,17 @@ struct pipe_blend_state
struct pipe_blend_color
{
- float color[4];
+ /**
+ * Making the color array explicitly 16-byte aligned provides a hint to
+ * compilers to make more efficient auto-vectorization optimizations.
+ * The actual performance gains from vectorizing the blend color array are
+ * fairly minimal, if any, but the alignment is necessary to work around
+ * buggy vectorization in some compilers which fail to generate the correct
+ * unaligned accessors resulting in a segfault. Specifically several
+ * versions of the Intel compiler are known to be affected but it's likely
+ * others are as well.
+ */
+ PIPE_ALIGN_VAR(16) float color[4];
};