From eb5c6591482cc35976fa9509edd7ef94a8cac79a Mon Sep 17 00:00:00 2001 From: IJzerbaard Date: Sun, 11 Feb 2018 00:59:07 +0100 Subject: [PATCH] Improve HMM_MultiplyMat4 (#76) Remove all transposes, (AT BT)T = BA --- HandmadeMath.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/HandmadeMath.h b/HandmadeMath.h index 9d7ee3f..d9dd006 100644 --- a/HandmadeMath.h +++ b/HandmadeMath.h @@ -2209,15 +2209,12 @@ hmm_mat4 HMM_MultiplyMat4(hmm_mat4 Left, hmm_mat4 Right) hmm_mat4 Result; #ifdef HANDMADE_MATH__USE_SSE - hmm_mat4 TransposedLeft = HMM_Transpose(Left); - hmm_mat4 TransposedRight = HMM_Transpose(Right); - Result.Rows[0] = HMM_LinearCombineSSE(TransposedLeft.Rows[0], TransposedRight); - Result.Rows[1] = HMM_LinearCombineSSE(TransposedLeft.Rows[1], TransposedRight); - Result.Rows[2] = HMM_LinearCombineSSE(TransposedLeft.Rows[2], TransposedRight); - Result.Rows[3] = HMM_LinearCombineSSE(TransposedLeft.Rows[3], TransposedRight); + Result.Rows[0] = HMM_LinearCombineSSE(Right.Rows[0], Left); + Result.Rows[1] = HMM_LinearCombineSSE(Right.Rows[1], Left); + Result.Rows[2] = HMM_LinearCombineSSE(Right.Rows[2], Left); + Result.Rows[3] = HMM_LinearCombineSSE(Right.Rows[3], Left); - Result = HMM_Transpose(Result); #else int Columns; for(Columns = 0; Columns < 4; ++Columns)