pick mat3 from mat4

This commit is contained in:
Recep Aslantas
2016-10-11 00:15:57 +03:00
parent 77ed5d389d
commit 5344599ae4
2 changed files with 45 additions and 0 deletions

View File

@@ -11,6 +11,25 @@
#include "cglm-intrin.h"
CGLM_INLINE
void
glm_mat4_pick3_sse2(mat4 mat, mat3 dest) {
__m128 x0, x1, x2, x3;
x0 = _mm_load_ps(mat[0]);
x1 = _mm_load_ps(mat[1]);
x2 = _mm_load_ps(mat[2]);
x3 = _mm_shuffle_ps(x0, x1, _MM_SHUFFLE(0, 0, 2, 2));
x0 = _mm_shuffle_ps(x0, x3, _MM_SHUFFLE(2, 0, 1, 0));
x1 = _mm_shuffle_ps(x1, x2, _MM_SHUFFLE(1, 0, 2, 1));
_mm_storeu_ps(&dest[0][0], x0);
_mm_storeu_ps(&dest[1][1], x1);
dest[2][2] = mat[2][2];
}
CGLM_INLINE
void
glm_mat4_scale_sse2(mat4 m, float s){