g-truc / glm

OpenGL Mathematics (GLM)
https://glm.g-truc.net
Other
9.05k stars 2.1k forks source link

AVX2 on glm::vec4 and not on glm::vec3 #1296

Open Snouf-ID opened 3 months ago

Snouf-ID commented 3 months ago

Hello.

Is it possible to have the vec4 and mat4 in simd with AVX2 and keep the vec3 and mat3 without simd? If so, can we still construct a vec4 with a vec3 + a float? Is it possible to have a vec3 simd and a not simd in the same project?

I ask this question because adding GLM_FORCE_INTRINSICS and GLM_FORCE_DEFAULT_ALIGNED_GENTYPES to have the AVX2 optimizations gives me vec3s of size 4, which is annoying for my vertex buffer (table of vec3).

I can't find many examples of good simd practices, especially since the simd_vec4 type is removed.

Thanks in advance.