From 2d63d7e0cd210edee125c686d84c998609779f4a Mon Sep 17 00:00:00 2001 From: Jonathan Platzer Date: Wed, 18 Jul 2018 12:00:46 +0200 Subject: [PATCH] Fix alignment issue when using AVX --- include/cglm/mat4.h | 2 +- include/cglm/types.h | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/cglm/mat4.h b/include/cglm/mat4.h index e6e358f..a0a50e7 100644 --- a/include/cglm/mat4.h +++ b/include/cglm/mat4.h @@ -139,7 +139,7 @@ glm_mat4_copy(mat4 mat, mat4 dest) { CGLM_INLINE void glm_mat4_identity(mat4 mat) { - CGLM_ALIGN(16) mat4 t = GLM_MAT4_IDENTITY_INIT; + mat4 t = GLM_MAT4_IDENTITY_INIT; glm_mat4_copy(t, mat); } diff --git a/include/cglm/types.h b/include/cglm/types.h index d470e7b..6fca0fe 100644 --- a/include/cglm/types.h +++ b/include/cglm/types.h @@ -31,8 +31,14 @@ typedef CGLM_ALIGN_IF(8) float vec3[3]; typedef int ivec3[3]; typedef CGLM_ALIGN_IF(16) float vec4[4]; -typedef vec3 mat3[3]; +#ifdef __AVX__ +typedef CGLM_ALIGN_IF(32) vec3 mat3[3]; +typedef CGLM_ALIGN_IF(32) vec4 mat4[4]; +#else +typedef vec3 mat3[3]; typedef CGLM_ALIGN_IF(16) vec4 mat4[4]; +#endif + typedef vec4 versor;